All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] drivers: use of_match_ptr to avoid references when OF_PLATDATA is used
@ 2020-07-29 16:17 Walter Lozano
  2020-07-29 16:17 ` [PATCH 1/2] core: improve of_match_ptr with OF_PLATDATA Walter Lozano
  2020-07-29 16:17 ` [PATCH 2/2] drivers: use of_match_ptr to avoid references when OF_PLATDATA is used Walter Lozano
  0 siblings, 2 replies; 5+ messages in thread
From: Walter Lozano @ 2020-07-29 16:17 UTC (permalink / raw)
  To: u-boot

In order to save extra bytes when OF_PLATDATA is enabled avoid
referencing compatible strings and additional functions by extending
the use of of_match_ptr taking into account this configuration.


Walter Lozano (2):
  core: improve of_match_ptr with OF_PLATDATA
  drivers: use of_match_ptr to avoid references when OF_PLATDATA is used

 drivers/clk/clk_fixed_factor.c            | 2 +-
 drivers/clk/clk_fixed_rate.c              | 2 +-
 drivers/clk/rockchip/clk_px30.c           | 4 ++--
 drivers/clk/rockchip/clk_rk3188.c         | 2 +-
 drivers/clk/rockchip/clk_rk3288.c         | 2 +-
 drivers/clk/rockchip/clk_rk3308.c         | 2 +-
 drivers/clk/rockchip/clk_rk3368.c         | 2 +-
 drivers/clk/rockchip/clk_rk3399.c         | 4 ++--
 drivers/core/simple-bus.c                 | 2 +-
 drivers/core/syscon-uclass.c              | 2 +-
 drivers/gpio/mxs_gpio.c                   | 6 ++----
 drivers/mmc/ftsdc010_mci.c                | 2 +-
 drivers/mmc/mxsmmc.c                      | 6 ++----
 drivers/mmc/rockchip_dw_mmc.c             | 4 ++--
 drivers/mmc/rockchip_sdhci.c              | 2 +-
 drivers/pinctrl/intel/pinctrl_apl.c       | 2 +-
 drivers/pinctrl/rockchip/pinctrl-px30.c   | 2 +-
 drivers/pinctrl/rockchip/pinctrl-rk3328.c | 2 +-
 drivers/pinctrl/rockchip/pinctrl-rk3399.c | 2 +-
 drivers/ram/rockchip/dmc-rk3368.c         | 2 +-
 drivers/ram/rockchip/sdram_rk3188.c       | 2 +-
 drivers/ram/rockchip/sdram_rk322x.c       | 2 +-
 drivers/ram/rockchip/sdram_rk3288.c       | 2 +-
 drivers/ram/rockchip/sdram_rk3328.c       | 2 +-
 drivers/ram/rockchip/sdram_rk3399.c       | 2 +-
 drivers/spi/ich.c                         | 2 +-
 drivers/spi/mxs_spi.c                     | 6 ++----
 drivers/spi/rk_spi.c                      | 2 +-
 drivers/timer/rockchip_timer.c            | 2 +-
 include/dm/device.h                       | 2 +-
 30 files changed, 36 insertions(+), 42 deletions(-)

-- 
2.20.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] core: improve of_match_ptr with OF_PLATDATA
  2020-07-29 16:17 [PATCH 0/2] drivers: use of_match_ptr to avoid references when OF_PLATDATA is used Walter Lozano
@ 2020-07-29 16:17 ` Walter Lozano
  2020-08-07 16:23   ` Simon Glass
  2020-09-05 21:10   ` Simon Glass
  2020-07-29 16:17 ` [PATCH 2/2] drivers: use of_match_ptr to avoid references when OF_PLATDATA is used Walter Lozano
  1 sibling, 2 replies; 5+ messages in thread
From: Walter Lozano @ 2020-07-29 16:17 UTC (permalink / raw)
  To: u-boot

Currently of_match_ptr is used to avoid referencing compatible strings
when OF_CONTROL is not enabled. This behaviour could be improved by
taking into account also OF_PLATDATA, as when this configuration is
enabled the compatible strings are not used at all.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---

 include/dm/device.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/dm/device.h b/include/dm/device.h
index 953706cf52..ac3b6c1b8a 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -197,7 +197,7 @@ struct udevice_id {
 	ulong data;
 };
 
