Skip to contentSkip to conversation

nvmem: imx-iim: Use of_device_get_match_data()

PATCH Applied Fabio Estevam 2 participants 2 messages Nov 28, 2020 – Jan 5, 2021

Subsystems (2)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/1 nvmem: imx-iim: Use of_device_get_match_data()

The retrieval of driver data via of_device_get_match_data() can make the code simpler.

Use of_device_get_match_data() to simplify the code.

---
 drivers/nvmem/imx-iim.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/nvmem/imx-iim.c +1 -6
index 701704b87dc9..c86339a7f583 100644
@@ -96,7 +96,6 @@ MODULE_DEVICE_TABLE(of, imx_iim_dt_ids);
 
 static int imx_iim_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *of_id;
 	struct device *dev = &pdev->dev;
 	struct iim_priv *iim;
 	struct nvmem_device *nvmem;
@@ -111,11 +110,7 @@ static int imx_iim_probe(struct platform_device *pdev)
 	if (IS_ERR(iim->base))
 		return PTR_ERR(iim->base);
 
-	of_id = of_match_device(imx_iim_dt_ids, dev);
-	if (!of_id)
-		return -ENODEV;
-
-	drvdata = of_id->data;
+	drvdata = of_device_get_match_data(&pdev->dev);
 
 	iim->clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(iim->clk))
Signature · 7 lines
2.17.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw
Quoted 6 lines · Fabio Estevam

The retrieval of driver data via of_device_get_match_data() can make the code simpler.

Use of_device_get_match_data() to simplify the code.

Applied, thanks

--srini

Quoted 20 lines
---
  drivers/nvmem/imx-iim.c | 7 +------
  1 file changed, 1 insertion(+), 6 deletions(-)
drivers/nvmem/imx-iim.c +0 -1
index 701704b87dc9..c86339a7f583 100644
@@ -96,7 +96,6 @@ MODULE_DEVICE_TABLE(of, imx_iim_dt_ids);
 
  static int imx_iim_probe(struct platform_device *pdev)
  {
-	const struct of_device_id *of_id;
  	struct device *dev = &pdev->dev;
  	struct iim_priv *iim;
  	struct nvmem_device *nvmem;
@@ -111,11 +110,7 @@ static int imx_iim_probe(struct platform_device *pdev)
  	if (IS_ERR(iim->base))
  		return PTR_ERR(iim->base);

drivers/nvmem/imx-iim.c static int imx_iim_probe(struct platform_device *pdev) · line 116

Quoted 10 lines
drivers/nvmem/imx-iim.c +1 -5
 
-	of_id = of_match_device(imx_iim_dt_ids, dev);
-	if (!of_id)
-		return -ENODEV;
-
-	drvdata = of_id->data;
+	drvdata = of_device_get_match_data(&pdev->dev);
 
  	iim->clk = devm_clk_get(dev, NULL);
  	if (IS_ERR(iim->clk))

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel