Commit d3baee37 authored by Linus Walleij's avatar Linus Walleij

input: adp5588-keys: 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: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Acked-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 59851aa8
...@@ -73,7 +73,7 @@ static int adp5588_write(struct i2c_client *client, u8 reg, u8 val) ...@@ -73,7 +73,7 @@ static int adp5588_write(struct i2c_client *client, u8 reg, u8 val)
#ifdef CONFIG_GPIOLIB #ifdef CONFIG_GPIOLIB
static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off) static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off)
{ {
struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); struct adp5588_kpad *kpad = gpiochip_get_data(chip);
unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
int val; int val;
...@@ -93,7 +93,7 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off) ...@@ -93,7 +93,7 @@ static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off)
static void adp5588_gpio_set_value(struct gpio_chip *chip, static void adp5588_gpio_set_value(struct gpio_chip *chip,
unsigned off, int val) unsigned off, int val)
{ {
struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); struct adp5588_kpad *kpad = gpiochip_get_data(chip);
unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
...@@ -112,7 +112,7 @@ static void adp5588_gpio_set_value(struct gpio_chip *chip, ...@@ -112,7 +112,7 @@ static void adp5588_gpio_set_value(struct gpio_chip *chip,
static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off) static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off)
{ {
struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); struct adp5588_kpad *kpad = gpiochip_get_data(chip);
unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
int ret; int ret;
...@@ -130,7 +130,7 @@ static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off) ...@@ -130,7 +130,7 @@ static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off)
static int adp5588_gpio_direction_output(struct gpio_chip *chip, static int adp5588_gpio_direction_output(struct gpio_chip *chip,
unsigned off, int val) unsigned off, int val)
{ {
struct adp5588_kpad *kpad = container_of(chip, struct adp5588_kpad, gc); struct adp5588_kpad *kpad = gpiochip_get_data(chip);
unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]); unsigned int bank = ADP5588_BANK(kpad->gpiomap[off]);
unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]); unsigned int bit = ADP5588_BIT(kpad->gpiomap[off]);
int ret; int ret;
...@@ -210,7 +210,7 @@ static int adp5588_gpio_add(struct adp5588_kpad *kpad) ...@@ -210,7 +210,7 @@ static int adp5588_gpio_add(struct adp5588_kpad *kpad)
mutex_init(&kpad->gpio_lock); mutex_init(&kpad->gpio_lock);
error = gpiochip_add(&kpad->gc); error = gpiochip_add_data(&kpad->gc, kpad);
if (error) { if (error) {
dev_err(dev, "gpiochip_add failed, err: %d\n", error); dev_err(dev, "gpiochip_add failed, err: %d\n", error);
return error; return 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