-#if CONFIG_IS_ENABLED(OF_CONTROL)
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 #define of_match_ptr(_ptr)	(_ptr)
 #else
 #define of_match_ptr(_ptr)	NULL
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] drivers: use of_match_ptr to avoid references when OF_PLATDATA is used
  2020-07-29 16:17 [PATCH 0/2] drivers: use of_match_ptr to avoid references when OF_PLATDATA is used Walter Lozano
  2020-07-29 16:17 ` [PATCH 1/2] core: improve of_match_ptr with OF_PLATDATA Walter Lozano
@ 2020-07-29 16:17 ` Walter Lozano
  1 sibling, 0 replies; 5+ messages in thread
From: Walter Lozano @ 2020-07-29 16:17 UTC (permalink / raw)
  To: u-boot

As when OF_PLATDATA is used compatible strings are not used at all
remove their reference to save extra bytes. Also in the cases where this
was done with #define change to of_match_ptr to improve readability.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---

 drivers/clk/clk_fixed_factor.c            | 2 +-
 drivers/clk/clk_fixed_rate.c              | 2 +-
 drivers/clk/rockchip/clk_px30.c           | 4 ++--
 drivers/clk/rockchip/clk_rk3188.c         | 2 +-
 drivers/clk/rockchip/clk_rk3288.c         | 2 +-
 drivers/clk/rockchip/clk_rk3308.c         | 2 +-
 drivers/clk/rockchip/clk_rk3368.c         | 2 +-
 drivers/clk/rockchip/clk_rk3399.c         | 4 ++--
 drivers/core/simple-bus.c                 | 2 +-
 drivers/core/syscon-uclass.c              | 2 +-
 drivers/gpio/mxs_gpio.c                   | 6 ++----
 drivers/mmc/ftsdc010_mci.c                | 2 +-
 drivers/mmc/mxsmmc.c                      | 6 ++----
 drivers/mmc/rockchip_dw_mmc.c             | 4 ++--
 drivers/mmc/rockchip_sdhci.c              | 2 +-
 drivers/pinctrl/intel/pinctrl_apl.c       | 2 +-
 drivers/pinctrl/rockchip/pinctrl-px30.c   | 2 +-
 drivers/pinctrl/rockchip/pinctrl-rk3328.c | 2 +-
 drivers/pinctrl/rockchip/pinctrl-rk3399.c | 2 +-
 drivers/ram/rockchip/dmc-rk3368.c         | 2 +-
 drivers/ram/rockchip/sdram_rk3188.c       | 2 +-
 drivers/ram/rockchip/sdram_rk322x.c       | 2 +-
 drivers/ram/rockchip/sdram_rk3288.c       | 2 +-
 drivers/ram/rockchip/sdram_rk3328.c       | 2 +-
 drivers/ram/rockchip/sdram_rk3399.c       | 2 +-
 drivers/spi/ich.c                         | 2 +-
 drivers/spi/mxs_spi.c                     | 6 ++----
 drivers/spi/rk_spi.c                      | 2 +-
 drivers/timer/rockchip_timer.c            | 2 +-
 29 files changed, 35 insertions(+), 41 deletions(-)

