[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230323144833.28562-2-clin@suse.com>
Date: Thu, 23 Mar 2023 22:48:28 +0800
From: Chester Lin <clin@...e.com>
To: Linus Walleij <linus.walleij@...aro.org>,
Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Chester Lin <clin@...e.com>, NXP S32 Linux Team <s32@....com>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
Ghennadi Procopciuc <Ghennadi.Procopciuc@....nxp.com>,
Andrei Stefanescu <andrei.stefanescu@....com>,
Radu Pirea <radu-nicolae.pirea@....com>,
Andreas Färber <afaerber@...e.de>,
Matthias Brugger <mbrugger@...e.com>
Subject: [PATCH v3 1/6] pinctrl: s32g2: use of_device_get_match_data() to get device data
Choose of_device_get_match_data() instead of indirect reference via
of_match_device() so that the implementation can be more concise.
Suggested-by: Andy Shevchenko <andy.shevchenko@...il.com>
Signed-off-by: Chester Lin <clin@...e.com>
---
Changes in v3:
- Declare the struct var 'info' as const and remove unnecessary type casting.
drivers/pinctrl/nxp/pinctrl-s32g2.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/nxp/pinctrl-s32g2.c b/drivers/pinctrl/nxp/pinctrl-s32g2.c
index 5028f4adc389..0e2d93681769 100644
--- a/drivers/pinctrl/nxp/pinctrl-s32g2.c
+++ b/drivers/pinctrl/nxp/pinctrl-s32g2.c
@@ -740,14 +740,11 @@ 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);
+ const struct s32_pinctrl_soc_info *info;
- if (!of_id)
- return -ENODEV;
+ 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, info);
}
static const struct dev_pm_ops s32g_pinctrl_pm_ops = {
--
2.37.3
Powered by blists - more mailing lists