2023-03-11 17:33:20

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 01/12] net: dsa: lantiq_gswip: mark OF related data as maybe unused

The driver can be compile tested with !CONFIG_OF making certain data
unused:

drivers/net/dsa/lantiq_gswip.c:1888:34: error: ‘xway_gphy_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/net/dsa/lantiq_gswip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
index 05ecaa007ab1..3c76a1a14aee 100644
--- a/drivers/net/dsa/lantiq_gswip.c
+++ b/drivers/net/dsa/lantiq_gswip.c
@@ -1885,7 +1885,7 @@ static const struct xway_gphy_match_data xrx300_gphy_data = {
.ge_firmware_name = "lantiq/xrx300_phy11g_a21.bin",
};

-static const struct of_device_id xway_gphy_match[] = {
+static const struct of_device_id xway_gphy_match[] __maybe_unused = {
{ .compatible = "lantiq,xrx200-gphy-fw", .data = NULL },
{ .compatible = "lantiq,xrx200a1x-gphy-fw", .data = &xrx200a1x_gphy_data },
{ .compatible = "lantiq,xrx200a2x-gphy-fw", .data = &xrx200a2x_gphy_data },
--
2.34.1



2023-03-11 17:33:33

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 03/12] net: dsa: seville_vsc9953: drop of_match_ptr for ID table

The driver can match only via the DT table so the table should be always
used and the of_match_ptr does not have any sense (this also allows ACPI
matching via PRP0001, even though it might not be relevant here).

drivers/net/dsa/ocelot/seville_vsc9953.c:1070:34: error: ‘seville_of_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/net/dsa/ocelot/seville_vsc9953.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
index 563ad338da25..96d4972a62f0 100644
--- a/drivers/net/dsa/ocelot/seville_vsc9953.c
+++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
@@ -1079,7 +1079,7 @@ static struct platform_driver seville_vsc9953_driver = {
.shutdown = seville_shutdown,
.driver = {
.name = "mscc_seville",
- .of_match_table = of_match_ptr(seville_of_match),
+ .of_match_table = seville_of_match,
},
};
module_platform_driver(seville_vsc9953_driver);
--
2.34.1


2023-03-11 17:33:39

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 02/12] net: dsa: lan9303: drop of_match_ptr for ID table

The driver will match mostly or only by DT table (even thought there is
regular ID table) so there is little benefit in of_match_ptr (this also
allows ACPI matching via PRP0001, even though it might not be relevant
here).

