at24: Drop of_match_ptr() and ACPI_PTR() protections
Subsystems (34)
PATCH 1/1 at24: Drop of_match_ptr() and ACPI_PTR() protections
These result in a very small reduction in driver size, but at the cost of more complex build and slightly harder to read code. In the case of of_match_ptr() it also prevents use of PRP0001 ACPI based identification. In this particular case we have a valid ACPI/PNP ID that should be used in preference to PRP0001 but doesn't mean we should prevent that route.
With this done, drop unneeded of*.h inclusions and __maybe_unused markers.
--- drivers/misc/eeprom/at24.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/misc/eeprom/at24.c +4 -6
@@ -18,8 +18,6 @@#include <linux/module.h> #include <linux/mutex.h> #include <linux/nvmem-provider.h> -#include <linux/of.h> -#include <linux/of_device.h> #include <linux/pm_runtime.h> #include <linux/property.h> #include <linux/regmap.h>
@@ -252,7 +250,7 @@ static const struct i2c_device_id at24_ids[] = { };MODULE_DEVICE_TABLE (i2c, at24_ids); -static const struct of_device_id __maybe_unused at24_of_match[] = { +static const struct of_device_id at24_of_match[] = { { .compatible ="atmel,24c00" , .data = &at24_data_24c00 }, { .compatible ="atmel,24c01" , .data = &at24_data_24c01 }, { .compatible ="atmel,24cs01" , .data = &at24_data_24cs01 },
@@ -286,7 +284,7 @@ static const struct of_device_id __maybe_unused at24_of_match[] = { };MODULE_DEVICE_TABLE (of, at24_of_match); -static const struct acpi_device_id __maybe_unused at24_acpi_ids[] = { +static const struct acpi_device_id at24_acpi_ids[] = { {"INT3499" , (kernel_ulong_t)&at24_data_INT3499 }, {"TPF0001" , (kernel_ulong_t)&at24_data_24c1024 }, {/* END OF LIST */ }
@@ -848,8 +846,8 @@ static struct i2c_driver at24_driver = { .driver = { .name = "at24", .pm = &at24_pm_ops, - .of_match_table = of_match_ptr(at24_of_match), - .acpi_match_table = ACPI_PTR(at24_acpi_ids), + .of_match_table = at24_of_match, + .acpi_match_table = at24_acpi_ids, }, .probe = at24_probe, .remove = at24_remove,
Signature · 1 line
2.45.1.3035.g276e886db78b
Quoted 9 lines · Andy Shevchenko
These result in a very small reduction in driver size, but at the cost of more complex build and slightly harder to read code. In the case of
of_match_ptr()it also prevents use of PRP0001 ACPI based identification. In this particular case we have a valid ACPI/PNP ID that should be used in preference to PRP0001 but doesn't mean we should prevent that route.With this done, drop unneeded of*.h inclusions and
__maybe_unusedmarkers.Signed-off-by Andy Shevchenko <[email protected]>
For reference, see below for a couple of patches in this area that I have sent in the past. Ideally I think we should try to fix these all up and enable -Wunused-const-variable, which is useful in its own right.
Your patch does not address a warning, but it's still a step in that direction.
Arnd
From 57d9cdda8306ac53ea4864b9d3c06d291b6a7929 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <[email protected]>
Date: Thu, 21 Mar 2024 10:33:58 +0100
Subject: [PATCH] [SUBMITTED 20240403] spi: remove incorrect of_match_ptr
annotations
When building with CONFIG_OF disabled but W=1 extra warnings enabled, a couple of driver cause a warning about an unused ID table:
drivers/spi/spi-armada-3700.c:806:34: error: unused variable 'a3700_spi_dt_ids' [-Werror,-Wunused-const-variable] drivers/spi/spi-orion.c:614:34: error: unused variable 'orion_spi_of_match_table' [-Werror,-Wunused-const-variable] drivers/spi/spi-pic32-sqi.c:673:34: error: unused variable 'pic32_sqi_of_ids' [-Werror,-Wunused-const-variable] drivers/spi/spi-pic32.c:850:34: error: unused variable 'pic32_spi_of_match' [-Werror,-Wunused-const-variable] drivers/spi/spi-rockchip.c:1020:34: error: unused variable 'rockchip_spi_dt_match' [-Werror,-Wunused-const-variable] drivers/spi/spi-s3c64xx.c:1642:34: error: unused variable 's3c64xx_spi_dt_match' [-Werror,-Wunused-const-variable] drivers/spi/spi-st-ssc4.c:439:34: error: unused variable 'stm_spi_match' [-Werror,-Wunused-const-variable]
These appear to all be copied from the same original driver, so fix them at the same time by removing the unnecessary of_match_ptr() annotation. As far as I can tell, all these drivers are only actually used on configurations that have CONFIG_OF enabled.
drivers/spi/spi-armada-3700.c +1 -1
@@ -902,7 +902,7 @@ static int a3700_spi_probe(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, };
drivers/spi/spi-img-spfi.c +1 -1
@@ -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 = img_spfi_remove,
drivers/spi/spi-meson-spicc.c +1 -1
@@ -952,7 +952,7 @@ static struct platform_driver meson_spicc_driver = { .remove = meson_spicc_remove, .driver = { .name = "meson-spicc", - .of_match_table = of_match_ptr(meson_spicc_of_match), + .of_match_table = meson_spicc_of_match, }, };
drivers/spi/spi-meson-spifc.c +1 -1
@@ -432,7 +432,7 @@ static struct platform_driver meson_spifc_driver = { .remove = 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, }, };
drivers/spi/spi-orion.c +1 -1
@@ -843,7 +843,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 = orion_spi_remove,
drivers/spi/spi-pic32-sqi.c +1 -1
@@ -679,7 +679,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 = pic32_sqi_remove,
drivers/spi/spi-pic32.c +1 -1
@@ -856,7 +856,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 = pic32_spi_remove,
drivers/spi/spi-rockchip.c +1 -1
@@ -1042,7 +1042,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 = rockchip_spi_remove,
drivers/spi/spi-s3c64xx.c +1 -1
@@ -1680,7 +1680,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 = s3c64xx_spi_remove,
drivers/spi/spi-st-ssc4.c +1 -1
@@ -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 = spi_st_remove,
From 7d3464f1a9324fa788a3581527afe9077f481381 Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <[email protected]>
Date: Thu, 21 Mar 2024 10:33:58 +0100
Subject: [PATCH] [SUBMITTED 20240403] ASoC: remove incorrect
of_match_ptr/ACPI_PTR annotations
When building with CONFIG_OF and/or CONFIG_ACPI disabled but W=1 extra warnings enabled, a lot of driver cause a warning about an unused ID table:
sound/soc/atmel/sam9x5_wm8731.c:187:34: error: unused variable 'sam9x5_wm8731_of_match' [-Werror,-Wunused-const-variable] sound/soc/codecs/rt5514-spi.c:496:34: error: unused variable 'rt5514_of_match' [-Werror,-Wunused-const-variable] sound/soc/samsung/aries_wm8994.c:524:34: error: unused variable 'samsung_wm8994_of_match' [-Werror,-Wunused-const-variable]
The fix is always to just remove the of_match_ptr() and ACPI_PTR() wrappers that remove the reference, rather than adding another #ifdef just for build testing for a configuration that doesn't matter in practice.
sound/soc/amd/acp3x-rt5682-max9836.c +1 -1
@@ -541,7 +541,7 @@ MODULE_DEVICE_TABLE(acpi, acp3x_audio_acpi_match);static struct platform_driver acp3x_audio = { .driver = { .name ="acp3x-alc5682-max98357" , - .acpi_match_table =ACPI_PTR (acp3x_audio_acpi_match), + .acpi_match_table = acp3x_audio_acpi_match, .pm = &snd_soc_pm_ops, }, .probe = acp3x_probe,
sound/soc/atmel/sam9x5_wm8731.c +1 -1
@@ -193,7 +193,7 @@ MODULE_DEVICE_TABLE(of, sam9x5_wm8731_of_match);static struct platform_driver sam9x5_wm8731_driver = { .driver = { .name =DRV_NAME , - .of_match_table =of_match_ptr (sam9x5_wm8731_of_match), + .of_match_table = sam9x5_wm8731_of_match, }, .probe = sam9x5_wm8731_driver_probe, .remove = sam9x5_wm8731_driver_remove,
sound/soc/codecs/rt5514-spi.c +1 -1
@@ -503,7 +503,7 @@ static struct spi_driver rt5514_spi_driver = { .driver = { .name = "rt5514", .pm = &rt5514_pm_ops, - .of_match_table = of_match_ptr(rt5514_of_match), + .of_match_table = rt5514_of_match, }, .probe = rt5514_spi_probe, };
sound/soc/qcom/lpass-sc7280.c +1 -1
@@ -441,7 +441,7 @@ MODULE_DEVICE_TABLE(of, sc7280_lpass_cpu_device_id);static struct platform_driver sc7280_lpass_cpu_platform_driver = { .driver = { .name ="sc7280-lpass-cpu" , - .of_match_table =of_match_ptr (sc7280_lpass_cpu_device_id), + .of_match_table = sc7280_lpass_cpu_device_id, .pm = &sc7280_lpass_pm_ops, }, .probe = asoc_qcom_lpass_cpu_platform_probe,
sound/soc/samsung/aries_wm8994.c +1 -1
@@ -689,7 +689,7 @@ static int aries_audio_probe(struct platform_device *pdev)static struct platform_driver aries_audio_driver = { .driver = { .name ="aries-audio-wm8994" , - .of_match_table =of_match_ptr (samsung_wm8994_of_match), + .of_match_table = samsung_wm8994_of_match, .pm = &snd_soc_pm_ops, }, .probe = aries_audio_probe,
From 95b16768b746973b1258a6966d182656e2fb5a6b Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <[email protected]>
Date: Thu, 21 Mar 2024 10:33:58 +0100
Subject: [PATCH] [SUBMITTED 20240403] drivers: remove incorrect
of_match_ptr/ACPI_PTR annotations
When building with CONFIG_OF and/or CONFIG_ACPI disabled but W=1 extra warnings enabled, a lot of driver cause a warning about an unused ID table:
drivers/char/tpm/tpm_ftpm_tee.c:356:34: error: unused variable 'of_ftpm_tee_ids' [-Werror,-Wunused-const-variable] drivers/dma/img-mdc-dma.c:863:34: error: unused variable 'mdc_dma_of_match' [-Werror,-Wunused-const-variable] drivers/fpga/versal-fpga.c:62:34: error: unused variable 'versal_fpga_of_match' [-Werror,-Wunused-const-variable] drivers/i2c/muxes/i2c-mux-ltc4306.c:200:34: error: unused variable 'ltc4306_of_match' [-Werror,-Wunused-const-variable] drivers/i2c/muxes/i2c-mux-reg.c:242:34: error: unused variable 'i2c_mux_reg_of_match' [-Werror,-Wunused-const-variable] drivers/memory/pl353-smc.c:62:34: error: unused variable 'pl353_smc_supported_children' [-Werror,-Wunused-const-variable] drivers/regulator/pbias-regulator.c:136:34: error: unused variable 'pbias_of_match' [-Werror,-Wunused-const-variable] drivers/regulator/twl-regulator.c:552:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable] drivers/regulator/twl6030-regulator.c:645:34: error: unused variable 'twl_of_match' [-Werror,-Wunused-const-variable] drivers/scsi/hisi_sas/hisi_sas_v2_hw.c:3635:36: error: unused variable 'sas_v2_acpi_match' [-Werror,-Wunused-const-variable] drivers/staging/pi433/pi433_if.c:1359:34: error: unused variable 'pi433_dt_ids' [-Werror,-Wunused-const-variable] drivers/tty/serial/amba-pl011.c:2945:34: error: unused variable 'sbsa_uart_of_match' [-Werror,-Wunused-const-variable]
The fix is always to just remove the of_match_ptr() and ACPI_PTR() wrappers that remove the reference, rather than adding another #ifdef just for build testing for a configuration that doesn't matter in practice.
I considered splitting up the large patch into per subsystem patches, but since it's really just the same thing everywhere it feels better to do it all at once.
drivers/char/tpm/tpm_ftpm_tee.c +1 -1
@@ -362,7 +362,7 @@ MODULE_DEVICE_TABLE(of, of_ftpm_tee_ids);static struct platform_driver ftpm_tee_plat_driver = { .driver = { .name ="ftpm-tee" , - .of_match_table =of_match_ptr (of_ftpm_tee_ids), + .of_match_table = of_ftpm_tee_ids, }, .shutdown = ftpm_plat_tee_shutdown, .probe = ftpm_plat_tee_probe,
drivers/dma/img-mdc-dma.c +1 -1
@@ -1073,7 +1073,7 @@ static struct platform_driver mdc_dma_driver = { .driver = { .name = "img-mdc-dma", .pm = &img_mdc_pm_ops, - .of_match_table = of_match_ptr(mdc_dma_of_match), + .of_match_table = mdc_dma_of_match, }, .probe = mdc_dma_probe, .remove = mdc_dma_remove,
drivers/fpga/versal-fpga.c +1 -1
@@ -69,7 +69,7 @@ static struct platform_driver versal_fpga_driver = { .probe = versal_fpga_probe, .driver = { .name = "versal_fpga_manager", - .of_match_table = of_match_ptr(versal_fpga_of_match), + .of_match_table = versal_fpga_of_match, }, };module_platform_driver (versal_fpga_driver);
drivers/hid/hid-google-hammer.c +2 -4
@@ -275,21 +275,19 @@ static const struct acpi_device_id cbas_ec_acpi_ids[] = {MODULE_DEVICE_TABLE (acpi, cbas_ec_acpi_ids);#endif -#ifdef CONFIG_OF static const struct of_device_id cbas_ec_of_match[] = { { .compatible ="google,cros-cbas" }, { }, };MODULE_DEVICE_TABLE (of, cbas_ec_of_match); -#endif static struct platform_driver cbas_ec_driver = { .probe = cbas_ec_probe, .remove = cbas_ec_remove, .driver = { .name ="cbas_ec" , - .acpi_match_table =ACPI_PTR (cbas_ec_acpi_ids), - .of_match_table =of_match_ptr (cbas_ec_of_match), + .acpi_match_table = cbas_ec_acpi_ids, + .of_match_table = cbas_ec_of_match, .pm = &cbas_ec_pm_ops, }, };
drivers/i2c/muxes/i2c-mux-ltc4306.c +1 -1
@@ -303,7 +303,7 @@ static void ltc4306_remove(struct i2c_client *client)static struct i2c_driver ltc4306_driver = { .driver = { .name ="ltc4306" , - .of_match_table =of_match_ptr (ltc4306_of_match), + .of_match_table = ltc4306_of_match, }, .probe = ltc4306_probe, .remove = ltc4306_remove,
drivers/i2c/muxes/i2c-mux-reg.c +1 -1
@@ -250,7 +250,7 @@ static struct platform_driver i2c_mux_reg_driver = { .remove = i2c_mux_reg_remove, .driver = { .name = "i2c-mux-reg", - .of_match_table = of_match_ptr(i2c_mux_reg_of_match), + .of_match_table = i2c_mux_reg_of_match, }, };
drivers/input/touchscreen/wdt87xx_i2c.c +1 -1
@@ -1168,7 +1168,7 @@ static struct i2c_driver wdt87xx_driver = { .name = WDT87XX_NAME, .dev_groups = wdt87xx_groups, .pm = pm_sleep_ptr(&wdt87xx_pm_ops), - .acpi_match_table = ACPI_PTR(wdt87xx_acpi_id), + .acpi_match_table = wdt87xx_acpi_id, }, };module_i2c_driver (wdt87xx_driver);
drivers/mux/adg792a.c +1 -1
@@ -141,7 +141,7 @@ MODULE_DEVICE_TABLE(of, adg792a_of_match);static struct i2c_driver adg792a_driver = { .driver = { .name ="adg792a" , - .of_match_table =of_match_ptr (adg792a_of_match), + .of_match_table = adg792a_of_match, }, .probe = adg792a_probe, .id_table = adg792a_id,
drivers/net/ethernet/apm/xgene-v2/main.c +1 -1
@@ -731,7 +731,7 @@ MODULE_DEVICE_TABLE(acpi, xge_acpi_match);static struct platform_driver xge_driver = { .driver = { .name ="xgene-enet-v2" , - .acpi_match_table =ACPI_PTR (xge_acpi_match), + .acpi_match_table = xge_acpi_match, }, .probe = xge_probe, .remove = xge_remove,
drivers/net/ethernet/hisilicon/hns_mdio.c +1 -1
@@ -640,7 +640,7 @@ static struct platform_driver hns_mdio_driver = { .driver = { .name = MDIO_DRV_NAME, .of_match_table = hns_mdio_match, - .acpi_match_table = ACPI_PTR(hns_mdio_acpi_match), + .acpi_match_table = hns_mdio_acpi_match, }, };
drivers/regulator/pbias-regulator.c +1 -1
@@ -231,7 +231,7 @@ static struct platform_driver pbias_regulator_driver = { .driver = { .name = "pbias-regulator", .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .of_match_table = of_match_ptr(pbias_of_match), + .of_match_table = pbias_of_match, }, };
drivers/regulator/twl-regulator.c +1 -1
@@ -656,7 +656,7 @@ static struct platform_driver twlreg_driver = { .driver = { .name = "twl4030_reg", .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .of_match_table = of_match_ptr(twl_of_match), + .of_match_table = twl_of_match, }, };
drivers/regulator/twl6030-regulator.c +1 -1
@@ -765,7 +765,7 @@ static struct platform_driver twlreg_driver = { .driver = { .name = "twl6030_reg", .probe_type = PROBE_PREFER_ASYNCHRONOUS, - .of_match_table = of_match_ptr(twl_of_match), + .of_match_table = twl_of_match, }, };
drivers/rtc/rtc-fsl-ftm-alarm.c +1 -1
@@ -320,7 +320,7 @@ static struct platform_driver ftm_rtc_driver = { .driver = { .name = "ftm-alarm", .of_match_table = ftm_rtc_match, - .acpi_match_table = ACPI_PTR(ftm_imx_acpi_ids), + .acpi_match_table = ftm_imx_acpi_ids, }, };
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +1 -1
@@ -1806,7 +1806,7 @@ static struct platform_driver hisi_sas_v1_driver = { .driver = { .name = DRV_NAME, .of_match_table = sas_v1_of_match, - .acpi_match_table = ACPI_PTR(sas_v1_acpi_match), + .acpi_match_table = sas_v1_acpi_match, }, };
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +1 -1
@@ -3653,7 +3653,7 @@ static struct platform_driver hisi_sas_v2_driver = { .driver = { .name = DRV_NAME, .of_match_table = sas_v2_of_match, - .acpi_match_table = ACPI_PTR(sas_v2_acpi_match), + .acpi_match_table = sas_v2_acpi_match, }, };
drivers/tty/serial/amba-pl011.c +3 -3
@@ -3051,7 +3051,7 @@ static const struct of_device_id sbsa_uart_of_match[] = { };MODULE_DEVICE_TABLE (of, sbsa_uart_of_match); -static const struct acpi_device_id __maybe_unused sbsa_uart_acpi_match[] = { +static const struct acpi_device_id sbsa_uart_acpi_match[] = { {"ARMH0011" ,0 }, {"ARMHB000" ,0 }, {},
@@ -3064,8 +3064,8 @@ static struct platform_driver arm_sbsa_uart_platform_driver = { .driver = { .name = "sbsa-uart", .pm = &pl011_dev_pm_ops, - .of_match_table = of_match_ptr(sbsa_uart_of_match), - .acpi_match_table = ACPI_PTR(sbsa_uart_acpi_match), + .of_match_table = sbsa_uart_of_match, + .acpi_match_table = sbsa_uart_acpi_match, .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_AMBA_PL011), }, };
drivers/tty/serial/ma35d1_serial.c +1 -1
@@ -799,7 +799,7 @@ static struct platform_driver ma35d1serial_driver = { .resume = ma35d1serial_resume, .driver = { .name = "ma35d1-uart", - .of_match_table = of_match_ptr(ma35d1_serial_of_match), + .of_match_table = ma35d1_serial_of_match, }, };
sound/soc/codecs/rt1318.c +2 -4
@@ -1151,13 +1151,11 @@ static const struct of_device_id rt1318_of_match[] = { };MODULE_DEVICE_TABLE (of, rt1318_of_match); -#ifdef CONFIG_ACPI static const struct acpi_device_id rt1318_acpi_match[] = { {"10EC1318" ,0 }, { }, };MODULE_DEVICE_TABLE (acpi, rt1318_acpi_match); -#endif static int rt1318_parse_dt (struct rt1318_priv *rt1318,struct device *dev) {
@@ -1340,8 +1338,8 @@ static int rt1318_i2c_probe(struct i2c_client *i2c)static struct i2c_driver rt1318_i2c_driver = { .driver = { .name ="rt1318" , - .of_match_table =of_match_ptr (rt1318_of_match), - .acpi_match_table =ACPI_PTR (rt1318_acpi_match), + .of_match_table = rt1318_of_match, + .acpi_match_table = rt1318_acpi_match, }, .probe = rt1318_i2c_probe, .id_table = rt1318_i2c_id,
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · Andy Shevchenko
These result in a very small reduction in driver size, but at the cost of more complex build and slightly harder to read code. In the case of
of_match_ptr()it also prevents use of PRP0001 ACPI based identification. In this particular case we have a valid ACPI/PNP ID that should be used in preference to PRP0001 but doesn't mean we should prevent that route.
Quoted 5 lines
Quoted 3 lines
With this done, drop unneeded of*.h inclusions and
__maybe_unusedmarkers.Signed-off-by Andy Shevchenko <[email protected]>Acked-by Arnd Bergmann <[email protected]>
Thank you!
Quoted 4 lines
For reference, see below for a couple of patches in this area that I have sent in the past. Ideally I think we should try to fix these all up and enable -Wunused-const-variable, which is useful in its own right.
Agree.
Quoted 2 lines
Your patch does not address a warning, but it's still a step in that direction.
Yeah, because the original code uses __maybe_unused markers.
...
Quoted 2 lines
Subject: [PATCH] [SUBMITTED 20240403] spi: remove incorrect
of_match_ptr
annotations
Was it applied (and the rest you provided here)?
To me sounds like a good cleanup that should be applier sooner than later to move forward of getting rid of of_match_ptr()/ACPI_PTR() completely.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Arnd Bergmann
maintainerQuoted 7 lines · Andy Shevchenko
Quoted 4 lines · Arnd Bergmann
On Tue, Feb 25, 2025, at 11:08, Andy Shevchenko wrote:
Subject: [PATCH] [SUBMITTED 20240403] spi: remove incorrect
of_match_ptr
annotationsWas it applied (and the rest you provided here)?
It was part of a longer series. Some were applied, but the ones I provided here are those that for some reason did not make it. They should apply cleanly to today's linux-next.
Arnd
Quoted 4 lines · Arnd Bergmann
Quoted 3 lines · Andy Shevchenko
Quoted 1 line · Arnd Bergmann
On Tue, Feb 25, 2025, at 11:08, Andy Shevchenko wrote:
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Subject: [PATCH] [SUBMITTED 20240403] spi: remove incorrect
of_match_ptr
annotationsWas it applied (and the rest you provided here)?
It was part of a longer series. Some were applied, but the ones I provided here are those that for some reason did not make it. They should apply cleanly to today's linux-next.
I can review them and give a tag if you issue a new version.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Arnd Bergmann
maintainerQuoted 8 lines · Andy Shevchenko
Quoted 7 lines · Arnd Bergmann
Quoted 6 lines · Andy Shevchenko
Quoted 4 lines · Arnd Bergmann
On Tue, Feb 25, 2025, at 11:08, Andy Shevchenko wrote:
Subject: [PATCH] [SUBMITTED 20240403] spi: remove incorrect
of_match_ptr
annotations
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Was it applied (and the rest you provided here)?
It was part of a longer series. Some were applied, but the ones I provided here are those that for some reason did not make it. They should apply cleanly to today's linux-next.
I can review them and give a tag if you issue a new version.
I've sent a bunch of those to maintainers directly now but in the end forgot to Cc you. Let's see what gets accepted, and then I'll send the rest as a series fro the endgame.
Arnd
Krzysztof Kozlowski
maintainerQuoted 9 lines · Arnd Bergmann
Quoted 8 lines · Andy Shevchenko
These result in a very small reduction in driver size, but at the cost of more complex build and slightly harder to read code. In the case of
of_match_ptr()it also prevents use of PRP0001 ACPI based identification. In this particular case we have a valid ACPI/PNP ID that should be used in preference to PRP0001 but doesn't mean we should prevent that route.With this done, drop unneeded of*.h inclusions and
__maybe_unusedmarkers.
Quoted 9 lines
Quoted 1 line
Signed-off-by Andy Shevchenko <[email protected]>Acked-by Arnd Bergmann <[email protected]>For reference, see below for a couple of patches in this area that I have sent in the past. Ideally I think we should try to fix these all up and enable -Wunused-const-variable, which is useful in its own right.
I tried to fix this in SPI, regulator and ASoC 2 years ago and Mark rejected such approach of dropping ACPI/of_match_ptr. AFAIU, Mark wants this to be fixed in more generic way, on the OF and ACPI common code, not per driver.
SPI:
https://lore.kernel.org/all/[email protected]/
regulator:
https://lore.kernel.org/all/[email protected]/
ASoC:
https://lore.kernel.org/all/[email protected]/
Best regards,
Krzysztof
Quoted 24 lines · Krzysztof Kozlowski
Quoted 9 lines · Arnd Bergmann
Quoted 8 lines · Andy Shevchenko
These result in a very small reduction in driver size, but at the cost of more complex build and slightly harder to read code. In the case of
of_match_ptr()it also prevents use of PRP0001 ACPI based identification. In this particular case we have a valid ACPI/PNP ID that should be used in preference to PRP0001 but doesn't mean we should prevent that route.With this done, drop unneeded of*.h inclusions and
__maybe_unusedmarkers.Quoted 8 lines
Quoted 1 line
Signed-off-by Andy Shevchenko <[email protected]>Acked-by Arnd Bergmann <[email protected]>For reference, see below for a couple of patches in this area that I have sent in the past. Ideally I think we should try to fix these all up and enable -Wunused-const-variable, which is useful in its own right.
I tried to fix this in SPI, regulator and ASoC 2 years ago and Mark rejected such approach of dropping ACPI/of_match_ptr. AFAIU, Mark wants this to be fixed in more generic way, on the OF and ACPI common code, not per driver.
Quoted 8 lines
SPI:
https://lore.kernel.org/all/[email protected]/
It was almost two years ago. Things may be changed :-)
At least I have no impediments so far with converting drivers I'm supporting in the SPI. For ASoC there might be a new attempt by Cezary Rojewski in the future (he does some cleanups in that area, and we discussed cleaning up ACPI_PTR() at
minimum).
Also note
$ git grep -lw ACPI_PTR | wc -l 238
$ git grep -lw of_match_ptr | wc -l 841
So, at least dropping ACPI_PTR() seems on the track to getting rid of. And I checked, they are spread all over the kernel with top subsystems as
...
10 drivers/hwtracing/coresight
11 drivers/input/touchscreen
15 drivers/media/i2c
53 sound/soc/codecs
Signature · 2 lines
With Best Regards, Andy Shevchenko
Arnd Bergmann
maintainerQuoted 14 lines · Andy Shevchenko
Quoted 13 lines · Krzysztof Kozlowski
On 25/02/2025 11:29, Arnd Bergmann wrote:
I tried to fix this in SPI, regulator and ASoC 2 years ago and Mark rejected such approach of dropping ACPI/of_match_ptr. AFAIU, Mark wants this to be fixed in more generic way, on the OF and ACPI common code, not per driver.
Quoted 8 lines
Quoted 2 lines
It was almost two years ago. Things may be changed :-)
At least I have no impediments so far with converting drivers I'm supporting in the SPI. For ASoC there might be a new attempt by Cezary Rojewski in the future (he does some cleanups in that area, and we discussed cleaning upACPI_PTR()at
minimum).
I skipped those three subsystems when I sent my backlog. Comparing what I have left with the version from the patches above I see that about 40% of the warnings in all three are already addressed in the meantime, leaving just
drivers/regulator/pbias-regulator.c | 2 +- drivers/regulator/twl-regulator.c | 2 +- drivers/regulator/twl6030-regulator.c | 2 +- drivers/spi/spi-armada-3700.c | 2 +- drivers/spi/spi-img-spfi.c | 2 +- drivers/spi/spi-meson-spicc.c | 2 +- drivers/spi/spi-meson-spifc.c | 2 +- drivers/spi/spi-orion.c | 2 +- drivers/spi/spi-pic32-sqi.c | 2 +- drivers/spi/spi-pic32.c | 2 +- drivers/spi/spi-rockchip.c | 2 +- drivers/spi/spi-s3c64xx.c | 2 +- drivers/spi/spi-st-ssc4.c | 2 +- sound/soc/amd/acp3x-rt5682-max9836.c | 2 +- sound/soc/atmel/sam9x5_wm8731.c | 2 +- sound/soc/codecs/rt1318.c | 6 ++---- sound/soc/codecs/rt5514-spi.c | 2 +- sound/soc/qcom/lpass-sc7280.c | 2 +- sound/soc/samsung/aries_wm8994.c | 2 +-
I send everything else that I have to address the warnings, and they are slowly making their way into the tree, as of today the remaining ones are
drivers/char/apm-emulation.c | 5 ++--- drivers/char/tpm/tpm_ftpm_tee.c | 2 +- drivers/comedi/drivers/ni_atmio.c | 2 +- drivers/dma/img-mdc-dma.c | 2 +- drivers/fpga/versal-fpga.c | 2 +- drivers/input/touchscreen/stmpe-ts.c | 2 +- drivers/mux/adg792a.c | 2 +- drivers/net/ethernet/apm/xgene-v2/main.c | 4 +--- drivers/net/ethernet/hisilicon/hns_mdio.c | 2 +- drivers/rtc/rtc-fsl-ftm-alarm.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/tty/serial/amba-pl011.c | 6 +++--- drivers/tty/serial/ma35d1_serial.c | 2 +-
and I'm optimistic about most of them making it into the next merge window. Once few enough are left, I can send it again as a series that turns on the warning by default and hopefully by that time we can wear down Mark enough that he takes the patches even if he still disagrees ;-)
Arnd
Bartosz Golaszewski
AppliedFrom: Bartosz Golaszewski <[email protected]>
Quoted 9 lines · Andy Shevchenko
These result in a very small reduction in driver size, but at the cost of more complex build and slightly harder to read code. In the case of
of_match_ptr()it also prevents use of PRP0001 ACPI based identification. In this particular case we have a valid ACPI/PNP ID that should be used in preference to PRP0001 but doesn't mean we should prevent that route.With this done, drop unneeded of*.h inclusions and
__maybe_unusedmarkers.[...]
Applied, thanks!
[1/1] at24: Drop of_match_ptr() and ACPI_PTR() protections
commit: 51e36ca2251c5a47d8f7069d60fd07153cff3f36
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>