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

Commit f69255ce authored by Linus Walleij's avatar Linus Walleij
Browse files

gpio: adp5588: 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: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 5060e0e8
Loading
Loading
Loading
Loading
+7 −11
Original line number Original line Diff line number Diff line
@@ -65,8 +65,7 @@ static int adp5588_gpio_write(struct i2c_client *client, u8 reg, u8 val)


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_gpio *dev =
	struct adp5588_gpio *dev = gpiochip_get_data(chip);
	    container_of(chip, struct adp5588_gpio, gpio_chip);
	unsigned bank = ADP5588_BANK(off);
	unsigned bank = ADP5588_BANK(off);
	unsigned bit = ADP5588_BIT(off);
	unsigned bit = ADP5588_BIT(off);
	int val;
	int val;
@@ -87,8 +86,7 @@ static void adp5588_gpio_set_value(struct gpio_chip *chip,
				   unsigned off, int val)
				   unsigned off, int val)
{
{
	unsigned bank, bit;
	unsigned bank, bit;
	struct adp5588_gpio *dev =
	struct adp5588_gpio *dev = gpiochip_get_data(chip);
	    container_of(chip, struct adp5588_gpio, gpio_chip);


	bank = ADP5588_BANK(off);
	bank = ADP5588_BANK(off);
	bit = ADP5588_BIT(off);
	bit = ADP5588_BIT(off);
@@ -108,8 +106,7 @@ static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off)
{
{
	int ret;
	int ret;
	unsigned bank;
	unsigned bank;
	struct adp5588_gpio *dev =
	struct adp5588_gpio *dev = gpiochip_get_data(chip);
	    container_of(chip, struct adp5588_gpio, gpio_chip);


	bank = ADP5588_BANK(off);
	bank = ADP5588_BANK(off);


@@ -126,8 +123,7 @@ static int adp5588_gpio_direction_output(struct gpio_chip *chip,
{
{
	int ret;
	int ret;
	unsigned bank, bit;
	unsigned bank, bit;
	struct adp5588_gpio *dev =
	struct adp5588_gpio *dev = gpiochip_get_data(chip);
	    container_of(chip, struct adp5588_gpio, gpio_chip);


	bank = ADP5588_BANK(off);
	bank = ADP5588_BANK(off);
	bit = ADP5588_BIT(off);
	bit = ADP5588_BIT(off);
@@ -152,8 +148,8 @@ static int adp5588_gpio_direction_output(struct gpio_chip *chip,
#ifdef CONFIG_GPIO_ADP5588_IRQ
#ifdef CONFIG_GPIO_ADP5588_IRQ
static int adp5588_gpio_to_irq(struct gpio_chip *chip, unsigned off)
static int adp5588_gpio_to_irq(struct gpio_chip *chip, unsigned off)
{
{
	struct adp5588_gpio *dev =
	struct adp5588_gpio *dev = gpiochip_get_data(chip);
		container_of(chip, struct adp5588_gpio, gpio_chip);

	return dev->irq_base + off;
	return dev->irq_base + off;
}
}


@@ -418,7 +414,7 @@ static int adp5588_gpio_probe(struct i2c_client *client,
		}
		}
	}
	}


	ret = gpiochip_add(&dev->gpio_chip);
	ret = gpiochip_add_data(&dev->gpio_chip, dev);
	if (ret)
	if (ret)
		goto err_irq;
		goto err_irq;