drivers: gpio: use of_match_ptr() and ACPI_PTR() macros
Subsystems (23)
PATCH 1/1 drivers: gpio: use of_match_ptr() and ACPI_PTR() macros
The of_match_ptr(foo) macro evaluates to foo, only if CONFIG_OF is set, otherwise to NULL. Same does ACPI_PTR with CONFIG_ACPI. That's very helpful for drivers that can be used with or without oftree / acpi.
Even though most of the drivers touched here probably don't actually need that, it's also nice for consistency to make it the de-facto standard and change all drivers to use the of_match_ptr() and ACPI_PTR() macros.
A nice side effect: in some situations, when compiled w/o CONFIG_OF/CONFIG_ACPI, the corresponding match tables could automatically become unreferenced and optimized-away by the compiler, w/o explicitly cluttering the code w/ ifdef's.
--- drivers/gpio/gpio-74x164.c | 2 +- drivers/gpio/gpio-74xx-mmio.c | 2 +- drivers/gpio/gpio-adnp.c | 2 +- drivers/gpio/gpio-aspeed-sgpio.c | 2 +- drivers/gpio/gpio-aspeed.c | 2 +- drivers/gpio/gpio-ath79.c | 2 +- drivers/gpio/gpio-bcm-kona.c | 2 +- drivers/gpio/gpio-brcmstb.c | 2 +- drivers/gpio/gpio-cadence.c | 2 +- drivers/gpio/gpio-creg-snps.c | 2 +- drivers/gpio/gpio-dwapb.c | 4 ++-- drivers/gpio/gpio-eic-sprd.c | 2 +- drivers/gpio/gpio-em.c | 2 +- drivers/gpio/gpio-ge.c | 2 +- drivers/gpio/gpio-grgpio.c | 2 +- drivers/gpio/gpio-gw-pld.c | 2 +- drivers/gpio/gpio-hlwd.c | 2 +- drivers/gpio/gpio-logicvc.c | 2 +- drivers/gpio/gpio-lp3943.c | 2 +- drivers/gpio/gpio-lpc18xx.c | 2 +- drivers/gpio/gpio-mb86s7x.c | 2 +- drivers/gpio/gpio-mm-lantiq.c | 2 +- drivers/gpio/gpio-moxtet.c | 2 +- drivers/gpio/gpio-mpc5200.c | 4 ++-- drivers/gpio/gpio-mpc8xxx.c | 2 +- drivers/gpio/gpio-mt7621.c | 2 +- drivers/gpio/gpio-mvebu.c | 2 +- drivers/gpio/gpio-mxc.c | 2 +- drivers/gpio/gpio-mxs.c | 2 +- drivers/gpio/gpio-octeon.c | 2 +- drivers/gpio/gpio-omap.c | 2 +- drivers/gpio/gpio-palmas.c | 2 +- drivers/gpio/gpio-pca953x.c | 4 ++-- drivers/gpio/gpio-pca9570.c | 2 +- drivers/gpio/gpio-pisosr.c | 2 +- drivers/gpio/gpio-pmic-eic-sprd.c | 2 +- drivers/gpio/gpio-rda.c | 2 +- drivers/gpio/gpio-sl28cpld.c | 2 +- drivers/gpio/gpio-spear-spics.c | 2 +- drivers/gpio/gpio-sprd.c | 2 +- drivers/gpio/gpio-stp-xway.c | 2 +- drivers/gpio/gpio-syscon.c | 2 +- drivers/gpio/gpio-tb10x.c | 2 +- drivers/gpio/gpio-tegra.c | 2 +- drivers/gpio/gpio-tegra186.c | 2 +- drivers/gpio/gpio-tpic2810.c | 2 +- drivers/gpio/gpio-ts4800.c | 2 +- drivers/gpio/gpio-ts4900.c | 2 +- drivers/gpio/gpio-twl4030.c | 2 +- drivers/gpio/gpio-uniphier.c | 2 +- drivers/gpio/gpio-vf610.c | 2 +- drivers/gpio/gpio-wcd934x.c | 2 +- drivers/gpio/gpio-xgene-sb.c | 2 +- drivers/gpio/gpio-xgene.c | 2 +- drivers/gpio/gpio-xgs-iproc.c | 2 +- drivers/gpio/gpio-xilinx.c | 2 +- drivers/gpio/gpio-xlp.c | 2 +- drivers/gpio/gpio-zevio.c | 2 +- drivers/gpio/gpio-zynq.c | 2 +- 59 files changed, 62 insertions(+), 62 deletions(-)
drivers/gpio/gpio-74x164.c +1 -1
@@ -184,7 +184,7 @@ MODULE_DEVICE_TABLE(of, gen_74x164_dt_ids);static struct spi_driver gen_74x164_driver = { .driver = { .name ="74x164" , - .of_match_table = gen_74x164_dt_ids, + .of_match_table =of_match_ptr (gen_74x164_dt_ids), }, .probe = gen_74x164_probe, .remove = gen_74x164_remove,
drivers/gpio/gpio-74xx-mmio.c +1 -1
@@ -138,7 +138,7 @@ static int mmio_74xx_gpio_probe(struct platform_device *pdev)static struct platform_driver mmio_74xx_gpio_driver = { .driver = { .name ="74xx-mmio-gpio" , - .of_match_table = mmio_74xx_gpio_ids, + .of_match_table =of_match_ptr (mmio_74xx_gpio_ids), }, .probe = mmio_74xx_gpio_probe, };
drivers/gpio/gpio-adnp.c +1 -1
@@ -534,7 +534,7 @@ MODULE_DEVICE_TABLE(of, adnp_of_match);static struct i2c_driver adnp_i2c_driver = { .driver = { .name ="gpio-adnp" , - .of_match_table = adnp_of_match, + .of_match_table =of_match_ptr (adnp_of_match), }, .probe = adnp_i2c_probe, .id_table = adnp_i2c_id,
drivers/gpio/gpio-aspeed-sgpio.c +1 -1
@@ -564,7 +564,7 @@ static int __init aspeed_sgpio_probe(struct platform_device *pdev)static struct platform_driver aspeed_sgpio_driver = { .driver = { .name =KBUILD_MODNAME , - .of_match_table = aspeed_sgpio_of_table, + .of_match_table =of_match_ptr (aspeed_sgpio_of_table), }, };
drivers/gpio/gpio-aspeed.c +1 -1
@@ -1244,7 +1244,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)static struct platform_driver aspeed_gpio_driver = { .driver = { .name =KBUILD_MODNAME , - .of_match_table = aspeed_gpio_of_table, + .of_match_table =of_match_ptr (aspeed_gpio_of_table), }, };
drivers/gpio/gpio-ath79.c +1 -1
@@ -301,7 +301,7 @@ static int ath79_gpio_probe(struct platform_device *pdev)static struct platform_driver ath79_gpio_driver = { .driver = { .name ="ath79-gpio" , - .of_match_table = ath79_gpio_of_match, + .of_match_table =of_match_ptr (ath79_gpio_of_match), }, .probe = ath79_gpio_probe, };
drivers/gpio/gpio-bcm-kona.c +1 -1
@@ -667,7 +667,7 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)static struct platform_driver bcm_kona_gpio_driver = { .driver = { .name ="bcm-kona-gpio" , - .of_match_table = bcm_kona_gpio_of_match, + .of_match_table =of_match_ptr (bcm_kona_gpio_of_match), }, .probe = bcm_kona_gpio_probe, };
drivers/gpio/gpio-brcmstb.c +1 -1
@@ -814,7 +814,7 @@ MODULE_DEVICE_TABLE(of, brcmstb_gpio_of_match);static struct platform_driver brcmstb_gpio_driver = { .driver = { .name ="brcmstb-gpio" , - .of_match_table = brcmstb_gpio_of_match, + .of_match_table =of_match_ptr (brcmstb_gpio_of_match), .pm = &brcmstb_gpio_pm_ops, }, .probe = brcmstb_gpio_probe,
drivers/gpio/gpio-cadence.c +1 -1
@@ -282,7 +282,7 @@ static const struct of_device_id cdns_of_ids[] = {static struct platform_driver cdns_gpio_driver = { .driver = { .name ="cdns-gpio" , - .of_match_table = cdns_of_ids, + .of_match_table =of_match_ptr (cdns_of_ids), }, .probe = cdns_gpio_probe, .remove = cdns_gpio_remove,
drivers/gpio/gpio-creg-snps.c +1 -1
@@ -182,7 +182,7 @@ static int creg_gpio_probe(struct platform_device *pdev)static struct platform_driver creg_gpio_snps_driver = { .driver = { .name ="snps-creg-gpio" , - .of_match_table = creg_gpio_ids, + .of_match_table =of_match_ptr (creg_gpio_ids), }, .probe = creg_gpio_probe, };
drivers/gpio/gpio-dwapb.c +2 -2
@@ -822,8 +822,8 @@ static struct platform_driver dwapb_gpio_driver = { .driver = { .name = DWAPB_DRIVER_NAME, .pm = &dwapb_gpio_pm_ops, - .of_match_table = dwapb_of_match, - .acpi_match_table = dwapb_acpi_match, + .of_match_table = of_match_ptr(dwapb_of_match), + .acpi_match_table = ACPI_PTR(dwapb_acpi_match), }, .probe = dwapb_gpio_probe, };
drivers/gpio/gpio-eic-sprd.c +1 -1
@@ -680,7 +680,7 @@ static struct platform_driver sprd_eic_driver = { .probe = sprd_eic_probe, .driver = { .name = "sprd-eic", - .of_match_table = sprd_eic_of_match, + .of_match_table = of_match_ptr(sprd_eic_of_match), }, };
drivers/gpio/gpio-em.c +1 -1
@@ -370,7 +370,7 @@ static struct platform_driver em_gio_device_driver = { .probe = em_gio_probe, .driver = { .name = "em_gio", - .of_match_table = em_gio_dt_ids, + .of_match_table = of_match_ptr(em_gio_dt_ids), } };
drivers/gpio/gpio-ge.c +1 -1
@@ -99,7 +99,7 @@ static int __init gef_gpio_probe(struct platform_device *pdev)static struct platform_driver gef_gpio_driver = { .driver = { .name ="gef-gpio" , - .of_match_table = gef_gpio_ids, + .of_match_table =of_match_ptr (gef_gpio_ids), }, };module_platform_driver_probe (gef_gpio_driver, gef_gpio_probe);
drivers/gpio/gpio-grgpio.c +1 -1
@@ -467,7 +467,7 @@ MODULE_DEVICE_TABLE(of, grgpio_match);static struct platform_driver grgpio_driver = { .driver = { .name ="grgpio" , - .of_match_table = grgpio_match, + .of_match_table =of_match_ptr (grgpio_match), }, .probe = grgpio_probe, .remove = grgpio_remove,
drivers/gpio/gpio-gw-pld.c +1 -1
@@ -126,7 +126,7 @@ MODULE_DEVICE_TABLE(of, gw_pld_dt_ids);static struct i2c_driver gw_pld_driver = { .driver = { .name ="gw_pld" , - .of_match_table = gw_pld_dt_ids, + .of_match_table =of_match_ptr (gw_pld_dt_ids), }, .probe = gw_pld_probe, .id_table = gw_pld_id,
drivers/gpio/gpio-hlwd.c +1 -1
@@ -294,7 +294,7 @@ MODULE_DEVICE_TABLE(of, hlwd_gpio_match);static struct platform_driver hlwd_gpio_driver = { .driver = { .name ="gpio-hlwd" , - .of_match_table = hlwd_gpio_match, + .of_match_table =of_match_ptr (hlwd_gpio_match), }, .probe = hlwd_gpio_probe, };
drivers/gpio/gpio-logicvc.c +1 -1
@@ -158,7 +158,7 @@ MODULE_DEVICE_TABLE(of, logicivc_gpio_of_table);static struct platform_driver logicvc_gpio_driver = { .driver = { .name ="gpio-logicvc" , - .of_match_table = logicivc_gpio_of_table, + .of_match_table =of_match_ptr (logicivc_gpio_of_table), }, .probe = logicvc_gpio_probe, };
drivers/gpio/gpio-lp3943.c +1 -1
@@ -215,7 +215,7 @@ static struct platform_driver lp3943_gpio_driver = { .probe = lp3943_gpio_probe, .driver = { .name = "lp3943-gpio", - .of_match_table = lp3943_gpio_of_match, + .of_match_table = of_match_ptr(lp3943_gpio_of_match), }, };module_platform_driver (lp3943_gpio_driver);
drivers/gpio/gpio-lpc18xx.c +1 -1
@@ -405,7 +405,7 @@ static struct platform_driver lpc18xx_gpio_driver = { .remove = lpc18xx_gpio_remove, .driver = { .name = "lpc18xx-gpio", - .of_match_table = lpc18xx_gpio_match, + .of_match_table = of_match_ptr(lpc18xx_gpio_match), }, };module_platform_driver (lpc18xx_gpio_driver);
drivers/gpio/gpio-mb86s7x.c +1 -1
@@ -233,7 +233,7 @@ MODULE_DEVICE_TABLE(acpi, mb86s70_gpio_acpi_ids);static struct platform_driver mb86s70_gpio_driver = { .driver = { .name ="mb86s70-gpio" , - .of_match_table = mb86s70_gpio_dt_ids, + .of_match_table =of_match_ptr (mb86s70_gpio_dt_ids), .acpi_match_table =ACPI_PTR (mb86s70_gpio_acpi_ids), }, .probe = mb86s70_gpio_probe,
drivers/gpio/gpio-mm-lantiq.c +1 -1
@@ -141,7 +141,7 @@ static struct platform_driver ltq_mm_driver = { .remove = ltq_mm_remove, .driver = { .name = "gpio-mm-ltq", - .of_match_table = ltq_mm_match, + .of_match_table = of_match_ptr(ltq_mm_match), }, };
drivers/gpio/gpio-moxtet.c +1 -1
@@ -167,7 +167,7 @@ static const enum turris_mox_module_id moxtet_gpio_module_table[] = {static struct moxtet_driver moxtet_gpio_driver = { .driver = { .name ="moxtet-gpio" , - .of_match_table = moxtet_gpio_dt_ids, + .of_match_table =of_match_ptr (moxtet_gpio_dt_ids), .probe = moxtet_gpio_probe, }, .id_table = moxtet_gpio_module_table,
drivers/gpio/gpio-mpc5200.c +2 -2
@@ -182,7 +182,7 @@ static const struct of_device_id mpc52xx_wkup_gpiochip_match[] = {static struct platform_driver mpc52xx_wkup_gpiochip_driver = { .driver = { .name ="mpc5200-gpio-wkup" , - .of_match_table = mpc52xx_wkup_gpiochip_match, + .of_match_table =of_match_ptr (mpc52xx_wkup_gpiochip_match), }, .probe = mpc52xx_wkup_gpiochip_probe, .remove = mpc52xx_gpiochip_remove,
@@ -335,7 +335,7 @@ static const struct of_device_id mpc52xx_simple_gpiochip_match[] = {static struct platform_driver mpc52xx_simple_gpiochip_driver = { .driver = { .name ="mpc5200-gpio" , - .of_match_table = mpc52xx_simple_gpiochip_match, + .of_match_table =of_match_ptr (mpc52xx_simple_gpiochip_match), }, .probe = mpc52xx_simple_gpiochip_probe, .remove = mpc52xx_gpiochip_remove,
drivers/gpio/gpio-mpc8xxx.c +1 -1
@@ -430,7 +430,7 @@ static struct platform_driver mpc8xxx_plat_driver = { .remove = mpc8xxx_remove, .driver = { .name = "gpio-mpc8xxx", - .of_match_table = mpc8xxx_gpio_ids, + .of_match_table = of_match_ptr(mpc8xxx_gpio_ids), }, };
drivers/gpio/gpio-mt7621.c +1 -1
@@ -330,7 +330,7 @@ static struct platform_driver mediatek_gpio_driver = { .probe = mediatek_gpio_probe, .driver = { .name = "mt7621_gpio", - .of_match_table = mediatek_gpio_match, + .of_match_table = of_match_ptr(mediatek_gpio_match), }, };
drivers/gpio/gpio-mvebu.c +1 -1
@@ -1269,7 +1269,7 @@ static int mvebu_gpio_probe(struct platform_device *pdev)static struct platform_driver mvebu_gpio_driver = { .driver = { .name ="mvebu-gpio" , - .of_match_table = mvebu_gpio_of_match, + .of_match_table =of_match_ptr (mvebu_gpio_of_match), }, .probe = mvebu_gpio_probe, .suspend = mvebu_gpio_suspend,
drivers/gpio/gpio-mxc.c +1 -1
@@ -592,7 +592,7 @@ static struct syscore_ops mxc_gpio_syscore_ops = {static struct platform_driver mxc_gpio_driver = { .driver = { .name ="gpio-mxc" , - .of_match_table = mxc_gpio_dt_ids, + .of_match_table =of_match_ptr (mxc_gpio_dt_ids), .suppress_bind_attrs = true, }, .probe = mxc_gpio_probe,
drivers/gpio/gpio-mxs.c +1 -1
@@ -366,7 +366,7 @@ static int mxs_gpio_probe(struct platform_device *pdev)static struct platform_driver mxs_gpio_driver = { .driver = { .name ="gpio-mxs" , - .of_match_table = mxs_gpio_dt_ids, + .of_match_table =of_match_ptr (mxs_gpio_dt_ids), .suppress_bind_attrs = true, }, .probe = mxs_gpio_probe,
drivers/gpio/gpio-octeon.c +1 -1
@@ -125,7 +125,7 @@ MODULE_DEVICE_TABLE(of, octeon_gpio_match);static struct platform_driver octeon_gpio_driver = { .driver = { .name ="octeon_gpio" , - .of_match_table = octeon_gpio_match, + .of_match_table =of_match_ptr (octeon_gpio_match), }, .probe = octeon_gpio_probe, };
drivers/gpio/gpio-omap.c +1 -1
@@ -1559,7 +1559,7 @@ static struct platform_driver omap_gpio_driver = { .driver = { .name = "omap_gpio", .pm = &gpio_pm_ops, - .of_match_table = omap_gpio_match, + .of_match_table = of_match_ptr(omap_gpio_match), }, };
drivers/gpio/gpio-palmas.c +1 -1
@@ -192,7 +192,7 @@ static int palmas_gpio_probe(struct platform_device *pdev)static struct platform_driver palmas_gpio_driver = { .driver.name ="palmas-gpio" , - .driver.of_match_table = of_palmas_gpio_match, + .driver.of_match_table =of_match_ptr (of_palmas_gpio_match), .probe = palmas_gpio_probe, };
drivers/gpio/gpio-pca953x.c +2 -2
@@ -1284,8 +1284,8 @@ static struct i2c_driver pca953x_driver = { .driver = { .name = "pca953x", .pm = &pca953x_pm_ops, - .of_match_table = pca953x_dt_ids, - .acpi_match_table = pca953x_acpi_ids, + .of_match_table = of_match_ptr(pca953x_dt_ids), + .acpi_match_table = ACPI_PTR(pca953x_acpi_ids), }, .probe = pca953x_probe, .remove = pca953x_remove,
drivers/gpio/gpio-pca9570.c +1 -1
@@ -134,7 +134,7 @@ MODULE_DEVICE_TABLE(of, pca9570_of_match_table);static struct i2c_driver pca9570_driver = { .driver = { .name ="pca9570" , - .of_match_table = pca9570_of_match_table, + .of_match_table =of_match_ptr (pca9570_of_match_table), }, .probe_new = pca9570_probe, .id_table = pca9570_id_table,
drivers/gpio/gpio-pisosr.c +1 -1
@@ -189,7 +189,7 @@ MODULE_DEVICE_TABLE(of, pisosr_gpio_of_match_table);static struct spi_driver pisosr_gpio_driver = { .driver = { .name ="pisosr-gpio" , - .of_match_table = pisosr_gpio_of_match_table, + .of_match_table =of_match_ptr (pisosr_gpio_of_match_table), }, .probe = pisosr_gpio_probe, .remove = pisosr_gpio_remove,
drivers/gpio/gpio-pmic-eic-sprd.c +1 -1
@@ -371,7 +371,7 @@ static struct platform_driver sprd_pmic_eic_driver = { .probe = sprd_pmic_eic_probe, .driver = { .name = "sprd-pmic-eic", - .of_match_table = sprd_pmic_eic_of_match, + .of_match_table = of_match_ptr(sprd_pmic_eic_of_match), }, };
drivers/gpio/gpio-rda.c +1 -1
@@ -283,7 +283,7 @@ static struct platform_driver rda_gpio_driver = { .probe = rda_gpio_probe, .driver = { .name = "rda-gpio", - .of_match_table = rda_gpio_of_match, + .of_match_table = of_match_ptr(rda_gpio_of_match), }, };
drivers/gpio/gpio-sl28cpld.c +1 -1
@@ -151,7 +151,7 @@ static struct platform_driver sl28cpld_gpio_driver = { .probe = sl28cpld_gpio_probe, .driver = { .name = "sl28cpld-gpio", - .of_match_table = sl28cpld_gpio_of_match, + .of_match_table = of_match_ptr(sl28cpld_gpio_of_match), }, };module_platform_driver (sl28cpld_gpio_driver);
drivers/gpio/gpio-spear-spics.c +1 -1
@@ -186,7 +186,7 @@ static struct platform_driver spics_gpio_driver = { .probe = spics_gpio_probe, .driver = { .name = "spear-spics-gpio", - .of_match_table = spics_gpio_of_match, + .of_match_table = of_match_ptr(spics_gpio_of_match), }, };
drivers/gpio/gpio-sprd.c +1 -1
@@ -279,7 +279,7 @@ static struct platform_driver sprd_gpio_driver = { .probe = sprd_gpio_probe, .driver = { .name = "sprd-gpio", - .of_match_table = sprd_gpio_of_match, + .of_match_table = of_match_ptr(sprd_gpio_of_match), }, };
drivers/gpio/gpio-stp-xway.c +1 -1
@@ -328,7 +328,7 @@ static struct platform_driver xway_stp_driver = { .probe = xway_stp_probe, .driver = { .name = "gpio-stp-xway", - .of_match_table = xway_stp_match, + .of_match_table = of_match_ptr(xway_stp_match), }, };
drivers/gpio/gpio-syscon.c +1 -1
@@ -268,7 +268,7 @@ static int syscon_gpio_probe(struct platform_device *pdev)static struct platform_driver syscon_gpio_driver = { .driver = { .name ="gpio-syscon" , - .of_match_table = syscon_gpio_ids, + .of_match_table =of_match_ptr (syscon_gpio_ids), }, .probe = syscon_gpio_probe, };
drivers/gpio/gpio-tb10x.c +1 -1
@@ -236,7 +236,7 @@ static struct platform_driver tb10x_gpio_driver = { .remove = tb10x_gpio_remove, .driver = { .name = "tb10x-gpio", - .of_match_table = tb10x_gpio_dt_ids, + .of_match_table = of_match_ptr(tb10x_gpio_dt_ids), } };
drivers/gpio/gpio-tegra.c +1 -1
@@ -708,7 +708,7 @@ static struct platform_driver tegra_gpio_driver = { .driver = { .name = "tegra-gpio", .pm = &tegra_gpio_pm_ops, - .of_match_table = tegra_gpio_of_match, + .of_match_table = of_match_ptr(tegra_gpio_of_match), }, .probe = tegra_gpio_probe, };
drivers/gpio/gpio-tegra186.c +1 -1
@@ -910,7 +910,7 @@ MODULE_DEVICE_TABLE(of, tegra186_gpio_of_match);static struct platform_driver tegra186_gpio_driver = { .driver = { .name ="tegra186-gpio" , - .of_match_table = tegra186_gpio_of_match, + .of_match_table =of_match_ptr (tegra186_gpio_of_match), }, .probe = tegra186_gpio_probe, .remove = tegra186_gpio_remove,
drivers/gpio/gpio-tpic2810.c +1 -1
@@ -152,7 +152,7 @@ MODULE_DEVICE_TABLE(i2c, tpic2810_id_table);static struct i2c_driver tpic2810_driver = { .driver = { .name ="tpic2810" , - .of_match_table = tpic2810_of_match_table, + .of_match_table =of_match_ptr (tpic2810_of_match_table), }, .probe = tpic2810_probe, .remove = tpic2810_remove,
drivers/gpio/gpio-ts4800.c +1 -1
@@ -69,7 +69,7 @@ MODULE_DEVICE_TABLE(of, ts4800_gpio_of_match);static struct platform_driver ts4800_gpio_driver = { .driver = { .name ="ts4800-gpio" , - .of_match_table = ts4800_gpio_of_match, + .of_match_table =of_match_ptr (ts4800_gpio_of_match), }, .probe = ts4800_gpio_probe, };
drivers/gpio/gpio-ts4900.c +1 -1
@@ -176,7 +176,7 @@ MODULE_DEVICE_TABLE(i2c, ts4900_gpio_id_table);static struct i2c_driver ts4900_gpio_driver = { .driver = { .name ="ts4900-gpio" , - .of_match_table = ts4900_gpio_of_match_table, + .of_match_table =of_match_ptr (ts4900_gpio_of_match_table), }, .probe = ts4900_gpio_probe, .id_table = ts4900_gpio_id_table,
drivers/gpio/gpio-twl4030.c +1 -1
@@ -628,7 +628,7 @@ MODULE_ALIAS("platform:twl4030_gpio");static struct platform_driver gpio_twl4030_driver = { .driver = { .name ="twl4030_gpio" , - .of_match_table = twl_gpio_match, + .of_match_table =of_match_ptr (twl_gpio_match), }, .probe = gpio_twl4030_probe, .remove = gpio_twl4030_remove,
drivers/gpio/gpio-uniphier.c +1 -1
@@ -484,7 +484,7 @@ static struct platform_driver uniphier_gpio_driver = { .remove = uniphier_gpio_remove, .driver = { .name = "uniphier-gpio", - .of_match_table = uniphier_gpio_match, + .of_match_table = of_match_ptr(uniphier_gpio_match), .pm = &uniphier_gpio_pm_ops, }, };
drivers/gpio/gpio-vf610.c +1 -1
@@ -345,7 +345,7 @@ static int vf610_gpio_probe(struct platform_device *pdev)static struct platform_driver vf610_gpio_driver = { .driver = { .name ="gpio-vf610" , - .of_match_table = vf610_gpio_dt_ids, + .of_match_table =of_match_ptr (vf610_gpio_dt_ids), }, .probe = vf610_gpio_probe, };
drivers/gpio/gpio-wcd934x.c +1 -1
@@ -114,7 +114,7 @@ MODULE_DEVICE_TABLE(of, wcd_gpio_of_match);static struct platform_driver wcd_gpio_driver = { .driver = { .name ="wcd934x-gpio" , - .of_match_table = wcd_gpio_of_match, + .of_match_table =of_match_ptr (wcd_gpio_of_match), }, .probe = wcd_gpio_probe, };
drivers/gpio/gpio-xgene-sb.c +1 -1
@@ -324,7 +324,7 @@ MODULE_DEVICE_TABLE(acpi, xgene_gpio_sb_acpi_match);static struct platform_driver xgene_gpio_sb_driver = { .driver = { .name ="xgene-gpio-sb" , - .of_match_table = xgene_gpio_sb_of_match, + .of_match_table =of_match_ptr (xgene_gpio_sb_of_match), .acpi_match_table =ACPI_PTR (xgene_gpio_sb_acpi_match), }, .probe = xgene_gpio_sb_probe,
drivers/gpio/gpio-xgene.c +1 -1
@@ -209,7 +209,7 @@ static const struct acpi_device_id xgene_gpio_acpi_match[] = {static struct platform_driver xgene_gpio_driver = { .driver = { .name ="xgene-gpio" , - .of_match_table = xgene_gpio_of_match, + .of_match_table =of_match_ptr (xgene_gpio_of_match), .acpi_match_table =ACPI_PTR (xgene_gpio_acpi_match), .pm = &xgene_gpio_pm, },
drivers/gpio/gpio-xgs-iproc.c +1 -1
@@ -307,7 +307,7 @@ MODULE_DEVICE_TABLE(of, bcm_iproc_gpio_of_match);static struct platform_driver bcm_iproc_gpio_driver = { .driver = { .name ="iproc-xgs-gpio" , - .of_match_table = bcm_iproc_gpio_of_match, + .of_match_table =of_match_ptr (bcm_iproc_gpio_of_match), }, .probe = iproc_gpio_probe, .remove = iproc_gpio_remove,
drivers/gpio/gpio-xilinx.c +1 -1
@@ -356,7 +356,7 @@ static struct platform_driver xgpio_plat_driver = { .probe = xgpio_probe, .driver = { .name = "gpio-xilinx", - .of_match_table = xgpio_of_match, + .of_match_table = of_match_ptr(xgpio_of_match), }, };
drivers/gpio/gpio-xlp.c +1 -1
@@ -431,7 +431,7 @@ MODULE_DEVICE_TABLE(acpi, xlp_gpio_acpi_match);static struct platform_driver xlp_gpio_driver = { .driver = { .name ="xlp-gpio" , - .of_match_table = xlp_gpio_of_ids, + .of_match_table =of_match_ptr (xlp_gpio_of_ids), .acpi_match_table =ACPI_PTR (xlp_gpio_acpi_match), }, .probe = xlp_gpio_probe,
drivers/gpio/gpio-zevio.c +1 -1
@@ -208,7 +208,7 @@ static const struct of_device_id zevio_gpio_of_match[] = {static struct platform_driver zevio_gpio_driver = { .driver = { .name ="gpio-zevio" , - .of_match_table = zevio_gpio_of_match, + .of_match_table =of_match_ptr (zevio_gpio_of_match), .suppress_bind_attrs = true, }, .probe = zevio_gpio_probe,
drivers/gpio/gpio-zynq.c +1 -1
@@ -1014,7 +1014,7 @@ static struct platform_driver zynq_gpio_driver = { .driver = { .name = DRIVER_NAME, .pm = &zynq_gpio_dev_pm_ops, - .of_match_table = zynq_gpio_of_match, + .of_match_table = of_match_ptr(zynq_gpio_of_match), }, .probe = zynq_gpio_probe, .remove = zynq_gpio_remove,
Signature · 1 line
2.11.0
Quoted 10 lines · metux IT consult
The
of_match_ptr(foo)macro evaluates to foo, only ifCONFIG_OFis set, otherwise to NULL. Same doesACPI_PTRwithCONFIG_ACPI. That's very helpful for drivers that can be used with or without oftree / acpi.Even though most of the drivers touched here probably don't actually need that, it's also nice for consistency to make it the de-facto standard and change all drivers to use the
of_match_ptr()andACPI_PTR()macros.
Quoted 4 lines
A nice side effect: in some situations, when compiled w/o CONFIG_OF/CONFIG_ACPI, the corresponding match tables could automatically become unreferenced and optimized-away by the compiler, w/o explicitly cluttering the code w/ ifdef's.
Isn't this going to cause a lot of "defined but unused" warnings when built without OF support, for example?
Thierry
Quoted 11 lines · Thierry Reding
Quoted 10 lines · metux IT consult
The
of_match_ptr(foo)macro evaluates to foo, only ifCONFIG_OFis set, otherwise to NULL. Same doesACPI_PTRwithCONFIG_ACPI. That's very helpful for drivers that can be used with or without oftree / acpi.Even though most of the drivers touched here probably don't actually need that, it's also nice for consistency to make it the de-facto standard and change all drivers to use the
of_match_ptr()andACPI_PTR()macros.
Quoted 7 lines
Quoted 4 lines
A nice side effect: in some situations, when compiled w/o CONFIG_OF/CONFIG_ACPI, the corresponding match tables could automatically become unreferenced and optimized-away by the compiler, w/o explicitly cluttering the code w/ ifdef's.
Isn't this going to cause a lot of "defined but unused" warnings when built without OF support, for example?
Yes, it will.
It also looks like there are some whitespace changes in the patch, unless of course that's just Git playing tricks!
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Andy Shevchenko
NAKQuoted 11 lines · metux IT consult
The
of_match_ptr(foo)macro evaluates to foo, only ifCONFIG_OFis set, otherwise to NULL. Same doesACPI_PTRwithCONFIG_ACPI. That's very helpful for drivers that can be used with or without oftree / acpi.Even though most of the drivers touched here probably don't actually need that, it's also nice for consistency to make it the de-facto standard and change all drivers to use the
of_match_ptr()andACPI_PTR()macros.
Quoted 4 lines
A nice side effect: in some situations, when compiled w/o CONFIG_OF/CONFIG_ACPI, the corresponding match tables could automatically become unreferenced and optimized-away by the compiler, w/o explicitly cluttering the code w/ ifdef's.
NAK.
It prevents using DT-enabled drivers on ACPI based platforms.
+Cc: Jonathan who had done the opposite in the entire IIO subsystem.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 18 lines · Andy Shevchenko
Quoted 11 lines · metux IT consult
The
of_match_ptr(foo)macro evaluates to foo, only ifCONFIG_OFis set, otherwise to NULL. Same doesACPI_PTRwithCONFIG_ACPI. That's very helpful for drivers that can be used with or without oftree / acpi.Even though most of the drivers touched here probably don't actually need that, it's also nice for consistency to make it the de-facto standard and change all drivers to use the
of_match_ptr()andACPI_PTR()macros.Quoted 4 lines
A nice side effect: in some situations, when compiled w/o CONFIG_OF/CONFIG_ACPI, the corresponding match tables could automatically become unreferenced and optimized-away by the compiler, w/o explicitly cluttering the code w/ ifdef's.
Quoted 5 lines
NAK.
It prevents using DT-enabled drivers on ACPI based platforms.
+Cc: Jonathan who had done the opposite in the entire IIO subsystem.
And a side note: use of_match_ptr() and ACPI_PTR() in 99% is a mistake.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 13 lines · Andy Shevchenko
Quoted 11 lines · metux IT consult
The
of_match_ptr(foo)macro evaluates to foo, only ifCONFIG_OFis set, otherwise to NULL. Same doesACPI_PTRwithCONFIG_ACPI. That's very helpful for drivers that can be used with or without oftree / acpi.Even though most of the drivers touched here probably don't actually need that, it's also nice for consistency to make it the de-facto standard and change all drivers to use the
of_match_ptr()andACPI_PTR()macros.
Quoted 8 lines
Quoted 4 lines
A nice side effect: in some situations, when compiled w/o CONFIG_OF/CONFIG_ACPI, the corresponding match tables could automatically become unreferenced and optimized-away by the compiler, w/o explicitly cluttering the code w/ ifdef's.
NAK.
It prevents using DT-enabled drivers on ACPI based platforms.
So a system without CONFIG_OF might still make use of .of_match_table?
If so: TIL ...
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Quoted 19 lines · Uwe Kleine-König
Quoted 18 lines · Andy Shevchenko
Quoted 15 lines · metux IT consult
The
of_match_ptr(foo)macro evaluates to foo, only ifCONFIG_OFis set, otherwise to NULL. Same doesACPI_PTRwithCONFIG_ACPI. That's very helpful for drivers that can be used with or without oftree / acpi.Even though most of the drivers touched here probably don't actually need that, it's also nice for consistency to make it the de-facto standard and change all drivers to use the
of_match_ptr()andACPI_PTR()macros.A nice side effect: in some situations, when compiled w/o CONFIG_OF/CONFIG_ACPI, the corresponding match tables could automatically become unreferenced and optimized-away by the compiler, w/o explicitly cluttering the code w/ ifdef's.
Quoted 5 lines
Quoted 3 lines
NAK.
It prevents using DT-enabled drivers on ACPI based platforms.
So a system without
CONFIG_OFmight still make use of .of_match_table?
Yep!
Quoted 1 line
If so: TIL ...
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
Quoted 1 line · Uwe Kleine-König
On Tue, Nov 17, 2020 at 06:45:37PM +0200, Andy Shevchenko wrote:
...
Quoted 3 lines
Quoted 1 line
So a system without
CONFIG_OFmight still make use of .of_match_table?Yep!
If you are curious:
https://elixir.bootlin.com/linux/latest/source/drivers/acpi/bus.c#L615
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 6 lines · Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
Quoted 1 line · Uwe Kleine-König
On Tue, Nov 17, 2020 at 06:45:37PM +0200, Andy Shevchenko wrote:
Quoted 8 lines
...
Quoted 3 lines
Quoted 1 line
So a system without
CONFIG_OFmight still make use of .of_match_table?Yep!
If you are curious:
https://elixir.bootlin.com/linux/latest/source/drivers/acpi/bus.c#L615
This still doesn't sit quite well with me.
Not the process of ACPI using OF artifacts or the possibilty to embed OF type structures into ACPI tables, but the fact that an OF-only user (or so they think) should have to care about that special use-case.
What if we make ACPI select OF? Or handle the ACPI case explicitly in the of_match_ptr() declaration?
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Quoted 13 lines · Lee Jones
Quoted 12 lines · Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
Quoted 1 line · Uwe Kleine-König
On Tue, Nov 17, 2020 at 06:45:37PM +0200, Andy Shevchenko wrote:
...
Quoted 3 lines
Quoted 1 line
So a system without
CONFIG_OFmight still make use of .of_match_table?Yep!
Quoted 8 lines
Quoted 2 lines
If you are curious:
https://elixir.bootlin.com/linux/latest/source/drivers/acpi/bus.c#L615This still doesn't sit quite well with me.
Not the process of ACPI using OF artifacts or the possibilty to embed OF type structures into ACPI tables, but the fact that an OF-only user (or so they think) should have to care about that special use-case.
OF-only users shouldn't take care about this. If you are sure that the driver may not be used on a non-OF platform.
Quoted 2 lines
What if we make ACPI select OF? Or handle the ACPI case explicitly in the
of_match_ptr()declaration?
I guess you are a bit late, but you always may propose patches to ACPI maintainers.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 6 lines · Andy Shevchenko
Quoted 3 lines
Quoted 1 line
So a system without
CONFIG_OFmight still make use of .of_match_table?Yep!
If you are curious:
https://elixir.bootlin.com/linux/latest/source/drivers/acpi/bus.c#L615
Phuh, this changes everything ... sorry, didn't know that.
If ACPI now can contain OF pieces, we should ask the question whether of_match_ptr() should be used at all.
Would it be a compromise introducing a new macro (eg. "OF_MATCH_PTR()") which passes through the pointer if either OF or ACPI is enabled. Maybe we could introduce a new config item (eg "OF_MATCH_TABLE") for that, which is enabled by both OF and ACPI. And maybe add an option for of-compatible checking in ACPI.
How do you folks think about that ?
--mtx
Signature · 8 lines
--- Hinweis: unverschlüsselte E-Mails können leicht abgehört und manipuliert werden ! Für eine vertrauliche Kommunikation senden Sie bitte ihren GPG/PGP-Schlüssel zu. --- Enrico Weigelt, metux IT consult Free software and Linux embedded engineering [email protected] -- +49-151-27565287
kernel test robot
build botI love your patch! Perhaps something to improve:
Hi "Enrico,
I love your patch! Perhaps something to improve:
[auto build test WARNING on gpio/for-next]
[also build test WARNING on joel-aspeed/for-next v5.10-rc4 next-20201117] [cannot apply to xlnx/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Enrico-Weigelt-metux-IT-consult/drivers-gpio-use-of_match_ptr-and-ACPI_PTR-macros/20201117-234621 base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next config: x86_64-randconfig-a004-20201117 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ace9653c11c6308401dcda2e8b26bf97e6e66e30)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/36e4dc1edd4f6c7679f654c393616dafd4ffa73c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Enrico-Weigelt-metux-IT-consult/drivers-gpio-use-of_match_ptr-and-ACPI_PTR-macros/20201117-234621 git checkout 36e4dc1edd4f6c7679f654c393616dafd4ffa73c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/gpio/gpio-lp3943.c:208:34: warning: unused variable 'lp3943_gpio_of_match' [-Wunused-const-variable]
static const struct of_device_id lp3943_gpio_of_match[] = {
^
1 warning generated.
--
>> drivers/gpio/gpio-pca953x.c:1236:34: warning: unused variable 'pca953x_dt_ids' [-Wunused-const-variable]
static const struct of_device_id pca953x_dt_ids[] = {
^
1 warning generated.
--
>> drivers/gpio/gpio-tpic2810.c:103:34: warning: unused variable 'tpic2810_of_match_table' [-Wunused-const-variable]
static const struct of_device_id tpic2810_of_match_table[] = {
^
1 warning generated.
--
>> drivers/gpio/gpio-twl4030.c:619:34: warning: unused variable 'twl_gpio_match' [-Wunused-const-variable]
static const struct of_device_id twl_gpio_match[] = {
^
1 warning generated.
--
>> drivers/gpio/gpio-xilinx.c:348:34: warning: unused variable 'xgpio_of_match' [-Wunused-const-variable]
static const struct of_device_id xgpio_of_match[] = {
^1 warning generated.
vim +/lp3943_gpio_of_match +208 drivers/gpio/gpio-lp3943.c
0cc59b9d98d5541 Milo Kim 2013-12-06 207
0cc59b9d98d5541 Milo Kim 2013-12-06 @208 static const struct of_device_id lp3943_gpio_of_match[] = {
0cc59b9d98d5541 Milo Kim 2013-12-06 209 { .compatible = "ti,lp3943-gpio", },
0cc59b9d98d5541 Milo Kim 2013-12-06 210 { }
0cc59b9d98d5541 Milo Kim 2013-12-06 211 };
0cc59b9d98d5541 Milo Kim 2013-12-06 212 MODULE_DEVICE_TABLE(of, lp3943_gpio_of_match);0cc59b9d98d5541 Milo Kim 2013-12-06 213
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botI love your patch! Perhaps something to improve:
Hi "Enrico,
I love your patch! Perhaps something to improve:
[auto build test WARNING on gpio/for-next]
[also build test WARNING on joel-aspeed/for-next v5.10-rc4 next-20201117] [cannot apply to xlnx/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Enrico-Weigelt-metux-IT-consult/drivers-gpio-use-of_match_ptr-and-ACPI_PTR-macros/20201117-234621 base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next config: x86_64-randconfig-r032-20201117 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ace9653c11c6308401dcda2e8b26bf97e6e66e30)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/36e4dc1edd4f6c7679f654c393616dafd4ffa73c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Enrico-Weigelt-metux-IT-consult/drivers-gpio-use-of_match_ptr-and-ACPI_PTR-macros/20201117-234621 git checkout 36e4dc1edd4f6c7679f654c393616dafd4ffa73c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/gpio/gpio-palmas.c:137:34: warning: unused variable 'of_palmas_gpio_match' [-Wunused-const-variable]
static const struct of_device_id of_palmas_gpio_match[] = {
^
1 warning generated.
--
>> drivers/gpio/gpio-pca9570.c:128:34: warning: unused variable 'pca9570_of_match_table' [-Wunused-const-variable]
static const struct of_device_id pca9570_of_match_table[] = {
^
1 warning generated.
--
>> drivers/gpio/gpio-pisosr.c:183:34: warning: unused variable 'pisosr_gpio_of_match_table' [-Wunused-const-variable]
static const struct of_device_id pisosr_gpio_of_match_table[] = {
^1 warning generated.
vim +/of_palmas_gpio_match +137 drivers/gpio/gpio-palmas.c
ca6af7b96ab6213 Laxman Dewangan 2013-09-03 136
722782fee83b716 Jingoo Han 2014-05-07 @137 static const struct of_device_id of_palmas_gpio_match[] = {
ca6af7b96ab6213 Laxman Dewangan 2013-09-03 138 { .compatible = "ti,palmas-gpio", .data = &palmas_dev_data,},
ca6af7b96ab6213 Laxman Dewangan 2013-09-03 139 { .compatible = "ti,tps65913-gpio", .data = &palmas_dev_data,},
ca6af7b96ab6213 Laxman Dewangan 2013-09-03 140 { .compatible = "ti,tps65914-gpio", .data = &palmas_dev_data,},
ca6af7b96ab6213 Laxman Dewangan 2013-09-03 141 { .compatible = "ti,tps80036-gpio", .data = &tps80036_dev_data,},
ca6af7b96ab6213 Laxman Dewangan 2013-09-03 142 { },
ca6af7b96ab6213 Laxman Dewangan 2013-09-03 143 };ca6af7b96ab6213 Laxman Dewangan 2013-09-03 144
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org