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

mfd: ucb1x00: 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
7d94352e 22e5e747

+7 -7
+7 -7
drivers/mfd/ucb1x00-core.c
··· 28 28 #include <linux/mutex.h> 29 29 #include <linux/mfd/ucb1x00.h> 30 30 #include <linux/pm.h> 31 - #include <linux/gpio.h> 31 + #include <linux/gpio/driver.h> 32 32 33 33 static DEFINE_MUTEX(ucb1x00_mutex); 34 34 static LIST_HEAD(ucb1x00_drivers); ··· 109 109 110 110 static void ucb1x00_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 111 111 { 112 - struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio); 112 + struct ucb1x00 *ucb = gpiochip_get_data(chip); 113 113 unsigned long flags; 114 114 115 115 spin_lock_irqsave(&ucb->io_lock, flags); ··· 126 126 127 127 static int ucb1x00_gpio_get(struct gpio_chip *chip, unsigned offset) 128 128 { 129 - struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio); 129 + struct ucb1x00 *ucb = gpiochip_get_data(chip); 130 130 unsigned val; 131 131 132 132 ucb1x00_enable(ucb); ··· 138 138 139 139 static int ucb1x00_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 140 140 { 141 - struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio); 141 + struct ucb1x00 *ucb = gpiochip_get_data(chip); 142 142 unsigned long flags; 143 143 144 144 spin_lock_irqsave(&ucb->io_lock, flags); ··· 154 154 static int ucb1x00_gpio_direction_output(struct gpio_chip *chip, unsigned offset 155 155 , int value) 156 156 { 157 - struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio); 157 + struct ucb1x00 *ucb = gpiochip_get_data(chip); 158 158 unsigned long flags; 159 159 unsigned old, mask = 1 << offset; 160 160 ··· 181 181 182 182 static int ucb1x00_to_irq(struct gpio_chip *chip, unsigned offset) 183 183 { 184 - struct ucb1x00 *ucb = container_of(chip, struct ucb1x00, gpio); 184 + struct ucb1x00 *ucb = gpiochip_get_data(chip); 185 185 186 186 return ucb->irq_base > 0 ? ucb->irq_base + offset : -ENXIO; 187 187 } ··· 579 579 ucb->gpio.direction_input = ucb1x00_gpio_direction_input; 580 580 ucb->gpio.direction_output = ucb1x00_gpio_direction_output; 581 581 ucb->gpio.to_irq = ucb1x00_to_irq; 582 - ret = gpiochip_add(&ucb->gpio); 582 + ret = gpiochip_add_data(&ucb->gpio, ucb); 583 583 if (ret) 584 584 goto err_gpio_add; 585 585 } else