* [PATCH v1 1/1] gpio: ts4800: Remove duplicate code to handle 'ngpios' property
@ 2026-02-19 13:46 Andy Shevchenko
2026-02-19 17:33 ` Linus Walleij
2026-02-23 9:57 ` Bartosz Golaszewski
0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2026-02-19 13:46 UTC (permalink / raw)
To: Bartosz Golaszewski, linux-gpio, linux-kernel
Cc: Linus Walleij, Andy Shevchenko
The gpio_generic_chip_init() handles the 'ngpios' property and
assigns the respective field in struct gpio_chip either with
the value of it, or, if not found, with the default based on
the register size. There is no need to repeat this in the driver.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpio-ts4800.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/drivers/gpio/gpio-ts4800.c b/drivers/gpio/gpio-ts4800.c
index 992ee231db9f..0207c2b813f4 100644
--- a/drivers/gpio/gpio-ts4800.c
+++ b/drivers/gpio/gpio-ts4800.c
@@ -11,7 +11,6 @@
#include <linux/platform_device.h>
#include <linux/property.h>
-#define DEFAULT_PIN_NUMBER 16
#define INPUT_REG_OFFSET 0x00
#define OUTPUT_REG_OFFSET 0x02
#define DIRECTION_REG_OFFSET 0x04
@@ -23,7 +22,6 @@ static int ts4800_gpio_probe(struct platform_device *pdev)
struct gpio_generic_chip *chip;
void __iomem *base_addr;
int retval;
- u32 ngpios;
chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
@@ -33,12 +31,6 @@ static int ts4800_gpio_probe(struct platform_device *pdev)
if (IS_ERR(base_addr))
return PTR_ERR(base_addr);
- retval = device_property_read_u32(dev, "ngpios", &ngpios);
- if (retval == -EINVAL)
- ngpios = DEFAULT_PIN_NUMBER;
- else if (retval)
- return retval;
-
config = (struct gpio_generic_chip_config) {
.dev = dev,
.sz = 2,
@@ -52,8 +44,6 @@ static int ts4800_gpio_probe(struct platform_device *pdev)
return dev_err_probe(dev, retval,
"failed to initialize the generic GPIO chip\n");
- chip->gc.ngpio = ngpios;
-
return devm_gpiochip_add_data(dev, &chip->gc, NULL);
}
--
2.50.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] gpio: ts4800: Remove duplicate code to handle 'ngpios' property
2026-02-19 13:46 [PATCH v1 1/1] gpio: ts4800: Remove duplicate code to handle 'ngpios' property Andy Shevchenko
@ 2026-02-19 17:33 ` Linus Walleij
2026-02-23 9:57 ` Bartosz Golaszewski
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2026-02-19 17:33 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Bartosz Golaszewski, linux-gpio, linux-kernel
On Thu, Feb 19, 2026 at 2:46 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> The gpio_generic_chip_init() handles the 'ngpios' property and
> assigns the respective field in struct gpio_chip either with
> the value of it, or, if not found, with the default based on
> the register size. There is no need to repeat this in the driver.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
That's right.
Reviewed-by: Linus Walleij <linusw@kernel.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] gpio: ts4800: Remove duplicate code to handle 'ngpios' property
2026-02-19 13:46 [PATCH v1 1/1] gpio: ts4800: Remove duplicate code to handle 'ngpios' property Andy Shevchenko
2026-02-19 17:33 ` Linus Walleij
@ 2026-02-23 9:57 ` Bartosz Golaszewski
1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2026-02-23 9:57 UTC (permalink / raw)
To: Bartosz Golaszewski, linux-gpio, linux-kernel, Andy Shevchenko
Cc: Bartosz Golaszewski, Linus Walleij
On Thu, 19 Feb 2026 14:46:47 +0100, Andy Shevchenko wrote:
> The gpio_generic_chip_init() handles the 'ngpios' property and
> assigns the respective field in struct gpio_chip either with
> the value of it, or, if not found, with the default based on
> the register size. There is no need to repeat this in the driver.
>
>
Applied, thanks!
[1/1] gpio: ts4800: Remove duplicate code to handle 'ngpios' property
https://git.kernel.org/brgl/c/0acbe817c37344f10cb413663be494ad66bf40bc
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-23 9:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-19 13:46 [PATCH v1 1/1] gpio: ts4800: Remove duplicate code to handle 'ngpios' property Andy Shevchenko
2026-02-19 17:33 ` Linus Walleij
2026-02-23 9:57 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®