Skip to contentSkip to conversation

gpio: name PCA953x gpio chips after device name

PATCH New Andy Shevchenko 1 participant 1 message Mar 18, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: name PCA953x gpio chips after device name

From: Linus Walleij <[email protected]>

Instead of using the name directly from the I2C client to name the gpio_chip, use dev_name() on the client->dev, so we get the sometimes more unique device name, as I2C has a mechanism for naming its devices explicitly in e.g. board data.

This is a prerequisite for being able to reference uniquely any I2C GPIO expander defined in a board file when setting up GPIO descriptor tables.

---
Reported in https://stackoverflow.com/questions/60722524/how-to-specify-the-name-of-a-gpiochip-in-the-device-tree

 drivers/gpio/gpio-pca953x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-pca953x.c +1 -1
index 023a32cfac42..540166443c34 100644
@@ -449,7 +449,7 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios)
 
 	gc->base = chip->gpio_start;
 	gc->ngpio = gpios;
-	gc->label = chip->client->name;
+	gc->label = dev_name(&chip->client->dev);
 	gc->parent = &chip->client->dev;
 	gc->owner = THIS_MODULE;
 	gc->names = chip->names;
Signature · 1 line
2.25.1