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 is not relevant here).
drivers/spi/spi-armada-3700.c:807:34: error: ‘a3700_spi_dt_ids’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-armada-3700.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-armada-3700.c b/drivers/spi/spi-armada-3700.c
index 6a7e605f73bf..feb7371940bc 100644
--- a/drivers/spi/spi-armada-3700.c
+++ b/drivers/spi/spi-armada-3700.c
@@ -919,7 +919,7 @@ static void a3700_spi_remove(struct platform_device *pdev)
static struct platform_driver a3700_spi_driver = {
.driver = {
.name = DRIVER_NAME,
- .of_match_table = of_match_ptr(a3700_spi_dt_ids),
+ .of_match_table = a3700_spi_dt_ids,
},
.probe = a3700_spi_probe,
.remove_new = a3700_spi_remove,
--
2.34.1
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 is not relevant here).
drivers/spmi/spmi-mtk-pmif.c:517:34: error: ‘mtk_spmi_match_table’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spmi/spmi-mtk-pmif.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spmi/spmi-mtk-pmif.c b/drivers/spmi/spmi-mtk-pmif.c
index ad511f2c3324..b8583917fa11 100644
--- a/drivers/spmi/spmi-mtk-pmif.c
+++ b/drivers/spmi/spmi-mtk-pmif.c
@@ -530,7 +530,7 @@ MODULE_DEVICE_TABLE(of, mtk_spmi_match_table);
static struct platform_driver mtk_spmi_driver = {
.driver = {
.name = "spmi-mtk",
- .of_match_table = of_match_ptr(mtk_spmi_match_table),
+ .of_match_table = mtk_spmi_match_table,
},
.probe = mtk_spmi_probe,
.remove = mtk_spmi_remove,
--
2.34.1
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 is not relevant here).
drivers/spi/spi-meson-spicc.c:949:34: error: ‘meson_spicc_of_match’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-meson-spicc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
index b9f812837cd6..2e9cbc507e26 100644
--- a/drivers/spi/spi-meson-spicc.c
+++ b/drivers/spi/spi-meson-spicc.c
@@ -968,7 +968,7 @@ static struct platform_driver meson_spicc_driver = {
.remove_new = meson_spicc_remove,
.driver = {
.name = "meson-spicc",
- .of_match_table = of_match_ptr(meson_spicc_of_match),
+ .of_match_table = meson_spicc_of_match,
},
};
--
2.34.1
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 is not relevant here).
drivers/spi/spi-meson-spifc.c:434:34: error: ‘meson_spifc_dt_match’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-meson-spifc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-meson-spifc.c b/drivers/spi/spi-meson-spifc.c
index 06626f406f68..af832fbbf258 100644
--- a/drivers/spi/spi-meson-spifc.c
+++ b/drivers/spi/spi-meson-spifc.c
@@ -443,7 +443,7 @@ static struct platform_driver meson_spifc_driver = {
.remove_new = meson_spifc_remove,
.driver = {
.name = "meson-spifc",
- .of_match_table = of_match_ptr(meson_spifc_dt_match),
+ .of_match_table = meson_spifc_dt_match,
.pm = &meson_spifc_pm_ops,
},
};
--
2.34.1
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 is not relevant here).
drivers/spi/spi-orion.c:615:34: error: ‘orion_spi_of_match_table’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-orion.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
index e79d1fe0bca4..c63b75c1829a 100644
--- a/drivers/spi/spi-orion.c
+++ b/drivers/spi/spi-orion.c
@@ -852,7 +852,7 @@ static struct platform_driver orion_spi_driver = {
.driver = {
.name = DRIVER_NAME,
.pm = &orion_spi_pm_ops,
- .of_match_table = of_match_ptr(orion_spi_of_match_table),
+ .of_match_table = orion_spi_of_match_table,
},
.probe = orion_spi_probe,
.remove_new = orion_spi_remove,
--
2.34.1
The driver can match only via the DT table (all platforms are OF-only)
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 is
not relevant here).
drivers/spi/spi-s3c64xx.c:1496:34: error: ‘s3c64xx_spi_dt_match’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-s3c64xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index cc69f8ffdbdc..7aec496070e2 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1526,7 +1526,7 @@ static struct platform_driver s3c64xx_spi_driver = {
.driver = {
.name = "s3c64xx-spi",
.pm = &s3c64xx_spi_pm,
- .of_match_table = of_match_ptr(s3c64xx_spi_dt_match),
+ .of_match_table = s3c64xx_spi_dt_match,
},
.probe = s3c64xx_spi_probe,
.remove_new = s3c64xx_spi_remove,
--
2.34.1
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 is not relevant here).
drivers/spi/spi-rockchip.c:1051:34: error: ‘rockchip_spi_dt_match’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-rockchip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index a66fff0ee20e..57ae58bf7a62 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -1069,7 +1069,7 @@ static struct platform_driver rockchip_spi_driver = {
.driver = {
.name = DRIVER_NAME,
.pm = &rockchip_spi_pm,
- .of_match_table = of_match_ptr(rockchip_spi_dt_match),
+ .of_match_table = rockchip_spi_dt_match,
},
.probe = rockchip_spi_probe,
.remove_new = rockchip_spi_remove,
--
2.34.1
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 is not relevant here).
drivers/spi/spi-img-spfi.c:746:34: error: ‘img_spfi_of_match’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-img-spfi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c
index c64e4fd3fdf0..bc360e779933 100644
--- a/drivers/spi/spi-img-spfi.c
+++ b/drivers/spi/spi-img-spfi.c
@@ -753,7 +753,7 @@ static struct platform_driver img_spfi_driver = {
.driver = {
.name = "img-spfi",
.pm = &img_spfi_pm_ops,
- .of_match_table = of_match_ptr(img_spfi_of_match),
+ .of_match_table = img_spfi_of_match,
},
.probe = img_spfi_probe,
.remove_new = img_spfi_remove,
--
2.34.1
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 is not relevant here).
drivers/spi/spi-pic32.c:857:34: error: ‘pic32_spi_of_match’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-pic32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c
index 5a64ad0c94fe..04896e7ff2c1 100644
--- a/drivers/spi/spi-pic32.c
+++ b/drivers/spi/spi-pic32.c
@@ -863,7 +863,7 @@ MODULE_DEVICE_TABLE(of, pic32_spi_of_match);
static struct platform_driver pic32_spi_driver = {
.driver = {
.name = "spi-pic32",
- .of_match_table = of_match_ptr(pic32_spi_of_match),
+ .of_match_table = pic32_spi_of_match,
},
.probe = pic32_spi_probe,
.remove_new = pic32_spi_remove,
--
2.34.1
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 is not relevant here).
drivers/spi/spi-pic32-sqi.c:694:34: error: ‘pic32_sqi_of_ids’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-pic32-sqi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-pic32-sqi.c b/drivers/spi/spi-pic32-sqi.c
index 4c8493f34fca..ca89e6d22fc7 100644
--- a/drivers/spi/spi-pic32-sqi.c
+++ b/drivers/spi/spi-pic32-sqi.c
@@ -700,7 +700,7 @@ MODULE_DEVICE_TABLE(of, pic32_sqi_of_ids);
static struct platform_driver pic32_sqi_driver = {
.driver = {
.name = "sqi-pic32",
- .of_match_table = of_match_ptr(pic32_sqi_of_ids),
+ .of_match_table = pic32_sqi_of_ids,
},
.probe = pic32_sqi_probe,
.remove_new = pic32_sqi_remove,
--
2.34.1
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 is not relevant here).
drivers/spi/spi-st-ssc4.c:439:34: error: ‘stm_spi_match’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-st-ssc4.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-st-ssc4.c b/drivers/spi/spi-st-ssc4.c
index 9141f19c7f8e..3fe266c336ab 100644
--- a/drivers/spi/spi-st-ssc4.c
+++ b/drivers/spi/spi-st-ssc4.c
@@ -446,7 +446,7 @@ static struct platform_driver spi_st_driver = {
.driver = {
.name = "spi-st",
.pm = &spi_st_pm,
- .of_match_table = of_match_ptr(stm_spi_match),
+ .of_match_table = stm_spi_match,
},
.probe = spi_st_probe,
.remove_new = spi_st_remove,
--
2.34.1
The driver can be compile tested with !CONFIG_OF making certain data
unused:
drivers/spi/spi-bcm-qspi.c:1460:34: error: ‘bcm_qspi_of_match’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-bcm-qspi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c
index 0eee574d3e1f..1de1b669fc96 100644
--- a/drivers/spi/spi-bcm-qspi.c
+++ b/drivers/spi/spi-bcm-qspi.c
@@ -1457,7 +1457,7 @@ static const struct bcm_qspi_data bcm_qspi_spcr3_data = {
.has_spcr3_sysclk = true,
};
-static const struct of_device_id bcm_qspi_of_match[] = {
+static const struct of_device_id bcm_qspi_of_match[] __maybe_unused = {
{
.compatible = "brcm,spi-bcm7445-qspi",
.data = &bcm_qspi_rev_data,
--
2.34.1
The driver can be compile tested with !CONFIG_OF making certain data
unused:
drivers/spi/spi-pxa2xx.c:1757:34: error: ‘pxa2xx_spi_of_match’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-pxa2xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index a75ba2993f3c..19e996a5a02e 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1754,7 +1754,7 @@ static const struct acpi_device_id pxa2xx_spi_acpi_match[] = {
MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match);
#endif
-static const struct of_device_id pxa2xx_spi_of_match[] = {
+static const struct of_device_id pxa2xx_spi_of_match[] __maybe_unused = {
{ .compatible = "marvell,mmp2-ssp", .data = (void *)MMP2_SSP },
{}
};
--
2.34.1
The driver can be compile tested with !CONFIG_OF making certain data
unused:
drivers/spi/spi-sh-msiof.c:1076:34: error: ‘sh_msiof_match’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-sh-msiof.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index d828a3b370b8..412aa1882e5d 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -1073,7 +1073,7 @@ static const struct sh_msiof_chipdata rcar_gen3_data = {
.min_div_pow = 1,
};
-static const struct of_device_id sh_msiof_match[] = {
+static const struct of_device_id sh_msiof_match[] __maybe_unused = {
{ .compatible = "renesas,sh-mobile-msiof", .data = &sh_data },
{ .compatible = "renesas,msiof-r8a7743", .data = &rcar_gen2_data },
{ .compatible = "renesas,msiof-r8a7745", .data = &rcar_gen2_data },
--
2.34.1
The driver can be compile tested with !CONFIG_OF making certain data
unused:
drivers/spi/spi-sc18is602.c:318:34: error: ‘sc18is602_of_match’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-sc18is602.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c
index 983b3621bc2a..5c2c255f70e8 100644
--- a/drivers/spi/spi-sc18is602.c
+++ b/drivers/spi/spi-sc18is602.c
@@ -315,7 +315,7 @@ static const struct i2c_device_id sc18is602_id[] = {
};
MODULE_DEVICE_TABLE(i2c, sc18is602_id);
-static const struct of_device_id sc18is602_of_match[] = {
+static const struct of_device_id sc18is602_of_match[] __maybe_unused = {
{
.compatible = "nxp,sc18is602",
.data = (void *)sc18is602
--
2.34.1
Driver can match via ID or OF ID table, thus several OF-related methods
will be unused. Mark the OF structures as __maybe_unused so compiler
can drop them:
drivers/spi/spi-rspi.c:1203:29: error: ‘qspi_ops’ defined but not used [-Werror=unused-const-variable=]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/spi/spi-rspi.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index f494c86bafea..4724854e6726 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -1190,7 +1190,7 @@ static const struct spi_ops rspi_ops = {
.num_hw_ss = 2,
};
-static const struct spi_ops rspi_rz_ops = {
+static const struct spi_ops rspi_rz_ops __maybe_unused = {
.set_config_register = rspi_rz_set_config_register,
.transfer_one = rspi_rz_transfer_one,
.min_div = 2,
@@ -1200,7 +1200,7 @@ static const struct spi_ops rspi_rz_ops = {
.num_hw_ss = 1,
};
-static const struct spi_ops qspi_ops = {
+static const struct spi_ops qspi_ops __maybe_unused = {
.set_config_register = qspi_set_config_register,
.transfer_one = qspi_transfer_one,
.extra_mode_bits = SPI_TX_DUAL | SPI_TX_QUAD |
@@ -1212,8 +1212,7 @@ static const struct spi_ops qspi_ops = {
.num_hw_ss = 1,
};
-#ifdef CONFIG_OF
-static const struct of_device_id rspi_of_match[] = {
+static const struct of_device_id rspi_of_match[] __maybe_unused = {
/* RSPI on legacy SH */
{ .compatible = "renesas,rspi", .data = &rspi_ops },
/* RSPI on RZ/A1H */
@@ -1225,6 +1224,7 @@ static const struct of_device_id rspi_of_match[] = {
MODULE_DEVICE_TABLE(of, rspi_of_match);
+#ifdef CONFIG_OF
static void rspi_reset_control_assert(void *data)
{
reset_control_assert(data);
--
2.34.1
On 3/10/23 14:28, Krzysztof Kozlowski wrote:
> The driver can be compile tested with !CONFIG_OF making certain data
> unused:
>
> drivers/spi/spi-bcm-qspi.c:1460:34: error: ‘bcm_qspi_of_match’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
Acked-by: Florian Fainelli <[email protected]>
--
Florian
Hi Krzysztof,
On Fri, Mar 10, 2023 at 11:28:48PM +0100, Krzysztof Kozlowski wrote:
> The driver can match only via the DT table (all platforms are OF-only)
> 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 is
> not relevant here).
>
> drivers/spi/spi-s3c64xx.c:1496:34: error: ‘s3c64xx_spi_dt_match’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Thanks,
Andi
Am Freitag, 10. März 2023, 23:28:47 CET schrieb Krzysztof Kozlowski:
> 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 is not relevant here).
>
> drivers/spi/spi-rockchip.c:1051:34: error: ‘rockchip_spi_dt_match’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Heiko Stuebner <[email protected]>
On Fri, Mar 10, 2023 at 11:29 PM Krzysztof Kozlowski
<[email protected]> 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 is not relevant here).
>
> drivers/spi/spi-meson-spicc.c:949:34: error: ‘meson_spicc_of_match’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
Acked-by: Martin Blumenstingl <[email protected]>
On Fri, Mar 10, 2023 at 11:29 PM Krzysztof Kozlowski
<[email protected]> 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 is not relevant here).
>
> drivers/spi/spi-meson-spifc.c:434:34: error: ‘meson_spifc_dt_match’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
Acked-by: Martin Blumenstingl <[email protected]>
Il 10/03/23 23:28, Krzysztof Kozlowski ha scritto:
> 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 is not relevant here).
>
> drivers/spmi/spmi-mtk-pmif.c:517:34: error: ‘mtk_spmi_match_table’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
On Fri, Mar 10, 2023 at 11:28:42PM +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 is not relevant here).
>
> drivers/spi/spi-armada-3700.c:807:34: error: ‘a3700_spi_dt_ids’ defined but not used [-Werror=unused-const-variable=]
It would be much better to fix of_match_ptr() and/or the module stuff
that also references the match table here.
On Fri, 10 Mar 2023 23:28:42 +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 is not relevant here).
>
> drivers/spi/spi-armada-3700.c:807:34: error: ‘a3700_spi_dt_ids’ defined but not used [-Werror=unused-const-variable=]
>
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[12/16] spi: pxa2xx: Mark OF related data as maybe unused
commit: d94df25e8b9c8deefc5d7fcd344eb5d4bd41cf7b
[13/16] spi: bcm-qspi: Mark OF related data as maybe unused
commit: 6340fdf2e13c5f1ff3a9622f0cb3b8e9c3955a31
[14/16] spi: sh-msiof: Mark OF related data as maybe unused
commit: d946b6b0ed01949b1a3856e03469361fc9168318
[15/16] spi: sc18is602: Mark OF related data as maybe unused
commit: 833f43308234600e934e9c6fa70fd8b7eebc632b
[16/16] spi: rspi: Mark OF related data as maybe unused
commit: edfa970370a759c2c6a38b2884887937b1aea552
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
On 13/03/2023 14:55, Mark Brown wrote:
> On Fri, Mar 10, 2023 at 11:28:42PM +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 is not relevant here).
>>
>> drivers/spi/spi-armada-3700.c:807:34: error: ‘a3700_spi_dt_ids’ defined but not used [-Werror=unused-const-variable=]
>
> It would be much better to fix of_match_ptr() and/or the module stuff
> that also references the match table here.
Why? The recommendation is in general not to use of_match_ptr, because
there are little benefits but it disables matching via PRP0001. Jonathan
in parallel thread explicitly said of_match_ptr should disappear and he
is not accepting any new code with it. And in general he is right.
https://lore.kernel.org/all/20230311183534.1d0dfd64@jic23-huawei/
and earlier:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=444f5f854b35
Best regards,
Krzysztof
On Mon, Mar 13, 2023 at 07:39:45PM +0100, Krzysztof Kozlowski wrote:
> On 13/03/2023 14:55, Mark Brown wrote:
> > On Fri, Mar 10, 2023 at 11:28:42PM +0100, Krzysztof Kozlowski wrote:
> >> drivers/spi/spi-armada-3700.c:807:34: error: ‘a3700_spi_dt_ids’ defined but not used [-Werror=unused-const-variable=]
> > It would be much better to fix of_match_ptr() and/or the module stuff
> > that also references the match table here.
> Why? The recommendation is in general not to use of_match_ptr, because
> there are little benefits but it disables matching via PRP0001. Jonathan
> in parallel thread explicitly said of_match_ptr should disappear and he
> is not accepting any new code with it. And in general he is right.
If that's the case then why are you adding maybe unused annotations for
half the drivers rather than removing their of_match_ptr() usages?
There doesn't seem to be any logic here, it's just randomly making
changes as far as I can tell.
The PRP0001 stuff isn't an issue, of_match_ptr() can just be changed to
do the right thing for CONFIG_ACPI. It doesn't buy us huge amounts but
it also costs us very little and may be useful in future. When there's
missing annotations it's not causing issues for practical configurations
as far as I can tell, and if the macro were updated for CONFIG_ACPI it'd
be even less of an issue.
On 13/03/2023 20:22, Mark Brown wrote:
> On Mon, Mar 13, 2023 at 07:39:45PM +0100, Krzysztof Kozlowski wrote:
>> On 13/03/2023 14:55, Mark Brown wrote:
>>> On Fri, Mar 10, 2023 at 11:28:42PM +0100, Krzysztof Kozlowski wrote:
>
>>>> drivers/spi/spi-armada-3700.c:807:34: error: ‘a3700_spi_dt_ids’ defined but not used [-Werror=unused-const-variable=]
>
>>> It would be much better to fix of_match_ptr() and/or the module stuff
>>> that also references the match table here.
>
>> Why? The recommendation is in general not to use of_match_ptr, because
>> there are little benefits but it disables matching via PRP0001. Jonathan
>> in parallel thread explicitly said of_match_ptr should disappear and he
>> is not accepting any new code with it. And in general he is right.
>
> If that's the case then why are you adding maybe unused annotations for
> half the drivers rather than removing their of_match_ptr() usages?
> There doesn't seem to be any logic here, it's just randomly making
> changes as far as I can tell.
These are not random but depend on whether OF is the only matching
method or one of few. Although for IIO all of my patches would be
dropping the of_match_ptr... For some cases in other patchsets I added
__maybe_unused also because of_match_node(), when the table is not used
in driver of_match_table.
>
> The PRP0001 stuff isn't an issue, of_match_ptr() can just be changed to
> do the right thing for CONFIG_ACPI.
That's actually interesting idea, kind of obvious so I wonder why it
wasn't done like this in the first place in 886ca88be6b3 ("ACPI / bus:
Respect PRP0001 when retrieving device match data"). Maybe not to
populate OF device ID tables for the ACPI systems which do not care
about PRP0001?
> It doesn't buy us huge amounts but
> it also costs us very little and may be useful in future. When there's
> missing annotations it's not causing issues for practical configurations
> as far as I can tell, and if the macro were updated for CONFIG_ACPI it'd
> be even less of an issue.
Best regards,
Krzysztof
On Tue, Mar 14, 2023 at 07:44:04AM +0100, Krzysztof Kozlowski wrote:
> On 13/03/2023 20:22, Mark Brown wrote:
> > If that's the case then why are you adding maybe unused annotations for
> > half the drivers rather than removing their of_match_ptr() usages?
> > There doesn't seem to be any logic here, it's just randomly making
> > changes as far as I can tell.
> These are not random but depend on whether OF is the only matching
> method or one of few. Although for IIO all of my patches would be
> dropping the of_match_ptr... For some cases in other patchsets I added
> __maybe_unused also because of_match_node(), when the table is not used
> in driver of_match_table.
This logic is both not apparent when looking at the patches and doesn't
move us in any particular direction - I'd expect this stuff to be
written the same way for all drivers, there's no reason for it to vary.
That just adds complication, it's more random obscure rules people have
to learn.
> > The PRP0001 stuff isn't an issue, of_match_ptr() can just be changed to
> > do the right thing for CONFIG_ACPI.
> That's actually interesting idea, kind of obvious so I wonder why it
> wasn't done like this in the first place in 886ca88be6b3 ("ACPI / bus:
> Respect PRP0001 when retrieving device match data"). Maybe not to
> populate OF device ID tables for the ACPI systems which do not care
> about PRP0001?
Or just it didn't occur to anyone at the time.
The subject says 'spi' but it's actually 'spmi'.
Quoting Krzysztof Kozlowski (2023-03-10 14:28:43)
> 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 is not relevant here).
>
> drivers/spmi/spmi-mtk-pmif.c:517:34: error: ‘mtk_spmi_match_table’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---
Acked-by: Stephen Boyd <[email protected]>
Quoting Krzysztof Kozlowski (2023-03-10 14:28:43)
> 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 is not relevant here).
>
> drivers/spmi/spmi-mtk-pmif.c:517:34: error: ‘mtk_spmi_match_table’ defined but not used [-Werror=unused-const-variable=]
>
> Signed-off-by: Krzysztof Kozlowski <[email protected]>
> ---
I'll fix the subject.
Applied to spmi-next
On 29/03/2023 06:17, Stephen Boyd wrote:
> Quoting Krzysztof Kozlowski (2023-03-10 14:28:43)
>> 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 is not relevant here).
>>
>> drivers/spmi/spmi-mtk-pmif.c:517:34: error: ‘mtk_spmi_match_table’ defined but not used [-Werror=unused-const-variable=]
>>
>> Signed-off-by: Krzysztof Kozlowski <[email protected]>
>> ---
>
> I'll fix the subject.
>
> Applied to spmi-next
Thanks. Apologies for the typo in the subject.
Best regards,
Krzysztof