aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-mpc5200.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-12-07 04:25:36 -0500
committerLinus Walleij <linus.walleij@linaro.org>2016-01-05 05:21:08 -0500
commit837c2705a3d5adca3ff5532d9cb6215803bea5f2 (patch)
treebffab3b1c146f40a99166068d972ec2135bec966 /drivers/gpio/gpio-mpc5200.c
parent6aa7dbfa28775189c53f6ac7f1bc4adf76c9d2ec (diff)
gpio: mpc5200: use gpiochip data pointer
This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-mpc5200.c')
-rw-r--r--drivers/gpio/gpio-mpc5200.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/gpio/gpio-mpc5200.c b/drivers/gpio/gpio-mpc5200.c
index 044bbbb747f2..0e5a6709f27d 100644
--- a/drivers/gpio/gpio-mpc5200.c
+++ b/drivers/gpio/gpio-mpc5200.c
@@ -71,8 +71,7 @@ static inline void
71__mpc52xx_wkup_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) 71__mpc52xx_wkup_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
72{ 72{
73 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 73 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
74 struct mpc52xx_gpiochip *chip = container_of(mm_gc, 74 struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc);
75 struct mpc52xx_gpiochip, mmchip);
76 struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs; 75 struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs;
77 76
78 if (val) 77 if (val)
@@ -100,8 +99,7 @@ mpc52xx_wkup_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
100static int mpc52xx_wkup_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio) 99static int mpc52xx_wkup_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
101{ 100{
102 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 101 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
103 struct mpc52xx_gpiochip *chip = container_of(mm_gc, 102 struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc);
104 struct mpc52xx_gpiochip, mmchip);
105 struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs; 103 struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs;
106 unsigned long flags; 104 unsigned long flags;
107 105
@@ -125,8 +123,7 @@ mpc52xx_wkup_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
125{ 123{
126 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 124 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
127 struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs; 125 struct mpc52xx_gpio_wkup __iomem *regs = mm_gc->regs;
128 struct mpc52xx_gpiochip *chip = container_of(mm_gc, 126 struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc);
129 struct mpc52xx_gpiochip, mmchip);
130 unsigned long flags; 127 unsigned long flags;
131 128
132 spin_lock_irqsave(&gpio_lock, flags); 129 spin_lock_irqsave(&gpio_lock, flags);
@@ -169,7 +166,7 @@ static int mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev)
169 gc->get = mpc52xx_wkup_gpio_get; 166 gc->get = mpc52xx_wkup_gpio_get;
170 gc->set = mpc52xx_wkup_gpio_set; 167 gc->set = mpc52xx_wkup_gpio_set;
171 168
172 ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip); 169 ret = of_mm_gpiochip_add_data(ofdev->dev.of_node, &chip->mmchip, chip);
173 if (ret) 170 if (ret)
174 return ret; 171 return ret;
175 172
@@ -236,8 +233,7 @@ static inline void
236__mpc52xx_simple_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) 233__mpc52xx_simple_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
237{ 234{
238 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 235 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
239 struct mpc52xx_gpiochip *chip = container_of(mm_gc, 236 struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc);
240 struct mpc52xx_gpiochip, mmchip);
241 struct mpc52xx_gpio __iomem *regs = mm_gc->regs; 237 struct mpc52xx_gpio __iomem *regs = mm_gc->regs;
242 238
243 if (val) 239 if (val)
@@ -264,8 +260,7 @@ mpc52xx_simple_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
264static int mpc52xx_simple_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio) 260static int mpc52xx_simple_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
265{ 261{
266 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 262 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
267 struct mpc52xx_gpiochip *chip = container_of(mm_gc, 263 struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc);
268 struct mpc52xx_gpiochip, mmchip);
269 struct mpc52xx_gpio __iomem *regs = mm_gc->regs; 264 struct mpc52xx_gpio __iomem *regs = mm_gc->regs;
270 unsigned long flags; 265 unsigned long flags;
271 266
@@ -288,8 +283,7 @@ static int
288mpc52xx_simple_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) 283mpc52xx_simple_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
289{ 284{
290 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); 285 struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
291 struct mpc52xx_gpiochip *chip = container_of(mm_gc, 286 struct mpc52xx_gpiochip *chip = gpiochip_get_data(gc);
292 struct mpc52xx_gpiochip, mmchip);
293 struct mpc52xx_gpio __iomem *regs = mm_gc->regs; 287 struct mpc52xx_gpio __iomem *regs = mm_gc->regs;
294 unsigned long flags; 288 unsigned long flags;
295 289
@@ -334,7 +328,7 @@ static int mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev)
334 gc->get = mpc52xx_simple_gpio_get; 328 gc->get = mpc52xx_simple_gpio_get;
335 gc->set = mpc52xx_simple_gpio_set; 329 gc->set = mpc52xx_simple_gpio_set;
336 330
337 ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip); 331 ret = of_mm_gpiochip_add_data(ofdev->dev.of_node, &chip->mmchip, chip);
338 if (ret) 332 if (ret)
339 return ret; 333 return ret;
340 334