]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: ts4800: Remove duplicate code to handle 'ngpios' property
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 19 Feb 2026 13:46:47 +0000 (14:46 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Mon, 23 Feb 2026 09:42:14 +0000 (10:42 +0100)
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>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260219134647.2258593-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpio-ts4800.c

index 992ee231db9ff8ba47600483457e7373159f1e5d..0207c2b813f413f96fa0be3d2158f359e4c2f99a 100644 (file)
@@ -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);
 }