Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 839850f4 authored by Linus Walleij's avatar Linus Walleij
Browse files

input: adp5589-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().

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 fd19f534
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -387,7 +387,7 @@ static int adp5589_write(struct i2c_client *client, u8 reg, u8 val)
#ifdef CONFIG_GPIOLIB
static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off)
{
	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);

@@ -399,7 +399,7 @@ static int adp5589_gpio_get_value(struct gpio_chip *chip, unsigned off)
static void adp5589_gpio_set_value(struct gpio_chip *chip,
				   unsigned off, int val)
{
	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);

@@ -418,7 +418,7 @@ static void adp5589_gpio_set_value(struct gpio_chip *chip,

static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off)
{
	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
	int ret;
@@ -438,7 +438,7 @@ static int adp5589_gpio_direction_input(struct gpio_chip *chip, unsigned off)
static int adp5589_gpio_direction_output(struct gpio_chip *chip,
					 unsigned off, int val)
{
	struct adp5589_kpad *kpad = container_of(chip, struct adp5589_kpad, gc);
	struct adp5589_kpad *kpad = gpiochip_get_data(chip);
	unsigned int bank = kpad->var->bank(kpad->gpiomap[off]);
	unsigned int bit = kpad->var->bit(kpad->gpiomap[off]);
	int ret;
@@ -525,9 +525,9 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad)

	mutex_init(&kpad->gpio_lock);

	error = gpiochip_add(&kpad->gc);
	error = gpiochip_add_data(&kpad->gc, kpad);
	if (error) {
		dev_err(dev, "gpiochip_add failed, err: %d\n", error);
		dev_err(dev, "gpiochip_add_data() failed, err: %d\n", error);
		return error;
	}