Skip to content

Commit 9acdf62

Browse files
author
Bartosz Golaszewski
committed
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>
1 parent 370232d commit 9acdf62

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/i2c/muxes/i2c-mux-gpio.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
#include <linux/slab.h>
1515
#include <linux/bits.h>
1616
#include <linux/gpio/consumer.h>
17-
/* FIXME: stop poking around inside gpiolib */
18-
#include "../../gpio/gpiolib.h"
17+
#include <linux/gpio/driver.h>
1918

2019
struct gpiomux {
2120
struct i2c_mux_gpio_platform_data data;
@@ -176,7 +175,8 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev)
176175
}
177176

178177
for (i = 0; i < ngpios; i++) {
179-
struct device *gpio_dev;
178+
struct gpio_device *gdev;
179+
struct device *dev;
180180
struct gpio_desc *gpiod;
181181
enum gpiod_flags flag;
182182

@@ -195,9 +195,9 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev)
195195
if (!muxc->mux_locked)
196196
continue;
197197

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;
201201
}
202202

203203
if (muxc->mux_locked)

0 commit comments

Comments
 (0)