drivers/net/dsa/lan9303_i2c.c:97:34: error: ‘lan9303_i2c_of_match’ defined but not used [-Werror=unused-const-variable=]
drivers/net/dsa/lan9303_mdio.c:157:34: error: ‘lan9303_mdio_of_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/net/dsa/lan9303_i2c.c | 2 +-
drivers/net/dsa/lan9303_mdio.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/lan9303_i2c.c b/drivers/net/dsa/lan9303_i2c.c
index 1cb41c36bd47..e8844820c3a9 100644
--- a/drivers/net/dsa/lan9303_i2c.c
+++ b/drivers/net/dsa/lan9303_i2c.c
@@ -103,7 +103,7 @@ MODULE_DEVICE_TABLE(of, lan9303_i2c_of_match);
static struct i2c_driver lan9303_i2c_driver = {
.driver = {
.name = "LAN9303_I2C",
- .of_match_table = of_match_ptr(lan9303_i2c_of_match),
+ .of_match_table = lan9303_i2c_of_match,
},
.probe_new = lan9303_i2c_probe,
.remove = lan9303_i2c_remove,
diff --git a/drivers/net/dsa/lan9303_mdio.c b/drivers/net/dsa/lan9303_mdio.c
index 4f33369a2de5..d8ab2b77d201 100644
--- a/drivers/net/dsa/lan9303_mdio.c
+++ b/drivers/net/dsa/lan9303_mdio.c
@@ -164,7 +164,7 @@ MODULE_DEVICE_TABLE(of, lan9303_mdio_of_match);
static struct mdio_driver lan9303_mdio_driver = {
.mdiodrv.driver = {
.name = "LAN9303_MDIO",
- .of_match_table = of_match_ptr(lan9303_mdio_of_match),
+ .of_match_table = lan9303_mdio_of_match,
},
.probe = lan9303_mdio_probe,
.remove = lan9303_mdio_remove,
--
2.34.1


2023-03-11 17:33:43

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 04/12] net: dsa: ksz9477: drop of_match_ptr for ID table

The driver will match mostly by DT table (even thought there is regular
ID table) so there is little benefit in of_match_ptr (this also allows
ACPI matching via PRP0001, even though it might not be relevant here).

drivers/net/dsa/microchip/ksz9477_i2c.c:84:34: error: ‘ksz9477_dt_ids’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/net/dsa/microchip/ksz9477_i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/microchip/ksz9477_i2c.c b/drivers/net/dsa/microchip/ksz9477_i2c.c
index e315f669ec06..97a317263a2f 100644
--- a/drivers/net/dsa/microchip/ksz9477_i2c.c
+++ b/drivers/net/dsa/microchip/ksz9477_i2c.c
@@ -117,7 +117,7 @@ MODULE_DEVICE_TABLE(of, ksz9477_dt_ids);
static struct i2c_driver ksz9477_i2c_driver = {
.driver = {
.name = "ksz9477-switch",
- .of_match_table = of_match_ptr(ksz9477_dt_ids),
+ .of_match_table = ksz9477_dt_ids,
},
.probe_new = ksz9477_i2c_probe,
.remove = ksz9477_i2c_remove,
--
2.34.1


2023-03-11 17:33:46

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 05/12] net: dsa: ocelot: drop of_match_ptr for ID table

The driver can match only via the DT table so the table should be always
used and the of_match_ptr does not have any sense (this also allows ACPI
matching via PRP0001, even though it might not be relevant here).

drivers/net/dsa/ocelot/ocelot_ext.c:143:34: error: ‘ocelot_ext_switch_of_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/net/dsa/ocelot/ocelot_ext.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/ocelot/ocelot_ext.c b/drivers/net/dsa/ocelot/ocelot_ext.c
index 063150659816..228737a32080 100644
--- a/drivers/net/dsa/ocelot/ocelot_ext.c
+++ b/drivers/net/dsa/ocelot/ocelot_ext.c
@@ -149,7 +149,7 @@ MODULE_DEVICE_TABLE(of, ocelot_ext_switch_of_match);
static struct platform_driver ocelot_ext_switch_driver = {
.driver = {
.name = "ocelot-ext-switch",
- .of_match_table = of_match_ptr(ocelot_ext_switch_of_match),
+ .of_match_table = ocelot_ext_switch_of_match,
},
.probe = ocelot_ext_probe,
.remove = ocelot_ext_remove,
--
2.34.1


2023-03-11 17:33:50

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 06/12] net: phy: ks8995: drop of_match_ptr for ID table

The driver will match mostly by DT table (even thought there is regular
ID table) so there is little benefit in of_match_ptr (this also allows
ACPI matching via PRP0001, even though it might not be relevant here).

drivers/net/phy/spi_ks8995.c:156:34: error: ‘ks8895_spi_of_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/net/phy/spi_ks8995.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/spi_ks8995.c b/drivers/net/phy/spi_ks8995.c
index d4202d40d47a..7196e927c2cd 100644
--- a/drivers/net/phy/spi_ks8995.c
+++ b/drivers/net/phy/spi_ks8995.c
@@ -491,7 +491,7 @@ static void ks8995_remove(struct spi_device *spi)
static struct spi_driver ks8995_driver = {
.driver = {
.name = "spi-ks8995",
- .of_match_table = of_match_ptr(ks8895_spi_of_match),
+ .of_match_table = ks8895_spi_of_match,
},
.probe = ks8995_probe,
.remove = ks8995_remove,
--
2.34.1


2023-03-11 17:34:09

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 07/12] net: ieee802154: adf7242: drop of_match_ptr for ID table

The driver will match mostly by DT table (even thought there is regular
ID table) so there is little benefit in of_match_ptr (this also allows
ACPI matching via PRP0001, even though it might not be relevant here).

drivers/net/ieee802154/adf7242.c:1322:34: error: ‘adf7242_of_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/net/ieee802154/adf7242.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
index 5cf218c674a5..509acc86001c 100644
--- a/drivers/net/ieee802154/adf7242.c
+++ b/drivers/net/ieee802154/adf7242.c
@@ -1336,7 +1336,7 @@ MODULE_DEVICE_TABLE(spi, adf7242_device_id);
static struct spi_driver adf7242_driver = {
.id_table = adf7242_device_id,
.driver = {
- .of_match_table = of_match_ptr(adf7242_of_match),
+ .of_match_table = adf7242_of_match,
.name = "adf7242",
.owner = THIS_MODULE,
},
--
2.34.1


2023-03-11 17:34:11

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 08/12] net: ieee802154: mcr20a: drop of_match_ptr for ID table

The driver will match mostly by DT table (even thought there is regular
ID table) so there is little benefit in of_match_ptr (this also allows
ACPI matching via PRP0001, even though it might not be relevant here).

drivers/net/ieee802154/mcr20a.c:1340:34: error: ‘mcr20a_of_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/net/ieee802154/mcr20a.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c
index f53d185e0568..87abe3b46316 100644
--- a/drivers/net/ieee802154/mcr20a.c
+++ b/drivers/net/ieee802154/mcr20a.c
@@ -1352,7 +1352,7 @@ MODULE_DEVICE_TABLE(spi, mcr20a_device_id);
static struct spi_driver mcr20a_driver = {
.id_table = mcr20a_device_id,
.driver = {
- .of_match_table = of_match_ptr(mcr20a_of_match),
+ .of_match_table = mcr20a_of_match,
.name = "mcr20a",
},
.probe = mcr20a_probe,
--
2.34.1


2023-03-11 17:34:27

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 09/12] net: ieee802154: at86rf230: drop of_match_ptr for ID table

The driver will match mostly by DT table (even thought there is regular
ID table) so there is little benefit in of_match_ptr (this also allows
ACPI matching via PRP0001, even though it might not be relevant here).

drivers/net/ieee802154/at86rf230.c:1644:34: error: ‘at86rf230_of_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/net/ieee802154/at86rf230.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
index 62b984f84d9f..164c7f605af5 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -1662,7 +1662,7 @@ MODULE_DEVICE_TABLE(spi, at86rf230_device_id);
static struct spi_driver at86rf230_driver = {
.id_table = at86rf230_device_id,
.driver = {
- .of_match_table = of_match_ptr(at86rf230_of_match),
+ .of_match_table = at86rf230_of_match,
.name = "at86rf230",
},
.probe = at86rf230_probe,
--
2.34.1


2023-03-11 17:34:30

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 10/12] net: ieee802154: ca8210: drop of_match_ptr for ID table

The driver can match only via the DT table so the table should be always
used and the of_match_ptr does not have any sense (this also allows ACPI
matching via PRP0001, even though it might not be relevant here).

drivers/net/ieee802154/ca8210.c:3174:34: error: ‘ca8210_of_ids’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/net/ieee802154/ca8210.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
index ed6cb79072a8..65d28e8a87c9 100644
--- a/drivers/net/ieee802154/ca8210.c
+++ b/drivers/net/ieee802154/ca8210.c
@@ -3181,7 +3181,7 @@ static struct spi_driver ca8210_spi_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
- .of_match_table = of_match_ptr(ca8210_of_ids),
+ .of_match_table = ca8210_of_ids,
},
.probe = ca8210_probe,
.remove = ca8210_remove
--
2.34.1


