mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 4/8] gpio: gpio-mxs: replace dev_get_drvdata with device_get_match_data
Date: Tue,  6 May 2025 08:34:42 +0200	[thread overview]
Message-ID: <20250506063446.3133582-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250506063446.3133582-1-a.fatoum@pengutronix.de>

In preparation for aligning dev_get_drvdata with Linux, use
device_get_match_data instead.
While at it, we drop the unneeded struct mxs_gpio_chip::regs member to
not have to worry about const safety.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/gpio/gpio-mxs.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
index 770acb61c858..df698eb19167 100644
--- a/drivers/gpio/gpio-mxs.c
+++ b/drivers/gpio/gpio-mxs.c
@@ -19,7 +19,6 @@ struct mxs_gpio_chip {
 	void __iomem *doe;
 	void __iomem *dout;
 	struct gpio_chip chip;
-	struct mxs_gpio_regs *regs;
 };
 
 struct mxs_gpio_regs {
@@ -101,12 +100,12 @@ static struct gpio_ops mxs_gpio_ops = {
 static int mxs_gpio_probe(struct device *dev)
 {
 	struct mxs_gpio_chip *mxsgpio;
-	struct mxs_gpio_regs *regs;
-	int ret, id;
+	const struct mxs_gpio_regs *regs;
+	int id;
 
-	ret = dev_get_drvdata(dev, (const void **)&regs);
-	if (ret)
-		return ret;
+	regs = device_get_match_data(dev);
+	if (!regs)
+		return -ENODEV;
 
 	mxsgpio = xzalloc(sizeof(*mxsgpio));
 	mxsgpio->chip.ops = &mxs_gpio_ops;
@@ -131,7 +130,6 @@ static int mxs_gpio_probe(struct device *dev)
 
 	mxsgpio->chip.ngpio = 32;
 	mxsgpio->chip.dev = dev;
-	mxsgpio->regs = regs;
 	gpiochip_add(&mxsgpio->chip);
 
 	dev_dbg(dev, "probed gpiochip%d with base %d\n", dev->id, mxsgpio->chip.base);
-- 
2.39.5




  parent reply	other threads:[~2025-05-06  6:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-06  6:34 [PATCH 1/8] treewide: " Ahmad Fatoum
2025-05-06  6:34 ` [PATCH 2/8] ARM: i.MX: esdctl: " Ahmad Fatoum
2025-05-06  6:34 ` [PATCH 3/8] driver: switch dev_get_drvdata to Linux semantics Ahmad Fatoum
2025-05-06  6:34 ` Ahmad Fatoum [this message]
2025-05-06  7:42   ` [PATCH 4/8] gpio: gpio-mxs: replace dev_get_drvdata with device_get_match_data Sascha Hauer
2025-05-06  6:34 ` [PATCH 5/8] mci: am654-sdhci: fix error code printed in error messages Ahmad Fatoum
2025-05-06  6:34 ` [PATCH 6/8] pinctrl: at91: replace dev_get_drvdata with device_get_match_data Ahmad Fatoum
2025-05-06  6:34 ` [PATCH 7/8] drivers: maintain const when converting from struct driver Ahmad Fatoum
2025-05-06  6:34 ` [PATCH 8/8] driver: base: invert driver match callback for Linux compatibility Ahmad Fatoum
2025-05-06  7:41 ` [PATCH 1/8] treewide: replace dev_get_drvdata with device_get_match_data Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250506063446.3133582-4-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox