gpio: ts4800: use generic device properties

Avoid pulling in linux/of.h by using the generic device properties.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250825-gpio-mmio-gpio-conv-v1-5-356b4b1d5110@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
Bartosz Golaszewski 2025-08-25 11:48:46 +02:00
parent d6307707d5
commit 8a8e9a1a92

View File

@ -7,8 +7,8 @@
#include <linux/gpio/driver.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#define DEFAULT_PIN_NUMBER 16
#define INPUT_REG_OFFSET 0x00
@ -17,7 +17,7 @@
static int ts4800_gpio_probe(struct platform_device *pdev)
{
struct device_node *node;
struct device *dev = &pdev->dev;
struct gpio_chip *chip;
void __iomem *base_addr;
int retval;
@ -31,11 +31,7 @@ static int ts4800_gpio_probe(struct platform_device *pdev)
if (IS_ERR(base_addr))
return PTR_ERR(base_addr);
node = pdev->dev.of_node;
if (!node)
return -EINVAL;
retval = of_property_read_u32(node, "ngpios", &ngpios);
retval = device_property_read_u32(dev, "ngpios", &ngpios);
if (retval == -EINVAL)
ngpios = DEFAULT_PIN_NUMBER;
else if (retval)