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

gpio: bt8xx: 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 Buesch <m@bues.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+5 -5
+5 -5
drivers/gpio/gpio-bt8xx.c
··· 80 80 81 81 static int bt8xxgpio_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) 82 82 { 83 - struct bt8xxgpio *bg = container_of(gpio, struct bt8xxgpio, gpio); 83 + struct bt8xxgpio *bg = gpiochip_get_data(gpio); 84 84 unsigned long flags; 85 85 u32 outen, data; 86 86 ··· 101 101 102 102 static int bt8xxgpio_gpio_get(struct gpio_chip *gpio, unsigned nr) 103 103 { 104 - struct bt8xxgpio *bg = container_of(gpio, struct bt8xxgpio, gpio); 104 + struct bt8xxgpio *bg = gpiochip_get_data(gpio); 105 105 unsigned long flags; 106 106 u32 val; 107 107 ··· 115 115 static int bt8xxgpio_gpio_direction_output(struct gpio_chip *gpio, 116 116 unsigned nr, int val) 117 117 { 118 - struct bt8xxgpio *bg = container_of(gpio, struct bt8xxgpio, gpio); 118 + struct bt8xxgpio *bg = gpiochip_get_data(gpio); 119 119 unsigned long flags; 120 120 u32 outen, data; 121 121 ··· 140 140 static void bt8xxgpio_gpio_set(struct gpio_chip *gpio, 141 141 unsigned nr, int val) 142 142 { 143 - struct bt8xxgpio *bg = container_of(gpio, struct bt8xxgpio, gpio); 143 + struct bt8xxgpio *bg = gpiochip_get_data(gpio); 144 144 unsigned long flags; 145 145 u32 data; 146 146 ··· 217 217 bgwrite(0, BT848_GPIO_OUT_EN); 218 218 219 219 bt8xxgpio_gpio_setup(bg); 220 - err = gpiochip_add(&bg->gpio); 220 + err = gpiochip_add_data(&bg->gpio, bg); 221 221 if (err) { 222 222 printk(KERN_ERR "bt8xxgpio: Failed to register GPIOs\n"); 223 223 goto err_disable;