summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-zevio.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-12-07 15:26:02 +0100
committerLinus Walleij <linus.walleij@linaro.org>2016-01-05 11:21:19 +0100
commit9a3ad668a081163ad5108a6f5d3a7ddaa0390098 (patch)
tree30ca633161b53e3e4e88da362171d3da4ad5b7e7 /drivers/gpio/gpio-zevio.c
parente730a5953af4c54a50fb7712af4dd9468dedcd22 (diff)
gpio: zevio: 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: Fabian Vogt <fabian@ritter-vogt.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-zevio.c')
-rw-r--r--drivers/gpio/gpio-zevio.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/gpio/gpio-zevio.c b/drivers/gpio/gpio-zevio.c
index 65b61dcc6268..cda6d922be98 100644
--- a/drivers/gpio/gpio-zevio.c
+++ b/drivers/gpio/gpio-zevio.c
@@ -52,9 +52,6 @@
#define ZEVIO_GPIO_INPUT 0x18
#define ZEVIO_GPIO_INT_STICKY 0x20
-#define to_zevio_gpio(chip) container_of(to_of_mm_gpio_chip(chip), \
- struct zevio_gpio, chip)
-
/* Bit number of GPIO in its section */
#define ZEVIO_GPIO_BIT(gpio) (gpio&7)
@@ -80,7 +77,7 @@ static inline void zevio_gpio_port_set(struct zevio_gpio *c, unsigned pin,
/* Functions for struct gpio_chip */
static int zevio_gpio_get(struct gpio_chip *chip, unsigned pin)
{
- struct zevio_gpio *controller = to_zevio_gpio(chip);
+ struct zevio_gpio *controller = gpiochip_get_data(chip);
u32 val, dir;
spin_lock(&controller->lock);
@@ -96,7 +93,7 @@ static int zevio_gpio_get(struct gpio_chip *chip, unsigned pin)
static void zevio_gpio_set(struct gpio_chip *chip, unsigned pin, int value)
{
- struct zevio_gpio *controller = to_zevio_gpio(chip);
+ struct zevio_gpio *controller = gpiochip_get_data(chip);
u32 val;
spin_lock(&controller->lock);
@@ -112,7 +109,7 @@ static void zevio_gpio_set(struct gpio_chip *chip, unsigned pin, int value)
static int zevio_gpio_direction_input(struct gpio_chip *chip, unsigned pin)
{
- struct zevio_gpio *controller = to_zevio_gpio(chip);
+ struct zevio_gpio *controller = gpiochip_get_data(chip);
u32 val;
spin_lock(&controller->lock);
@@ -129,7 +126,7 @@ static int zevio_gpio_direction_input(struct gpio_chip *chip, unsigned pin)
static int zevio_gpio_direction_output(struct gpio_chip *chip,
unsigned pin, int value)
{
- struct zevio_gpio *controller = to_zevio_gpio(chip);
+ struct zevio_gpio *controller = gpiochip_get_data(chip);
u32 val;
spin_lock(&controller->lock);
@@ -187,7 +184,9 @@ static int zevio_gpio_probe(struct platform_device *pdev)
controller->chip.gc = zevio_gpio_chip;
controller->chip.gc.parent = &pdev->dev;
- status = of_mm_gpiochip_add(pdev->dev.of_node, &(controller->chip));
+ status = of_mm_gpiochip_add_data(pdev->dev.of_node,
+ &(controller->chip),
+ controller);
if (status) {
dev_err(&pdev->dev, "failed to add gpiochip: %d\n", status);
return status;