Commit 9acdf620 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski
Browse files

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: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Acked-by: default avatarPeter Rosin <peda@axentia.se>
Acked-by: default avatarWolfram Sang <wsa@kernel.org>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 370232d0
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -14,8 +14,7 @@
#include <linux/slab.h>
#include <linux/bits.h>
#include <linux/gpio/consumer.h>
/* FIXME: stop poking around inside gpiolib */
#include "../../gpio/gpiolib.h"
#include <linux/gpio/driver.h>

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

	for (i = 0; i < ngpios; i++) {
		struct device *gpio_dev;
		struct gpio_device *gdev;
		struct device *dev;
		struct gpio_desc *gpiod;
		enum gpiod_flags flag;

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

		/* FIXME: find a proper way to access the GPIO device */
		gpio_dev = &gpiod->gdev->dev;
		muxc->mux_locked = i2c_root_adapter(gpio_dev) == root;
		gdev = gpiod_to_gpio_device(gpiod);
		dev = gpio_device_to_device(gdev);
		muxc->mux_locked = i2c_root_adapter(dev) == root;
	}

	if (muxc->mux_locked)