aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-12-08 07:48:02 -0500
committerLinus Walleij <linus.walleij@linaro.org>2016-01-06 18:07:39 -0500
commit95bf0951e415cf71654184fd6e8c711782b1f22a (patch)
tree3a292301784819982d44468de5a0b3c9b445b92e
parent11680af7c8579fc37ac34bf16cb5ea49435054a4 (diff)
avr32: gpio: 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(). Cc: Haavard Skinnemoen <hskinnemoen@gmail.com> Acked-by: Hans-Christian Noren Egtvedt <egtvedt@samfundet.no> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--arch/avr32/mach-at32ap/pio.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c
index aa74491771fa..5020057ac7a2 100644
--- a/arch/avr32/mach-at32ap/pio.c
+++ b/arch/avr32/mach-at32ap/pio.c
@@ -203,7 +203,7 @@ fail:
203 203
204static int direction_input(struct gpio_chip *chip, unsigned offset) 204static int direction_input(struct gpio_chip *chip, unsigned offset)
205{ 205{
206 struct pio_device *pio = container_of(chip, struct pio_device, chip); 206 struct pio_device *pio = gpiochip_get_data(chip);
207 u32 mask = 1 << offset; 207 u32 mask = 1 << offset;
208 208
209 if (!(pio_readl(pio, PSR) & mask)) 209 if (!(pio_readl(pio, PSR) & mask))
@@ -215,7 +215,7 @@ static int direction_input(struct gpio_chip *chip, unsigned offset)
215 215
216static int gpio_get(struct gpio_chip *chip, unsigned offset) 216static int gpio_get(struct gpio_chip *chip, unsigned offset)
217{ 217{
218 struct pio_device *pio = container_of(chip, struct pio_device, chip); 218 struct pio_device *pio = gpiochip_get_data(chip);
219 219
220 return (pio_readl(pio, PDSR) >> offset) & 1; 220 return (pio_readl(pio, PDSR) >> offset) & 1;
221} 221}
@@ -224,7 +224,7 @@ static void gpio_set(struct gpio_chip *chip, unsigned offset, int value);
224 224
225static int direction_output(struct gpio_chip *chip, unsigned offset, int value) 225static int direction_output(struct gpio_chip *chip, unsigned offset, int value)
226{ 226{
227 struct pio_device *pio = container_of(chip, struct pio_device, chip); 227 struct pio_device *pio = gpiochip_get_data(chip);
228 u32 mask = 1 << offset; 228 u32 mask = 1 << offset;
229 229
230 if (!(pio_readl(pio, PSR) & mask)) 230 if (!(pio_readl(pio, PSR) & mask))
@@ -237,7 +237,7 @@ static int direction_output(struct gpio_chip *chip, unsigned offset, int value)
237 237
238static void gpio_set(struct gpio_chip *chip, unsigned offset, int value) 238static void gpio_set(struct gpio_chip *chip, unsigned offset, int value)
239{ 239{
240 struct pio_device *pio = container_of(chip, struct pio_device, chip); 240 struct pio_device *pio = gpiochip_get_data(chip);
241 u32 mask = 1 << offset; 241 u32 mask = 1 << offset;
242 242
243 if (value) 243 if (value)
@@ -335,7 +335,7 @@ gpio_irq_setup(struct pio_device *pio, int irq, int gpio_irq)
335 */ 335 */
336static void pio_bank_show(struct seq_file *s, struct gpio_chip *chip) 336static void pio_bank_show(struct seq_file *s, struct gpio_chip *chip)
337{ 337{
338 struct pio_device *pio = container_of(chip, struct pio_device, chip); 338 struct pio_device *pio = gpiochip_get_data(chip);
339 u32 psr, osr, imr, pdsr, pusr, ifsr, mdsr; 339 u32 psr, osr, imr, pdsr, pusr, ifsr, mdsr;
340 unsigned i; 340 unsigned i;
341 u32 mask; 341 u32 mask;
@@ -406,7 +406,7 @@ static int __init pio_probe(struct platform_device *pdev)
406 pio->chip.set = gpio_set; 406 pio->chip.set = gpio_set;
407 pio->chip.dbg_show = pio_bank_show; 407 pio->chip.dbg_show = pio_bank_show;
408 408
409 gpiochip_add(&pio->chip); 409 gpiochip_add_data(&pio->chip, pio);
410 410
411 gpio_irq_setup(pio, irq, gpio_irq_base); 411 gpio_irq_setup(pio, irq, gpio_irq_base);
412 412