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

Configure Feed

Select the types of activity you want to include in your feed.

i2c: mux: gpio: don't fiddle with GPIOLIB internals

Use the relevant API functions to retrieve the address of the
underlying struct device instead of accessing GPIOLIB private structures
manually.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Acked-by: Peter Rosin <peda@axentia.se>
Acked-by: Wolfram Sang <wsa@kernel.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>

+6 -6
+6 -6
drivers/i2c/muxes/i2c-mux-gpio.c
··· 14 14 #include <linux/slab.h> 15 15 #include <linux/bits.h> 16 16 #include <linux/gpio/consumer.h> 17 - /* FIXME: stop poking around inside gpiolib */ 18 - #include "../../gpio/gpiolib.h" 17 + #include <linux/gpio/driver.h> 19 18 20 19 struct gpiomux { 21 20 struct i2c_mux_gpio_platform_data data; ··· 175 176 } 176 177 177 178 for (i = 0; i < ngpios; i++) { 178 - struct device *gpio_dev; 179 + struct gpio_device *gdev; 180 + struct device *dev; 179 181 struct gpio_desc *gpiod; 180 182 enum gpiod_flags flag; 181 183 ··· 195 195 if (!muxc->mux_locked) 196 196 continue; 197 197 198 - /* FIXME: find a proper way to access the GPIO device */ 199 - gpio_dev = &gpiod->gdev->dev; 200 - muxc->mux_locked = i2c_root_adapter(gpio_dev) == root; 198 + gdev = gpiod_to_gpio_device(gpiod); 199 + dev = gpio_device_to_device(gdev); 200 + muxc->mux_locked = i2c_root_adapter(dev) == root; 201 201 } 202 202 203 203 if (muxc->mux_locked)