Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: tps65010: 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().

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Linus Walleij and committed by
Lee Jones
22e5e747 4e125f62

+4 -4
+4 -4
drivers/mfd/tps65010.c
··· 34 34 35 35 #include <linux/i2c/tps65010.h> 36 36 37 - #include <linux/gpio.h> 37 + #include <linux/gpio/driver.h> 38 38 39 39 40 40 /*-------------------------------------------------------------------------*/ ··· 477 477 if (offset < 4) { 478 478 struct tps65010 *tps; 479 479 480 - tps = container_of(chip, struct tps65010, chip); 480 + tps = gpiochip_get_data(chip); 481 481 if (!(tps->outmask & (1 << offset))) 482 482 return -EINVAL; 483 483 tps65010_set_gpio_out_value(offset + 1, value); ··· 494 494 int value; 495 495 struct tps65010 *tps; 496 496 497 - tps = container_of(chip, struct tps65010, chip); 497 + tps = gpiochip_get_data(chip); 498 498 499 499 if (offset < 4) { 500 500 value = i2c_smbus_read_byte_data(tps->client, TPS_DEFGPIO); ··· 651 651 tps->chip.ngpio = 7; 652 652 tps->chip.can_sleep = 1; 653 653 654 - status = gpiochip_add(&tps->chip); 654 + status = gpiochip_add_data(&tps->chip, tps); 655 655 if (status < 0) 656 656 dev_err(&client->dev, "can't add gpiochip, err %d\n", 657 657 status);