Commit 80036f88 authored by Linus Walleij's avatar Linus Walleij

pinctrl: at91-pio4: 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: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 11aa679a
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
*/ */
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/gpio/driver.h>
/* FIXME: needed for gpio_to_irq(), get rid of this */
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -290,7 +292,7 @@ static void atmel_gpio_irq_handler(struct irq_desc *desc) ...@@ -290,7 +292,7 @@ static void atmel_gpio_irq_handler(struct irq_desc *desc)
static int atmel_gpio_direction_input(struct gpio_chip *chip, unsigned offset) static int atmel_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
{ {
struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(chip->parent); struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
struct atmel_pin *pin = atmel_pioctrl->pins[offset]; struct atmel_pin *pin = atmel_pioctrl->pins[offset];
unsigned reg; unsigned reg;
...@@ -305,7 +307,7 @@ static int atmel_gpio_direction_input(struct gpio_chip *chip, unsigned offset) ...@@ -305,7 +307,7 @@ static int atmel_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
static int atmel_gpio_get(struct gpio_chip *chip, unsigned offset) static int atmel_gpio_get(struct gpio_chip *chip, unsigned offset)
{ {
struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(chip->parent); struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
struct atmel_pin *pin = atmel_pioctrl->pins[offset]; struct atmel_pin *pin = atmel_pioctrl->pins[offset];
unsigned reg; unsigned reg;
...@@ -317,7 +319,7 @@ static int atmel_gpio_get(struct gpio_chip *chip, unsigned offset) ...@@ -317,7 +319,7 @@ static int atmel_gpio_get(struct gpio_chip *chip, unsigned offset)
static int atmel_gpio_direction_output(struct gpio_chip *chip, unsigned offset, static int atmel_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
int value) int value)
{ {
struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(chip->parent); struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
struct atmel_pin *pin = atmel_pioctrl->pins[offset]; struct atmel_pin *pin = atmel_pioctrl->pins[offset];
unsigned reg; unsigned reg;
...@@ -336,7 +338,7 @@ static int atmel_gpio_direction_output(struct gpio_chip *chip, unsigned offset, ...@@ -336,7 +338,7 @@ static int atmel_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
static void atmel_gpio_set(struct gpio_chip *chip, unsigned offset, int val) static void atmel_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
{ {
struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(chip->parent); struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
struct atmel_pin *pin = atmel_pioctrl->pins[offset]; struct atmel_pin *pin = atmel_pioctrl->pins[offset];
atmel_gpio_write(atmel_pioctrl, pin->bank, atmel_gpio_write(atmel_pioctrl, pin->bank,
...@@ -346,7 +348,7 @@ static void atmel_gpio_set(struct gpio_chip *chip, unsigned offset, int val) ...@@ -346,7 +348,7 @@ static void atmel_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
static int atmel_gpio_to_irq(struct gpio_chip *chip, unsigned offset) static int atmel_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{ {
struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(chip->parent); struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
return irq_find_mapping(atmel_pioctrl->irq_domain, offset); return irq_find_mapping(atmel_pioctrl->irq_domain, offset);
} }
...@@ -1037,7 +1039,7 @@ static int atmel_pinctrl_probe(struct platform_device *pdev) ...@@ -1037,7 +1039,7 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)
goto pinctrl_register_error; goto pinctrl_register_error;
} }
ret = gpiochip_add(atmel_pioctrl->gpio_chip); ret = gpiochip_add_data(atmel_pioctrl->gpio_chip, atmel_pioctrl);
if (ret) { if (ret) {
dev_err(dev, "failed to add gpiochip\n"); dev_err(dev, "failed to add gpiochip\n");
goto gpiochip_add_error; goto gpiochip_add_error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment