[PATCH linux dev-4.10 v6 2/2] drivers/leds: pca955x count LED lines as GPIO

Christopher Bostic cbostic at linux.vnet.ibm.com
Sun Jul 30 04:36:38 AEST 2017


In order for gpio-keys-polled driver to properly register pins
connected to the pca955x chip it is necessary to count 'LED' lines
as part of the total gpio count.  The assocated gpio_chip struct
for the pca955x is then set to all available I/O (LEDS and 'GPIO').
Failure to do so will cause any pin # > GPIO pin count to fail
gpio-keys-polled probe/registration as it falls outside the bounds
of what the gpio_chip struct indicates is available.

Signed-off-by: Christopher Bostic <cbostic at linux.vnet.ibm.com>
---
 drivers/leds/leds-pca955x.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
index 9216742..4fa58b9 100644
--- a/drivers/leds/leds-pca955x.c
+++ b/drivers/leds/leds-pca955x.c
@@ -472,6 +472,8 @@ static int pca955x_probe(struct i2c_client *client,
 			ngpios++;
 			break;
 		case PCA955X_TYPE_LED:
+			ngpios++;
+
 			/*
 			 * Platform data can specify LED names and
 			 * default triggers
-- 
1.8.2.2



More information about the openbmc mailing list