diff mbox series

leds: pca9532: Assign gpio base dynamically

Message ID 20210414115124.91416-1-s.riedmueller@phytec.de
State New
Headers show
Series leds: pca9532: Assign gpio base dynamically | expand

Commit Message

Stefan Riedmüller April 14, 2021, 11:51 a.m. UTC
When using devicetree, gpio_base holds its initial zero value which can
lead to a rejection if another gpio controller already occupies this
base. To prevent that collision let the gpio base be assigned dynamically.

Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>
---
 drivers/leds/leds-pca9532.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Pavel Machek April 25, 2021, 10 p.m. UTC | #1
Hi!

> When using devicetree, gpio_base holds its initial zero value which can

> lead to a rejection if another gpio controller already occupies this

> base. To prevent that collision let the gpio base be assigned dynamically.

> 

> Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>


Thanks, applied.
								Pavel
-- 
http://www.livejournal.com/~pavelmachek
diff mbox series

Patch

diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
index 27d027165472..017794bb87ae 100644
--- a/drivers/leds/leds-pca9532.c
+++ b/drivers/leds/leds-pca9532.c
@@ -480,6 +480,8 @@  pca9532_of_populate_pdata(struct device *dev, struct device_node *np)
 	if (!pdata)
 		return ERR_PTR(-ENOMEM);
 
+	pdata->gpio_base = -1;
+
 	of_property_read_u8_array(np, "nxp,pwm", &pdata->pwm[0],
 				  ARRAY_SIZE(pdata->pwm));
 	of_property_read_u8_array(np, "nxp,psc", &pdata->psc[0],