2023-03-11 17:34:47

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 11/12] net: ieee802154: adf7242: drop owner from driver

Core already sets owner in spi_driver.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/net/ieee802154/adf7242.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
index 509acc86001c..f9972b8140f9 100644
--- a/drivers/net/ieee802154/adf7242.c
+++ b/drivers/net/ieee802154/adf7242.c
@@ -1338,7 +1338,6 @@ static struct spi_driver adf7242_driver = {
.driver = {
.of_match_table = adf7242_of_match,
.name = "adf7242",
- .owner = THIS_MODULE,
},
.probe = adf7242_probe,
.remove = adf7242_remove,
--
2.34.1


2023-03-11 17:34:54

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 12/12] net: ieee802154: ca8210: drop owner from driver

Core already sets owner in spi_driver.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/net/ieee802154/ca8210.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
index 65d28e8a87c9..ca1fa56cca68 100644
--- a/drivers/net/ieee802154/ca8210.c
+++ b/drivers/net/ieee802154/ca8210.c
@@ -3180,7 +3180,6 @@ MODULE_DEVICE_TABLE(of, ca8210_of_ids);
static struct spi_driver ca8210_spi_driver = {
.driver = {
.name = DRIVER_NAME,
- .owner = THIS_MODULE,
.of_match_table = ca8210_of_ids,
},
.probe = ca8210_probe,
--
2.34.1


2023-03-11 18:14:43

by Vladimir Oltean

[permalink] [raw]
Subject: Re: [PATCH 01/12] net: dsa: lantiq_gswip: mark OF related data as maybe unused

On Sat, Mar 11, 2023 at 06:32:52PM +0100, Krzysztof Kozlowski wrote:
> The driver can be compile tested with !CONFIG_OF making certain data
> unused:
>
> drivers/net/dsa/lantiq_gswip.c:1888:34: error: ‘xway_gphy_match’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---

Do you happen to have any context as to why of_match_node() without
CONFIG_OF is implemented as:

#define of_match_node(_matches, _node) NULL

and not as:

static inline const struct of_device_id *
of_match_node(const struct of_device_id *matches,
const struct device_node *node)
{
return NULL;
}

?

Generally, the static inline shim function model is nicer, because it
allows us to not scatter __maybe_unused all around.

2023-03-12 10:20:47

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 01/12] net: dsa: lantiq_gswip: mark OF related data as maybe unused

On 11/03/2023 19:14, Vladimir Oltean wrote:
> On Sat, Mar 11, 2023 at 06:32:52PM +0100, Krzysztof Kozlowski wrote:
>> The driver can be compile tested with !CONFIG_OF making certain data
>> unused:
>>
>> drivers/net/dsa/lantiq_gswip.c:1888:34: error: ‘xway_gphy_match’ defined but not used [-Werror=unused-const-variable=]
>>
>> Signed-off-by: Krzysztof Kozlowski <[email protected]>
>> ---
>
> Do you happen to have any context as to why of_match_node() without
> CONFIG_OF is implemented as:
>
> #define of_match_node(_matches, _node) NULL
>
> and not as:
>
> static inline const struct of_device_id *
> of_match_node(const struct of_device_id *matches,
> const struct device_node *node)
> {
> return NULL;
> }
>
> ?
>
> Generally, the static inline shim function model is nicer, because it
> allows us to not scatter __maybe_unused all around.

Sorry, I don't follow. I don't touch that wrappers, just fix errors
related to OF device ID tables, although in few cases it is indeed
related to of_match_node.

Best regards,
Krzysztof


2023-03-12 10:57:41

by Vladimir Oltean

[permalink] [raw]
Subject: Re: [PATCH 01/12] net: dsa: lantiq_gswip: mark OF related data as maybe unused

On Sun, Mar 12, 2023 at 11:20:38AM +0100, Krzysztof Kozlowski wrote:
> On 11/03/2023 19:14, Vladimir Oltean wrote:
> > On Sat, Mar 11, 2023 at 06:32:52PM +0100, Krzysztof Kozlowski wrote:
> >> The driver can be compile tested with !CONFIG_OF making certain data
> >> unused:
> >>
> >> drivers/net/dsa/lantiq_gswip.c:1888:34: error: ‘xway_gphy_match’ defined but not used [-Werror=unused-const-variable=]
> >>
> >> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> >> ---
> >
> > Do you happen to have any context as to why of_match_node() without
> > CONFIG_OF is implemented as:
> >
> > #define of_match_node(_matches, _node) NULL
> >
> > and not as:
> >
> > static inline const struct of_device_id *
> > of_match_node(const struct of_device_id *matches,
> > const struct device_node *node)
> > {
> > return NULL;
> > }
> >
> > ?
> >
> > Generally, the static inline shim function model is nicer, because it
> > allows us to not scatter __maybe_unused all around.
>
> Sorry, I don't follow. I don't touch that wrappers, just fix errors
> related to OF device ID tables, although in few cases it is indeed
> related to of_match_node.

I'm saying this because in lantiq_gswip.c, xway_gphy_match is accessed
through of_match_node(). If the shim definition for of_match_node() was
different, the variable wouldn't have been unused with CONFIG_OF=n.
I guess it's worth considering changing that wrapper instead of adding
the __maybe_unused.

2023-03-12 11:33:07

by Hennerich, Michael

[permalink] [raw]
Subject: RE: [PATCH 11/12] net: ieee802154: adf7242: drop owner from driver



> -----Original Message-----
> From: Krzysztof Kozlowski <[email protected]>
> Sent: Samstag, 11. M?rz 2023 18:33
> To: Andrew Lunn <[email protected]>; Florian Fainelli <[email protected]>;
> Vladimir Oltean <[email protected]>; David S. Miller
> <[email protected]>; Eric Dumazet <[email protected]>; Jakub
> Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Hauke
> Mehrtens <[email protected]>; Woojung Huh
> <[email protected]>; [email protected]; Claudiu
> Manoil <[email protected]>; Alexandre Belloni
> <[email protected]>; Colin Foster <colin.foster@in-
> advantage.com>; Hennerich, Michael <[email protected]>;
> Alexander Aring <[email protected]>; Stefan Schmidt
> <[email protected]>; Miquel Raynal <[email protected]>;
> Heiner Kallweit <[email protected]>; Russell King
> <[email protected]>; [email protected]; linux-
> [email protected]; [email protected]
> Cc: Krzysztof Kozlowski <[email protected]>
> Subject: [PATCH 11/12] net: ieee802154: adf7242: drop owner from driver
>
> Core already sets owner in spi_driver.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>