diff --git a/drivers/clk/clk_fixed_factor.c b/drivers/clk/clk_fixed_factor.c
index cf9c4ae367..f4171464f6 100644
--- a/drivers/clk/clk_fixed_factor.c
+++ b/drivers/clk/clk_fixed_factor.c
@@ -65,7 +65,7 @@ static const struct udevice_id clk_fixed_factor_match[] = {
 U_BOOT_DRIVER(clk_fixed_factor) = {
 	.name = "fixed_factor_clock",
 	.id = UCLASS_CLK,
-	.of_match = clk_fixed_factor_match,
+	.of_match = of_match_ptr(clk_fixed_factor_match),
 	.ofdata_to_platdata = clk_fixed_factor_ofdata_to_platdata,
 	.platdata_auto_alloc_size = sizeof(struct clk_fixed_factor),
 	.ops = &clk_fixed_factor_ops,
diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/clk_fixed_rate.c
index 2c20eddb0b..cfffb18553 100644
--- a/drivers/clk/clk_fixed_rate.c
+++ b/drivers/clk/clk_fixed_rate.c
@@ -49,7 +49,7 @@ static const struct udevice_id clk_fixed_rate_match[] = {
 U_BOOT_DRIVER(clk_fixed_rate) = {
 	.name = "fixed_rate_clock",
 	.id = UCLASS_CLK,
-	.of_match = clk_fixed_rate_match,
+	.of_match = of_match_ptr(clk_fixed_rate_match),
 	.ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata,
 	.platdata_auto_alloc_size = sizeof(struct clk_fixed_rate),
 	.ops = &clk_fixed_rate_ops,
diff --git a/drivers/clk/rockchip/clk_px30.c b/drivers/clk/rockchip/clk_px30.c
index 71916dbf3b..014ff51bad 100644
--- a/drivers/clk/rockchip/clk_px30.c
+++ b/drivers/clk/rockchip/clk_px30.c
@@ -1479,7 +1479,7 @@ static const struct udevice_id px30_clk_ids[] = {
 U_BOOT_DRIVER(rockchip_px30_cru) = {
 	.name		= "rockchip_px30_cru",
 	.id		= UCLASS_CLK,
-	.of_match	= px30_clk_ids,
+	.of_match	= of_match_ptr(px30_clk_ids),
 	.priv_auto_alloc_size = sizeof(struct px30_clk_priv),
 	.ofdata_to_platdata = px30_clk_ofdata_to_platdata,
 	.ops		= &px30_clk_ops,
@@ -1626,7 +1626,7 @@ static const struct udevice_id px30_pmuclk_ids[] = {
 U_BOOT_DRIVER(rockchip_px30_pmucru) = {
 	.name		= "rockchip_px30_pmucru",
 	.id		= UCLASS_CLK,
-	.of_match	= px30_pmuclk_ids,
+	.of_match	= of_match_ptr(px30_pmuclk_ids),
 	.priv_auto_alloc_size = sizeof(struct px30_pmuclk_priv),
 	.ofdata_to_platdata = px30_pmuclk_ofdata_to_platdata,
 	.ops		= &px30_pmuclk_ops,
diff --git a/drivers/clk/rockchip/clk_rk3188.c b/drivers/clk/rockchip/clk_rk3188.c
index aacc8cf2d1..3c9049ad67 100644
--- a/drivers/clk/rockchip/clk_rk3188.c
+++ b/drivers/clk/rockchip/clk_rk3188.c
@@ -615,7 +615,7 @@ static const struct udevice_id rk3188_clk_ids[] = {
 U_BOOT_DRIVER(rockchip_rk3188_cru) = {
 	.name			= "rockchip_rk3188_cru",
 	.id			= UCLASS_CLK,
-	.of_match		= rk3188_clk_ids,
+	.of_match		= of_match_ptr(rk3188_clk_ids),
 	.priv_auto_alloc_size	= sizeof(struct rk3188_clk_priv),
 	.platdata_auto_alloc_size = sizeof(struct rk3188_clk_plat),
 	.ops			= &rk3188_clk_ops,
diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c
index a1dd642eef..6914c31e66 100644
--- a/drivers/clk/rockchip/clk_rk3288.c
+++ b/drivers/clk/rockchip/clk_rk3288.c
@@ -1039,7 +1039,7 @@ static const struct udevice_id rk3288_clk_ids[] = {
 U_BOOT_DRIVER(rockchip_rk3288_cru) = {
 	.name		= "rockchip_rk3288_cru",
 	.id		= UCLASS_CLK,
-	.of_match	= rk3288_clk_ids,
+	.of_match	= of_match_ptr(rk3288_clk_ids),
 	.priv_auto_alloc_size = sizeof(struct rk3288_clk_priv),
 	.platdata_auto_alloc_size = sizeof(struct rk3288_clk_plat),
 	.ops		= &rk3288_clk_ops,
diff --git a/drivers/clk/rockchip/clk_rk3308.c b/drivers/clk/rockchip/clk_rk3308.c
index d3633b6979..2cfd7b9bd2 100644
--- a/drivers/clk/rockchip/clk_rk3308.c
+++ b/drivers/clk/rockchip/clk_rk3308.c
@@ -1066,7 +1066,7 @@ static const struct udevice_id rk3308_clk_ids[] = {
 U_BOOT_DRIVER(rockchip_rk3308_cru) = {
 	.name		= "rockchip_rk3308_cru",
 	.id		= UCLASS_CLK,
-	.of_match	= rk3308_clk_ids,
+	.of_match	= of_match_ptr(rk3308_clk_ids),
 	.priv_auto_alloc_size = sizeof(struct rk3308_clk_priv),
 	.ofdata_to_platdata = rk3308_clk_ofdata_to_platdata,
 	.ops		= &rk3308_clk_ops,
diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c
index d1804c6e16..c209153780 100644
--- a/drivers/clk/rockchip/clk_rk3368.c
+++ b/drivers/clk/rockchip/clk_rk3368.c
@@ -642,7 +642,7 @@ static const struct udevice_id rk3368_clk_ids[] = {
 U_BOOT_DRIVER(rockchip_rk3368_cru) = {
 	.name		= "rockchip_rk3368_cru",
 	.id		= UCLASS_CLK,
-	.of_match	= rk3368_clk_ids,
+	.of_match	= of_match_ptr(rk3368_clk_ids),
 	.priv_auto_alloc_size = sizeof(struct rk3368_clk_priv),
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
 	.platdata_auto_alloc_size = sizeof(struct rk3368_clk_plat),
diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c
index 22c373a623..58cf2ca047 100644
--- a/drivers/clk/rockchip/clk_rk3399.c
+++ b/drivers/clk/rockchip/clk_rk3399.c
@@ -1417,7 +1417,7 @@ static const struct udevice_id rk3399_clk_ids[] = {
 U_BOOT_DRIVER(clk_rk3399) = {
 	.name		= "rockchip_rk3399_cru",
 	.id		= UCLASS_CLK,
-	.of_match	= rk3399_clk_ids,
+	.of_match	= of_match_ptr(rk3399_clk_ids),
 	.priv_auto_alloc_size = sizeof(struct rk3399_clk_priv),
 	.ofdata_to_platdata = rk3399_clk_ofdata_to_platdata,
 	.ops		= &rk3399_clk_ops,
@@ -1611,7 +1611,7 @@ static const struct udevice_id rk3399_pmuclk_ids[] = {
 U_BOOT_DRIVER(rockchip_rk3399_pmuclk) = {
 	.name		= "rockchip_rk3399_pmucru",
 	.id		= UCLASS_CLK,
-	.of_match	= rk3399_pmuclk_ids,
+	.of_match	= of_match_ptr(rk3399_pmuclk_ids),
 	.priv_auto_alloc_size = sizeof(struct rk3399_pmuclk_priv),
 	.ofdata_to_platdata = rk3399_pmuclk_ofdata_to_platdata,
 	.ops		= &rk3399_pmuclk_ops,
diff --git a/drivers/core/simple-bus.c b/drivers/core/simple-bus.c
index 7cc1d46009..2daa62da26 100644
--- a/drivers/core/simple-bus.c
+++ b/drivers/core/simple-bus.c
@@ -59,6 +59,6 @@ static const struct udevice_id generic_simple_bus_ids[] = {
 U_BOOT_DRIVER(simple_bus) = {
 	.name	= "simple_bus",
 	.id	= UCLASS_SIMPLE_BUS,
-	.of_match = generic_simple_bus_ids,
+	.of_match = of_match_ptr(generic_simple_bus_ids),
 	.flags	= DM_FLAG_PRE_RELOC,
 };
diff --git a/drivers/core/syscon-uclass.c b/drivers/core/syscon-uclass.c
index b5cd763b6b..71b1b3b7a1 100644
--- a/drivers/core/syscon-uclass.c
+++ b/drivers/core/syscon-uclass.c
@@ -183,7 +183,7 @@ U_BOOT_DRIVER(generic_syscon) = {
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
 	.bind           = dm_scan_fdt_dev,
 #endif
-	.of_match = generic_syscon_ids,
+	.of_match = of_match_ptr(generic_syscon_ids),
 };
 
 /*
diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c
index aaabb0216b..1ec8b12276 100644
--- a/drivers/gpio/mxs_gpio.c
+++ b/drivers/gpio/mxs_gpio.c
@@ -300,10 +300,8 @@ U_BOOT_DRIVER(fsl_imx23_gpio) = {
 	.probe	= mxs_gpio_probe,
 	.priv_auto_alloc_size = sizeof(struct mxs_gpio_priv),
 	.platdata_auto_alloc_size = sizeof(struct mxs_gpio_platdata),
-#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
-	.of_match = mxs_gpio_ids,
-	.ofdata_to_platdata = mxs_ofdata_to_platdata,
-#endif
+	.of_match = of_match_ptr(mxs_gpio_ids),
+	.ofdata_to_platdata = of_match_ptr(mxs_ofdata_to_platdata),
 };
 
 U_BOOT_DRIVER_ALIAS(fsl_imx23_gpio, fsl_imx28_gpio)
diff --git a/drivers/mmc/ftsdc010_mci.c b/drivers/mmc/ftsdc010_mci.c
index bc0d5ffed5..344eaa606d 100644
--- a/drivers/mmc/ftsdc010_mci.c
+++ b/drivers/mmc/ftsdc010_mci.c
@@ -472,7 +472,7 @@ static const struct udevice_id ftsdc010_mmc_ids[] = {
 U_BOOT_DRIVER(ftsdc010_mmc) = {
 	.name		= "ftsdc010_mmc",
 	.id		= UCLASS_MMC,
-	.of_match	= ftsdc010_mmc_ids,
+	.of_match	= of_match_ptr(ftsdc010_mmc_ids),
 	.ofdata_to_platdata = ftsdc010_mmc_ofdata_to_platdata,
 	.ops		= &dm_ftsdc010_mmc_ops,
 	.bind		= ftsdc010_mmc_bind,
diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c
index 2b3a3a992c..63c2e836fd 100644
--- a/drivers/mmc/mxsmmc.c
+++ b/drivers/mmc/mxsmmc.c
@@ -709,10 +709,8 @@ static const struct udevice_id mxsmmc_ids[] = {
 U_BOOT_DRIVER(fsl_imx23_mmc) = {
 	.name = "fsl_imx23_mmc",
 	.id	= UCLASS_MMC,
-#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
-	.of_match = mxsmmc_ids,
-	.ofdata_to_platdata = mxsmmc_ofdata_to_platdata,
-#endif
+	.of_match = of_match_ptr(mxsmmc_ids),
+	.ofdata_to_platdata = of_match_ptr(mxsmmc_ofdata_to_platdata),
 	.ops	= &mxsmmc_ops,
 #if CONFIG_IS_ENABLED(BLK)
 	.bind	= mxsmmc_bind,
diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c
index f1dafa6ce7..5076ac3fed 100644
--- a/drivers/mmc/rockchip_dw_mmc.c
+++ b/drivers/mmc/rockchip_dw_mmc.c
@@ -171,7 +171,7 @@ static const struct udevice_id rockchip_dwmmc_ids[] = {
 U_BOOT_DRIVER(rockchip_rk3288_dw_mshc) = {
 	.name		= "rockchip_rk3288_dw_mshc",
 	.id		= UCLASS_MMC,
-	.of_match	= rockchip_dwmmc_ids,
+	.of_match	= of_match_ptr(rockchip_dwmmc_ids),
 	.ofdata_to_platdata = rockchip_dwmmc_ofdata_to_platdata,
 	.ops		= &dm_dwmci_ops,
 	.bind		= rockchip_dwmmc_bind,
@@ -212,7 +212,7 @@ static const struct udevice_id rockchip_dwmmc_pwrseq_ids[] = {
 U_BOOT_DRIVER(rockchip_dwmmc_pwrseq_drv) = {
 	.name		= "mmc_pwrseq_emmc",
 	.id		= UCLASS_PWRSEQ,
-	.of_match	= rockchip_dwmmc_pwrseq_ids,
+	.of_match	= of_match_ptr(rockchip_dwmmc_pwrseq_ids),
 	.ops		= &rockchip_dwmmc_pwrseq_ops,
 };
 #endif
diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c
index b073f1a08d..1dcb462c8a 100644
--- a/drivers/mmc/rockchip_sdhci.c
+++ b/drivers/mmc/rockchip_sdhci.c
@@ -109,7 +109,7 @@ static const struct udevice_id arasan_sdhci_ids[] = {
 U_BOOT_DRIVER(arasan_sdhci_drv) = {
 	.name		= "rockchip_rk3399_sdhci_5_1",
 	.id		= UCLASS_MMC,
-	.of_match	= arasan_sdhci_ids,
+	.of_match	= of_match_ptr(arasan_sdhci_ids),
 	.ofdata_to_platdata = arasan_sdhci_ofdata_to_platdata,
 	.ops		= &sdhci_ops,
 	.bind		= rockchip_sdhci_bind,
diff --git a/drivers/pinctrl/intel/pinctrl_apl.c b/drivers/pinctrl/intel/pinctrl_apl.c
index 7624a9974f..cbd0aabbfe 100644
--- a/drivers/pinctrl/intel/pinctrl_apl.c
+++ b/drivers/pinctrl/intel/pinctrl_apl.c
@@ -177,7 +177,7 @@ static const struct udevice_id apl_gpio_ids[] = {
 U_BOOT_DRIVER(apl_pinctrl_drv) = {
 	.name		= "intel_apl_pinctrl",
 	.id		= UCLASS_PINCTRL,
-	.of_match	= apl_gpio_ids,
+	.of_match	= of_match_ptr(apl_gpio_ids),
 	.probe		= intel_pinctrl_probe,
 	.ops		= &intel_pinctrl_ops,
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
diff --git a/drivers/pinctrl/rockchip/pinctrl-px30.c b/drivers/pinctrl/rockchip/pinctrl-px30.c
index 617721a626..b462d31e07 100644
--- a/drivers/pinctrl/rockchip/pinctrl-px30.c
+++ b/drivers/pinctrl/rockchip/pinctrl-px30.c
@@ -360,7 +360,7 @@ static const struct udevice_id px30_pinctrl_ids[] = {
 U_BOOT_DRIVER(pinctrl_px30) = {
 	.name		= "rockchip_px30_pinctrl",
 	.id		= UCLASS_PINCTRL,
-	.of_match	= px30_pinctrl_ids,
+	.of_match	= of_match_ptr(px30_pinctrl_ids),
 	.priv_auto_alloc_size = sizeof(struct rockchip_pinctrl_priv),
 	.ops		= &rockchip_pinctrl_ops,
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3328.c b/drivers/pinctrl/rockchip/pinctrl-rk3328.c
index 61eb9e0af0..428aeaceb9 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rk3328.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rk3328.c
@@ -320,7 +320,7 @@ static const struct udevice_id rk3328_pinctrl_ids[] = {
 U_BOOT_DRIVER(rockchip_rk3328_pinctrl) = {
 	.name		= "rockchip_rk3328_pinctrl",
 	.id		= UCLASS_PINCTRL,
-	.of_match	= rk3328_pinctrl_ids,
+	.of_match	= of_match_ptr(rk3328_pinctrl_ids),
 	.priv_auto_alloc_size = sizeof(struct rockchip_pinctrl_priv),
 	.ops		= &rockchip_pinctrl_ops,
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3399.c b/drivers/pinctrl/rockchip/pinctrl-rk3399.c
index d04c1afb09..7a718e6f09 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rk3399.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rk3399.c
@@ -314,7 +314,7 @@ static const struct udevice_id rk3399_pinctrl_ids[] = {
 U_BOOT_DRIVER(pinctrl_rk3399) = {
 	.name		= "rockchip_rk3399_pinctrl",
 	.id		= UCLASS_PINCTRL,
-	.of_match	= rk3399_pinctrl_ids,
+	.of_match	= of_match_ptr(rk3399_pinctrl_ids),
 	.priv_auto_alloc_size = sizeof(struct rockchip_pinctrl_priv),
 	.ops		= &rockchip_pinctrl_ops,
 #if !CONFIG_IS_ENABLED(OF_PLATDATA)
diff --git a/drivers/ram/rockchip/dmc-rk3368.c b/drivers/ram/rockchip/dmc-rk3368.c
index 4fa632152f..38d9507c2e 100644
--- a/drivers/ram/rockchip/dmc-rk3368.c
+++ b/drivers/ram/rockchip/dmc-rk3368.c
@@ -995,7 +995,7 @@ static const struct udevice_id rk3368_dmc_ids[] = {
 U_BOOT_DRIVER(rockchip_rk3368_dmc) = {
 	.name = "rockchip_rk3368_dmc",
 	.id = UCLASS_RAM,
-	.of_match = rk3368_dmc_ids,
+	.of_match = of_match_ptr(rk3368_dmc_ids),
 	.ops = &rk3368_dmc_ops,
 	.probe = rk3368_dmc_probe,
 	.priv_auto_alloc_size = sizeof(struct dram_info),
diff --git a/drivers/ram/rockchip/sdram_rk3188.c b/drivers/ram/rockchip/sdram_rk3188.c
index 06f9eba1a5..443425e1be 100644
--- a/drivers/ram/rockchip/sdram_rk3188.c
+++ b/drivers/ram/rockchip/sdram_rk3188.c
@@ -948,7 +948,7 @@ static const struct udevice_id rk3188_dmc_ids[] = {
 U_BOOT_DRIVER(rockchip_rk3188_dmc) = {
 	.name = "rockchip_rk3188_dmc",
 	.id = UCLASS_RAM,
-	.of_match = rk3188_dmc_ids,
+	.of_match = of_match_ptr(rk3188_dmc_ids),
 	.ops = &rk3188_dmc_ops,
 #ifdef CONFIG_SPL_BUILD
 	.ofdata_to_platdata = rk3188_dmc_ofdata_to_platdata,
diff --git a/drivers/ram/rockchip/sdram_rk322x.c b/drivers/ram/rockchip/sdram_rk322x.c
index 094693ce24..46b2ffa4e3 100644
--- a/drivers/ram/rockchip/sdram_rk322x.c
+++ b/drivers/ram/rockchip/sdram_rk322x.c
@@ -841,7 +841,7 @@ static const struct udevice_id rk322x_dmc_ids[] = {
 U_BOOT_DRIVER(dmc_rk322x) = {
 	.name = "rockchip_rk322x_dmc",
 	.id = UCLASS_RAM,
-	.of_match = rk322x_dmc_ids,
+	.of_match = of_match_ptr(rk322x_dmc_ids),
 	.ops = &rk322x_dmc_ops,
 #ifdef CONFIG_TPL_BUILD
 	.ofdata_to_platdata = rk322x_dmc_ofdata_to_platdata,
diff --git a/drivers/ram/rockchip/sdram_rk3288.c b/drivers/ram/rockchip/sdram_rk3288.c
index 26e8d059b5..1e781ec450 100644
--- a/drivers/ram/rockchip/sdram_rk3288.c
+++ b/drivers/ram/rockchip/sdram_rk3288.c
@@ -1116,7 +1116,7 @@ static const struct udevice_id rk3288_dmc_ids[] = {
 U_BOOT_DRIVER(rockchip_rk3288_dmc) = {
 	.name = "rockchip_rk3288_dmc",
 	.id = UCLASS_RAM,
-	.of_match = rk3288_dmc_ids,
+	.of_match = of_match_ptr(rk3288_dmc_ids),
 	.ops = &rk3288_dmc_ops,
 #if defined(CONFIG_TPL_BUILD) || \
 	(!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD))
diff --git a/drivers/ram/rockchip/sdram_rk3328.c b/drivers/ram/rockchip/sdram_rk3328.c
index 98c7feb6cf..651b91338f 100644
--- a/drivers/ram/rockchip/sdram_rk3328.c
+++ b/drivers/ram/rockchip/sdram_rk3328.c
@@ -609,7 +609,7 @@ static const struct udevice_id rk3328_dmc_ids[] = {
 U_BOOT_DRIVER(rockchip_rk3328_dmc) = {
 	.name = "rockchip_rk3328_dmc",
 	.id = UCLASS_RAM,
-	.of_match = rk3328_dmc_ids,
+	.of_match = of_match_ptr(rk3328_dmc_ids),
 	.ops = &rk3328_dmc_ops,
 #ifdef CONFIG_TPL_BUILD
 	.ofdata_to_platdata = rk3328_dmc_ofdata_to_platdata,
diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c
index 530c8a2f40..1eec2a3f4b 100644
--- a/drivers/ram/rockchip/sdram_rk3399.c
+++ b/drivers/ram/rockchip/sdram_rk3399.c
@@ -3171,7 +3171,7 @@ static const struct udevice_id rk3399_dmc_ids[] = {
 U_BOOT_DRIVER(dmc_rk3399) = {
 	.name = "rockchip_rk3399_dmc",
 	.id = UCLASS_RAM,
-	.of_match = rk3399_dmc_ids,
+	.of_match = of_match_ptr(rk3399_dmc_ids),
 	.ops = &rk3399_dmc_ops,
 #if defined(CONFIG_TPL_BUILD) || \
 	(!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD))
diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index e1336b89c5..0e54ae17e9 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -1000,7 +1000,7 @@ static const struct udevice_id ich_spi_ids[] = {
 U_BOOT_DRIVER(intel_fast_spi) = {
 	.name	= "intel_fast_spi",
 	.id	= UCLASS_SPI,
-	.of_match = ich_spi_ids,
+	.of_match = of_match_ptr(ich_spi_ids),
 	.ops	= &ich_spi_ops,
 	.ofdata_to_platdata = ich_spi_ofdata_to_platdata,
 	.platdata_auto_alloc_size = sizeof(struct ich_spi_platdata),
diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
index fb0af02be0..ef5a21a597 100644
--- a/drivers/spi/mxs_spi.c
+++ b/drivers/spi/mxs_spi.c
@@ -483,10 +483,8 @@ static const struct udevice_id mxs_spi_ids[] = {
 U_BOOT_DRIVER(fsl_imx23_spi) = {
 	.name = "fsl_imx23_spi",
 	.id	= UCLASS_SPI,
-#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
-	.of_match = mxs_spi_ids,
-	.ofdata_to_platdata = mxs_ofdata_to_platdata,
-#endif
+	.of_match = of_match_ptr(mxs_spi_ids),
+	.ofdata_to_platdata = of_match_ptr(mxs_ofdata_to_platdata),
 	.platdata_auto_alloc_size = sizeof(struct mxs_spi_platdata),
 	.ops	= &mxs_spi_ops,
 	.priv_auto_alloc_size = sizeof(struct mxs_spi_priv),
diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c
index c5363c2419..4a16495581 100644
--- a/drivers/spi/rk_spi.c
+++ b/drivers/spi/rk_spi.c
@@ -558,7 +558,7 @@ static const struct udevice_id rockchip_spi_ids[] = {
 U_BOOT_DRIVER(rockchip_rk3288_spi) = {
 	.name	= "rockchip_rk3288_spi",
 	.id	= UCLASS_SPI,
-	.of_match = rockchip_spi_ids,
+	.of_match = of_match_ptr(rockchip_spi_ids),
 	.ops	= &rockchip_spi_ops,
 	.ofdata_to_platdata = rockchip_spi_ofdata_to_platdata,
 	.platdata_auto_alloc_size = sizeof(struct rockchip_spi_platdata),
diff --git a/drivers/timer/rockchip_timer.c b/drivers/timer/rockchip_timer.c
index 7a5a484252..67f9593700 100644
--- a/drivers/timer/rockchip_timer.c
+++ b/drivers/timer/rockchip_timer.c
@@ -163,7 +163,7 @@ static const struct udevice_id rockchip_timer_ids[] = {
 U_BOOT_DRIVER(rockchip_rk3368_timer) = {
 	.name	= "rockchip_rk3368_timer",
 	.id	= UCLASS_TIMER,
-	.of_match = rockchip_timer_ids,
+	.of_match = of_match_ptr(rockchip_timer_ids),
 	.probe = rockchip_timer_probe,
 	.ops	= &rockchip_timer_ops,
 	.priv_auto_alloc_size = sizeof(struct rockchip_timer_priv),
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 1/2] core: improve of_match_ptr with OF_PLATDATA
  2020-07-29 16:17 ` [PATCH 1/2] core: improve of_match_ptr with OF_PLATDATA Walter Lozano
@ 2020-08-07 16:23   ` Simon Glass
  2020-09-05 21:10   ` Simon Glass
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Glass @ 2020-08-07 16:23 UTC (permalink / raw)
  To: u-boot

On Wed, 29 Jul 2020 at 10:17, Walter Lozano <walter.lozano@collabora.com> wrote:
>
> Currently of_match_ptr is used to avoid referencing compatible strings
> when OF_CONTROL is not enabled. This behaviour could be improved by
> taking into account also OF_PLATDATA, as when this configuration is
> enabled the compatible strings are not used at all.
>
> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
> ---
>
>  include/dm/device.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] core: improve of_match_ptr with OF_PLATDATA
  2020-07-29 16:17 ` [PATCH 1/2] core: improve of_match_ptr with OF_PLATDATA Walter Lozano
  2020-08-07 16:23   ` Simon Glass
@ 2020-09-05 21:10   ` Simon Glass
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Glass @ 2020-09-05 21:10 UTC (permalink / raw)
  To: u-boot

On Wed, 29 Jul 2020 at 10:17, Walter Lozano <walter.lozano@collabora.com> wrote:
>
> Currently of_match_ptr is used to avoid referencing compatible strings
> when OF_CONTROL is not enabled. This behaviour could be improved by
> taking into account also OF_PLATDATA, as when this configuration is
> enabled the compatible strings are not used at all.
>
> Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
> ---
>
>  include/dm/device.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-dm/next, thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-05 21:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 16:17 [PATCH 0/2] drivers: use of_match_ptr to avoid references when OF_PLATDATA is used Walter Lozano
2020-07-29 16:17 ` [PATCH 1/2] core: improve of_match_ptr with OF_PLATDATA Walter Lozano
2020-08-07 16:23   ` Simon Glass
2020-09-05 21:10   ` Simon Glass
2020-07-29 16:17 ` [PATCH 2/2] drivers: use of_match_ptr to avoid references when OF_PLATDATA is used Walter Lozano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.