[openwrt/openwrt] ath79: gpio-latch-miktorik: use gpiochip_get_data

LEDE Commits lede-commits at lists.infradead.org
Sun Nov 3 11:12:10 PST 2024


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/6d2ed484fa2f62e355893f5e1fe3734c88201bfc

commit 6d2ed484fa2f62e355893f5e1fe3734c88201bfc
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Sat Oct 19 15:49:42 2024 -0700

    ath79: gpio-latch-miktorik: use gpiochip_get_data
    
    Oversight from devm conversion. No need for a custom static inline
    function.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/16747
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c b/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c
index 6e3f0f9690..4baed52e57 100644
--- a/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c
+++ b/target/linux/ath79/files/drivers/gpio/gpio-latch-mikrotik.c
@@ -28,11 +28,6 @@ struct gpio_latch_chip {
 	struct gpio_desc *gpios[GPIO_LATCH_LINES];
 };
 
-static inline struct gpio_latch_chip *to_gpio_latch_chip(struct gpio_chip *gc)
-{
-	return container_of(gc, struct gpio_latch_chip, gc);
-}
-
 static void gpio_latch_lock(struct gpio_latch_chip *glc, bool enable)
 {
 	mutex_lock(&glc->mutex);
@@ -58,7 +53,7 @@ static void gpio_latch_unlock(struct gpio_latch_chip *glc, bool disable)
 static int
 gpio_latch_get(struct gpio_chip *gc, unsigned offset)
 {
-	struct gpio_latch_chip *glc = to_gpio_latch_chip(gc);
+	struct gpio_latch_chip *glc = gpiochip_get_data(gc);
 	int ret;
 
 	gpio_latch_lock(glc, false);
@@ -71,7 +66,7 @@ gpio_latch_get(struct gpio_chip *gc, unsigned offset)
 static void
 gpio_latch_set(struct gpio_chip *gc, unsigned offset, int value)
 {
-	struct gpio_latch_chip *glc = to_gpio_latch_chip(gc);
+	struct gpio_latch_chip *glc = gpiochip_get_data(gc);
 	bool enable_latch = false;
 	bool disable_latch = false;
 
@@ -88,7 +83,7 @@ gpio_latch_set(struct gpio_chip *gc, unsigned offset, int value)
 static int
 gpio_latch_direction_output(struct gpio_chip *gc, unsigned offset, int value)
 {
-	struct gpio_latch_chip *glc = to_gpio_latch_chip(gc);
+	struct gpio_latch_chip *glc = gpiochip_get_data(gc);
 	bool enable_latch = false;
 	bool disable_latch = false;
 	int ret;




More information about the lede-commits mailing list