Acked-by: Michael Hennerich <[email protected]>

> ---
> drivers/net/ieee802154/adf7242.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/net/ieee802154/adf7242.c
> b/drivers/net/ieee802154/adf7242.c
> index 509acc86001c..f9972b8140f9 100644
> --- a/drivers/net/ieee802154/adf7242.c
> +++ b/drivers/net/ieee802154/adf7242.c
> @@ -1338,7 +1338,6 @@ static struct spi_driver adf7242_driver = {
> .driver = {
> .of_match_table = adf7242_of_match,
> .name = "adf7242",
> - .owner = THIS_MODULE,
> },
> .probe = adf7242_probe,
> .remove = adf7242_remove,
> --
> 2.34.1


2023-03-12 11:33:25

by Hennerich, Michael

[permalink] [raw]
Subject: RE: [PATCH 07/12] net: ieee802154: adf7242: drop of_match_ptr for ID table



> -----Original Message-----
> From: Krzysztof Kozlowski <[email protected]>
> Sent: Samstag, 11. März 2023 18:33
> To: Andrew Lunn <[email protected]>; Florian Fainelli <[email protected]>;
> Vladimir Oltean <[email protected]>; David S. Miller
> <[email protected]>; Eric Dumazet <[email protected]>; Jakub
> Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Hauke
> Mehrtens <[email protected]>; Woojung Huh
> <[email protected]>; [email protected]; Claudiu
> Manoil <[email protected]>; Alexandre Belloni
> <[email protected]>; Colin Foster <colin.foster@in-
> advantage.com>; Hennerich, Michael <[email protected]>;
> Alexander Aring <[email protected]>; Stefan Schmidt
> <[email protected]>; Miquel Raynal <[email protected]>;
> Heiner Kallweit <[email protected]>; Russell King
> <[email protected]>; [email protected]; linux-
> [email protected]; [email protected]
> Cc: Krzysztof Kozlowski <[email protected]>
> Subject: [PATCH 07/12] net: ieee802154: adf7242: drop of_match_ptr for ID
> table
>
> The driver will match mostly by DT table (even thought there is regular ID
> table) so there is little benefit in of_match_ptr (this also allows ACPI
> matching via PRP0001, even though it might not be relevant here).
>
> drivers/net/ieee802154/adf7242.c:1322:34: error: ‘adf7242_of_match’
> defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>

Acked-by: Michael Hennerich <[email protected]>

> ---
> drivers/net/ieee802154/adf7242.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ieee802154/adf7242.c
> b/drivers/net/ieee802154/adf7242.c
> index 5cf218c674a5..509acc86001c 100644
> --- a/drivers/net/ieee802154/adf7242.c
> +++ b/drivers/net/ieee802154/adf7242.c
> @@ -1336,7 +1336,7 @@ MODULE_DEVICE_TABLE(spi, adf7242_device_id);
> static struct spi_driver adf7242_driver = {
> .id_table = adf7242_device_id,
> .driver = {
> - .of_match_table = of_match_ptr(adf7242_of_match),
> + .of_match_table = adf7242_of_match,
> .name = "adf7242",
> .owner = THIS_MODULE,
> },
> --
> 2.34.1

2023-03-14 07:52:19

by Stefan Schmidt

[permalink] [raw]
Subject: Re: [PATCH 08/12] net: ieee802154: mcr20a: drop of_match_ptr for ID table

Hello

On 11.03.23 18:32, Krzysztof Kozlowski wrote:
> The driver will match mostly by DT table (even thought there is regular
> ID table) so there is little benefit in of_match_ptr (this also allows
> ACPI matching via PRP0001, even though it might not be relevant here).
>
> drivers/net/ieee802154/mcr20a.c:1340:34: error: ‘mcr20a_of_match’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---
> drivers/net/ieee802154/mcr20a.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ieee802154/mcr20a.c b/drivers/net/ieee802154/mcr20a.c
> index f53d185e0568..87abe3b46316 100644
> --- a/drivers/net/ieee802154/mcr20a.c
> +++ b/drivers/net/ieee802154/mcr20a.c
> @@ -1352,7 +1352,7 @@ MODULE_DEVICE_TABLE(spi, mcr20a_device_id);
> static struct spi_driver mcr20a_driver = {
> .id_table = mcr20a_device_id,
> .driver = {
> - .of_match_table = of_match_ptr(mcr20a_of_match),
> + .of_match_table = mcr20a_of_match,
> .name = "mcr20a",
> },
> .probe = mcr20a_probe,

Acked-by: Stefan Schmidt <[email protected]>

regards
Stefan Schmidt

2023-03-14 07:52:51

by Stefan Schmidt

[permalink] [raw]
Subject: Re: [PATCH 09/12] net: ieee802154: at86rf230: drop of_match_ptr for ID table

Hello.

On 11.03.23 18:33, Krzysztof Kozlowski wrote:
> The driver will match mostly by DT table (even thought there is regular
> ID table) so there is little benefit in of_match_ptr (this also allows
> ACPI matching via PRP0001, even though it might not be relevant here).
>
> drivers/net/ieee802154/at86rf230.c:1644:34: error: ‘at86rf230_of_match’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---
> drivers/net/ieee802154/at86rf230.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
> index 62b984f84d9f..164c7f605af5 100644
> --- a/drivers/net/ieee802154/at86rf230.c
> +++ b/drivers/net/ieee802154/at86rf230.c
> @@ -1662,7 +1662,7 @@ MODULE_DEVICE_TABLE(spi, at86rf230_device_id);
> static struct spi_driver at86rf230_driver = {
> .id_table = at86rf230_device_id,
> .driver = {
> - .of_match_table = of_match_ptr(at86rf230_of_match),
> + .of_match_table = at86rf230_of_match,
> .name = "at86rf230",
> },
> .probe = at86rf230_probe,

Acked-by: Stefan Schmidt <[email protected]>

regards
Stefan Schmidt

2023-03-14 07:53:31

by Stefan Schmidt

[permalink] [raw]
Subject: Re: [PATCH 10/12] net: ieee802154: ca8210: drop of_match_ptr for ID table

Hello.

On 11.03.23 18:33, Krzysztof Kozlowski wrote:
> The driver can match only via the DT table so the table should be always
> used and the of_match_ptr does not have any sense (this also allows ACPI
> matching via PRP0001, even though it might not be relevant here).
>
> drivers/net/ieee802154/ca8210.c:3174:34: error: ‘ca8210_of_ids’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---
> drivers/net/ieee802154/ca8210.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
> index ed6cb79072a8..65d28e8a87c9 100644
> --- a/drivers/net/ieee802154/ca8210.c
> +++ b/drivers/net/ieee802154/ca8210.c
> @@ -3181,7 +3181,7 @@ static struct spi_driver ca8210_spi_driver = {
> .driver = {
> .name = DRIVER_NAME,
> .owner = THIS_MODULE,
> - .of_match_table = of_match_ptr(ca8210_of_ids),
> + .of_match_table = ca8210_of_ids,
> },
> .probe = ca8210_probe,
> .remove = ca8210_remove

Acked-by: Stefan Schmidt <[email protected]>

regards
Stefan Schmidt

2023-03-14 07:54:24

by Stefan Schmidt

[permalink] [raw]
Subject: Re: [PATCH 12/12] net: ieee802154: ca8210: drop owner from driver

Hello.

On 11.03.23 18:33, Krzysztof Kozlowski wrote:
> Core already sets owner in spi_driver.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---
> drivers/net/ieee802154/ca8210.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c
> index 65d28e8a87c9..ca1fa56cca68 100644
> --- a/drivers/net/ieee802154/ca8210.c
> +++ b/drivers/net/ieee802154/ca8210.c
> @@ -3180,7 +3180,6 @@ MODULE_DEVICE_TABLE(of, ca8210_of_ids);
> static struct spi_driver ca8210_spi_driver = {
> .driver = {
> .name = DRIVER_NAME,
> - .owner = THIS_MODULE,
> .of_match_table = ca8210_of_ids,
> },
> .probe = ca8210_probe,

Acked-by: Stefan Schmidt <[email protected]>

regards
Stefan Schmidt

2023-03-14 15:36:07

by Colin Foster

[permalink] [raw]
Subject: Re: [PATCH 05/12] net: dsa: ocelot: drop of_match_ptr for ID table

On Sat, Mar 11, 2023 at 06:32:56PM +0100, Krzysztof Kozlowski wrote:
> The driver can match only via the DT table so the table should be always
> used and the of_match_ptr does not have any sense (this also allows ACPI
> matching via PRP0001, even though it might not be relevant here).
>
> drivers/net/dsa/ocelot/ocelot_ext.c:143:34: error: ‘ocelot_ext_switch_of_match’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---
> drivers/net/dsa/ocelot/ocelot_ext.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/ocelot/ocelot_ext.c b/drivers/net/dsa/ocelot/ocelot_ext.c
> index 063150659816..228737a32080 100644
> --- a/drivers/net/dsa/ocelot/ocelot_ext.c
> +++ b/drivers/net/dsa/ocelot/ocelot_ext.c
> @@ -149,7 +149,7 @@ MODULE_DEVICE_TABLE(of, ocelot_ext_switch_of_match);
> static struct platform_driver ocelot_ext_switch_driver = {
> .driver = {
> .name = "ocelot-ext-switch",
> - .of_match_table = of_match_ptr(ocelot_ext_switch_of_match),
> + .of_match_table = ocelot_ext_switch_of_match,
> },
> .probe = ocelot_ext_probe,
> .remove = ocelot_ext_remove,
> --
> 2.34.1
>

Acked-by: Colin Foster <[email protected]>

2023-03-15 05:33:00

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH 01/12] net: dsa: lantiq_gswip: mark OF related data as maybe unused

On Sun, 12 Mar 2023 12:57:29 +0200 Vladimir Oltean wrote:
> > Sorry, I don't follow. I don't touch that wrappers, just fix errors
> > related to OF device ID tables, although in few cases it is indeed
> > related to of_match_node.
>
> I'm saying this because in lantiq_gswip.c, xway_gphy_match is accessed
> through of_match_node(). If the shim definition for of_match_node() was
> different, the variable wouldn't have been unused with CONFIG_OF=n.
> I guess it's worth considering changing that wrapper instead of adding
> the __maybe_unused.

Hi Krzysztof, have you had a chance to check if using an empty static
inline is enough to silence the compiler? Seems like it could save
us quite some churn? Or do we want the of_match_node() decorations
to go away in general?

2023-03-15 08:20:33

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH 01/12] net: dsa: lantiq_gswip: mark OF related data as maybe unused

Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <[email protected]>:

On Sat, 11 Mar 2023 18:32:52 +0100 you wrote:
> The driver can be compile tested with !CONFIG_OF making certain data
> unused:
>
> drivers/net/dsa/lantiq_gswip.c:1888:34: error: ‘xway_gphy_match’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
>
> [...]

Here is the summary with links:
- [01/12] net: dsa: lantiq_gswip: mark OF related data as maybe unused
https://git.kernel.org/netdev/net-next/c/6ea1e67788f3
- [02/12] net: dsa: lan9303: drop of_match_ptr for ID table
https://git.kernel.org/netdev/net-next/c/ced5c5a0a2ea
- [03/12] net: dsa: seville_vsc9953: drop of_match_ptr for ID table
https://git.kernel.org/netdev/net-next/c/1eb8566dd08d
- [04/12] net: dsa: ksz9477: drop of_match_ptr for ID table
https://git.kernel.org/netdev/net-next/c/00923ff2e1ba
- [05/12] net: dsa: ocelot: drop of_match_ptr for ID table
https://git.kernel.org/netdev/net-next/c/0f17b42827ae
- [06/12] net: phy: ks8995: drop of_match_ptr for ID table
https://git.kernel.org/netdev/net-next/c/b0b7d1b6260b
- [07/12] net: ieee802154: adf7242: drop of_match_ptr for ID table
https://git.kernel.org/netdev/net-next/c/3df09beef650
- [08/12] net: ieee802154: mcr20a: drop of_match_ptr for ID table
https://git.kernel.org/netdev/net-next/c/3896c40b7824
- [09/12] net: ieee802154: at86rf230: drop of_match_ptr for ID table
https://git.kernel.org/netdev/net-next/c/32b7030681a4
- [10/12] net: ieee802154: ca8210: drop of_match_ptr for ID table
https://git.kernel.org/netdev/net-next/c/cdfe4fc4d946
- [11/12] net: ieee802154: adf7242: drop owner from driver
https://git.kernel.org/netdev/net-next/c/059fa9972340
- [12/12] net: ieee802154: ca8210: drop owner from driver
https://git.kernel.org/netdev/net-next/c/613a3c44a373

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



2023-03-15 19:51:37

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH 01/12] net: dsa: lantiq_gswip: mark OF related data as maybe unused

On Wed, 15 Mar 2023 08:20:20 +0000 [email protected]
wrote:
> This series was applied to netdev/net-next.git (main)
> by David S. Miller <[email protected]>:

:) :) :)

2023-03-16 08:22:04

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 01/12] net: dsa: lantiq_gswip: mark OF related data as maybe unused

