Thread (13 messages) 13 messages, 2 authors, 2023-03-21
STALE1208d
Revisions (5)
  1. v1 [diff vs current]
  2. v2 current
  3. v3 [diff vs current]
  4. v4 [diff vs current]
  5. v5 [diff vs current]

[PATCH v2 1/4] pinctrl: s32: use of_device_get_match_data() to get device data

From: Chester Lin <hidden>
Date: 2023-03-20 16:46:24
Also in: linux-gpio, lkml
Subsystem: arm/nxp s32g architecture, pin control subsystem, pin controller - freescale, the rest · Maintainers: Linus Walleij, Dong Aisheng, Fabio Estevam, Frank Li, Jacky Bai, Linus Torvalds

Instead of relying on of_match_device(), using of_device_get_match_data()
can simplify implementation and avoid code duplication.

Signed-off-by: Chester Lin <redacted>
---
(An initial version since v2)

 drivers/pinctrl/nxp/pinctrl-s32g2.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/nxp/pinctrl-s32g2.c b/drivers/pinctrl/nxp/pinctrl-s32g2.c
index 5028f4adc389..f99f88615ef6 100644
--- a/drivers/pinctrl/nxp/pinctrl-s32g2.c
+++ b/drivers/pinctrl/nxp/pinctrl-s32g2.c
@@ -740,14 +740,12 @@ MODULE_DEVICE_TABLE(of, s32_pinctrl_of_match);
 
 static int s32g_pinctrl_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *of_id =
-		of_match_device(s32_pinctrl_of_match, &pdev->dev);
+	struct s32_pinctrl_soc_info *soc_info;
 
-	if (!of_id)
-		return -ENODEV;
+	soc_info = (struct s32_pinctrl_soc_info *)
+			of_device_get_match_data(&pdev->dev);
 
-	return s32_pinctrl_probe
-			(pdev, (struct s32_pinctrl_soc_info *) of_id->data);
+	return s32_pinctrl_probe(pdev, soc_info);
 }
 
 static const struct dev_pm_ops s32g_pinctrl_pm_ops = {
-- 
2.37.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help