[openwrt/openwrt] kernel: gpio-cascade: use gpiochip_get_data

LEDE Commits lede-commits at lists.infradead.org
Mon Oct 21 15:50:04 PDT 2024


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/9bc0517b783fa2cea464b3949f8796ce42dd4205

commit 9bc0517b783fa2cea464b3949f8796ce42dd4205
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Sat Oct 19 16:04:26 2024 -0700

    kernel: gpio-cascade: use gpiochip_get_data
    
    Instead of passing NULL to gpiochip_add_data, we can populate the
    parameter and use gpiochip_get_data instead of a custom function.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/16739
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 .../801-gpio-gpio-cascade-add-generic-GPIO-cascade.patch      | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/target/linux/generic/pending-6.6/801-gpio-gpio-cascade-add-generic-GPIO-cascade.patch b/target/linux/generic/pending-6.6/801-gpio-gpio-cascade-add-generic-GPIO-cascade.patch
index aae850e1d9..001be81838 100644
--- a/target/linux/generic/pending-6.6/801-gpio-gpio-cascade-add-generic-GPIO-cascade.patch
+++ b/target/linux/generic/pending-6.6/801-gpio-gpio-cascade-add-generic-GPIO-cascade.patch
@@ -102,7 +102,7 @@ v1 -> v2:
  obj-$(CONFIG_GPIO_CRYSTAL_COVE)		+= gpio-crystalcove.o
 --- /dev/null
 +++ b/drivers/gpio/gpio-cascade.c
-@@ -0,0 +1,117 @@
+@@ -0,0 +1,112 @@
 +// SPDX-License-Identifier: GPL-2.0-only
 +/*
 + *  A generic GPIO cascade driver
@@ -141,11 +141,6 @@ v1 -> v2:
 +	struct gpio_desc	*upstream_line;
 +};
 +
-+static struct gpio_cascade *chip_to_cascade(struct gpio_chip *gc)
-+{
-+	return container_of(gc, struct gpio_cascade, gpio_chip);
-+}
-+
 +static int gpio_cascade_get_direction(struct gpio_chip *gc, unsigned int offset)
 +{
 +	return GPIO_LINE_DIRECTION_IN;
@@ -153,7 +148,7 @@ v1 -> v2:
 +
 +static int gpio_cascade_get_value(struct gpio_chip *gc, unsigned int offset)
 +{
-+	struct gpio_cascade *cas = chip_to_cascade(gc);
++	struct gpio_cascade *cas = gpiochip_get_data(gc);
 +	int ret;
 +
 +	ret = mux_control_select(cas->mux_control, offset);
@@ -199,7 +194,7 @@ v1 -> v2:
 +	gc->owner = THIS_MODULE;
 +
 +	platform_set_drvdata(pdev, cas);
-+	return devm_gpiochip_add_data(dev, &cas->gpio_chip, NULL);
++	return devm_gpiochip_add_data(dev, &cas->gpio_chip, cas);
 +}
 +
 +static const struct of_device_id gpio_cascade_id[] = {




More information about the lede-commits mailing list