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

gpio: 74x164: 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: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+3 -8
+3 -8
drivers/gpio/gpio-74x164.c
··· 33 33 u8 buffer[0]; 34 34 }; 35 35 36 - static struct gen_74x164_chip *gpio_to_74x164_chip(struct gpio_chip *gc) 37 - { 38 - return container_of(gc, struct gen_74x164_chip, gpio_chip); 39 - } 40 - 41 36 static int __gen_74x164_write_config(struct gen_74x164_chip *chip) 42 37 { 43 38 struct spi_transfer xfer = { ··· 46 51 47 52 static int gen_74x164_get_value(struct gpio_chip *gc, unsigned offset) 48 53 { 49 - struct gen_74x164_chip *chip = gpio_to_74x164_chip(gc); 54 + struct gen_74x164_chip *chip = gpiochip_get_data(gc); 50 55 u8 bank = chip->registers - 1 - offset / 8; 51 56 u8 pin = offset % 8; 52 57 int ret; ··· 61 66 static void gen_74x164_set_value(struct gpio_chip *gc, 62 67 unsigned offset, int val) 63 68 { 64 - struct gen_74x164_chip *chip = gpio_to_74x164_chip(gc); 69 + struct gen_74x164_chip *chip = gpiochip_get_data(gc); 65 70 u8 bank = chip->registers - 1 - offset / 8; 66 71 u8 pin = offset % 8; 67 72 ··· 131 136 goto exit_destroy; 132 137 } 133 138 134 - ret = gpiochip_add(&chip->gpio_chip); 139 + ret = gpiochip_add_data(&chip->gpio_chip, chip); 135 140 if (!ret) 136 141 return 0; 137 142