On 15/03/2023 06:22, Jakub Kicinski wrote:
> On Sun, 12 Mar 2023 12:57:29 +0200 Vladimir Oltean wrote:
>>> Sorry, I don't follow. I don't touch that wrappers, just fix errors
>>> related to OF device ID tables, although in few cases it is indeed
>>> related to of_match_node.
>>
>> I'm saying this because in lantiq_gswip.c, xway_gphy_match is accessed
>> through of_match_node(). If the shim definition for of_match_node() was
>> different, the variable wouldn't have been unused with CONFIG_OF=n.
>> I guess it's worth considering changing that wrapper instead of adding
>> the __maybe_unused.
>
> Hi Krzysztof, have you had a chance to check if using an empty static
> inline is enough to silence the compiler? Seems like it could save
> us quite some churn? Or do we want the of_match_node() decorations
> to go away in general?

I am pretty sure fixing of_match_node() and of_match_ptr() (independent
case) would supersed this patchset, but it is a bit bigger change than I
have available time now. I didn't try it yet.


Best regards,
Krzysztof


2023-03-28 10:58:30

by Miquel Raynal

[permalink] [raw]
Subject: Re: [PATCH 07/12] net: ieee802154: adf7242: drop of_match_ptr for ID table

Hi Krzysztof,

