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.fat...@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


Reply via email to