From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Linus Walleij <linus.walleij@linaro.org>,
Andy Shevchenko <andy@kernel.org>,
Peter Korsgaard <peter.korsgaard@barco.com>,
Peter Rosin <peda@axentia.se>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-i2c@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [PATCH 3/3] i2c: mux: gpio: don't fiddle with GPIOLIB internals
Date: Wed, 11 Oct 2023 15:02:04 +0200 [thread overview]
Message-ID: <20231011130204.52265-4-brgl@bgdev.pl> (raw)
In-Reply-To: <20231011130204.52265-1-brgl@bgdev.pl>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
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>
---
drivers/i2c/muxes/i2c-mux-gpio.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c
index 5d5cbe0130cd..48a872a8196b 100644
--- a/drivers/i2c/muxes/i2c-mux-gpio.c
+++ b/drivers/i2c/muxes/i2c-mux-gpio.c
@@ -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)
--
2.39.2
next prev parent reply other threads:[~2023-10-11 13:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-11 13:02 [PATCH 0/3] i2c: mux: don't access GPIOLIB internal structures Bartosz Golaszewski
2023-10-11 13:02 ` [PATCH 1/3] gpiolib: provide gpio_device_to_device() Bartosz Golaszewski
2023-10-11 14:57 ` Peter Rosin
2023-10-11 15:18 ` Andy Shevchenko
2023-10-11 13:02 ` [PATCH 2/3] gpiolib: provide gpiod_to_gpio_device() Bartosz Golaszewski
2023-10-11 14:58 ` Peter Rosin
2023-10-11 15:23 ` Andy Shevchenko
2023-10-11 15:39 ` Bartosz Golaszewski
2023-10-12 6:57 ` Linus Walleij
2023-10-11 15:28 ` Andy Shevchenko
2023-10-11 13:02 ` Bartosz Golaszewski [this message]
2023-10-11 14:59 ` [PATCH 3/3] i2c: mux: gpio: don't fiddle with GPIOLIB internals Peter Rosin
2023-10-11 15:03 ` Bartosz Golaszewski
2023-10-11 16:41 ` Wolfram Sang
2023-10-11 15:18 ` Andy Shevchenko
2023-10-12 6:59 ` [PATCH 0/3] i2c: mux: don't access GPIOLIB internal structures Linus Walleij
2023-10-13 6:50 ` Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231011130204.52265-4-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=andy@kernel.org \
--cc=bartosz.golaszewski@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peda@axentia.se \
--cc=peter.korsgaard@barco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox