lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240111131904.1491496-2-hector.palacios@digi.com>
Date: Thu, 11 Jan 2024 14:19:03 +0100
From: Hector Palacios <hector.palacios@...i.com>
To: bartosz.golaszewski@...aro.org,
	linus.walleij@...aro.org
Cc: linux-gpio@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	haibo.chen@....com,
	peng.fan@....com,
	hector.palacios@...i.com
Subject: [PATCH 1/2] gpio: vf610: add support to DT 'ngpios' property

Default to hardcoded VF610_GPIO_PER_PORT (32 pins) but allow optional
generic 'ngpios' property to be specified from the device tree.

Signed-off-by: Hector Palacios <hector.palacios@...i.com>
---
 drivers/gpio/gpio-vf610.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index 07e5e6323e86..4abdf75e9a0a 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -276,6 +276,7 @@ static int vf610_gpio_probe(struct platform_device *pdev)
 	struct vf610_gpio_port *port;
 	struct gpio_chip *gc;
 	struct gpio_irq_chip *girq;
+	u32 ngpios;
 	int i;
 	int ret;
 	bool dual_base;
@@ -353,7 +354,11 @@ static int vf610_gpio_probe(struct platform_device *pdev)
 	gc = &port->gc;
 	gc->parent = dev;
 	gc->label = dev_name(dev);
-	gc->ngpio = VF610_GPIO_PER_PORT;
+	ret = device_property_read_u32(dev, "ngpios", &ngpios);
+	if (ret || ngpios > VF610_GPIO_PER_PORT)
+		gc->ngpio = VF610_GPIO_PER_PORT;
+	else
+		gc->ngpio = (u16)ngpios;
 	gc->base = -1;
 
 	gc->request = gpiochip_generic_request;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