[email protected] wrote on Sat, 11 Mar 2023 18:32:58 +0100:

> The driver will match mostly by DT table (even thought there is regular
> ID table) so there is little benefit in of_match_ptr (this also allows
> ACPI matching via PRP0001, even though it might not be relevant here).
>
> drivers/net/ieee802154/adf7242.c:1322:34: error: ‘adf7242_of_match’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>

I see Stefan already acked most of the ieee802154 patches, but I didn't
got notified for this one, so in case:

Acked-by: Miquel Raynal <[email protected]>

> ---
> drivers/net/ieee802154/adf7242.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
> index 5cf218c674a5..509acc86001c 100644
> --- a/drivers/net/ieee802154/adf7242.c
> +++ b/drivers/net/ieee802154/adf7242.c
> @@ -1336,7 +1336,7 @@ MODULE_DEVICE_TABLE(spi, adf7242_device_id);
> static struct spi_driver adf7242_driver = {
> .id_table = adf7242_device_id,
> .driver = {
> - .of_match_table = of_match_ptr(adf7242_of_match),
> + .of_match_table = adf7242_of_match,
> .name = "adf7242",
> .owner = THIS_MODULE,
> },


Thanks,
Miquèl

2023-03-28 10:59:42

by Miquel Raynal

[permalink] [raw]
Subject: Re: [PATCH 11/12] net: ieee802154: adf7242: drop owner from driver

Hi Krzysztof,

[email protected] wrote on Sat, 11 Mar 2023 18:33:02 +0100:

> Core already sets owner in spi_driver.
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>

Same here:

Acked-by: Miquel Raynal <[email protected]>

> ---
> drivers/net/ieee802154/adf7242.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
> index 509acc86001c..f9972b8140f9 100644
> --- a/drivers/net/ieee802154/adf7242.c
> +++ b/drivers/net/ieee802154/adf7242.c
> @@ -1338,7 +1338,6 @@ static struct spi_driver adf7242_driver = {
> .driver = {
> .of_match_table = adf7242_of_match,
> .name = "adf7242",
> - .owner = THIS_MODULE,
> },
> .probe = adf7242_probe,
> .remove = adf7242_remove,


Thanks,
Miquèl

2023-03-28 16:16:11

by Stefan Schmidt

[permalink] [raw]
Subject: Re: [PATCH 07/12] net: ieee802154: adf7242: drop of_match_ptr for ID table

Hello.

On 28.03.23 12:48, Miquel Raynal wrote:
> Hi Krzysztof,
>
> [email protected] wrote on Sat, 11 Mar 2023 18:32:58 +0100:
>
>> The driver will match mostly by DT table (even thought there is regular
>> ID table) so there is little benefit in of_match_ptr (this also allows
>> ACPI matching via PRP0001, even though it might not be relevant here).
>>
>> drivers/net/ieee802154/adf7242.c:1322:34: error: ‘adf7242_of_match’ defined but not used [-Werror=unused-const-variable=]
>>
>> Signed-off-by: Krzysztof Kozlowski <[email protected]>
>
> I see Stefan already acked most of the ieee802154 patches, but I didn't
> got notified for this one, so in case:

The reason I did not ack the two patches for adf7242 is that Michael as
driver maintainer ack'ed them already.

I only handled the ones where we have no active maintainer, as a fallback.

regards
Stefan Schmidt