Skip to contentSkip to conversation

gpio-pca953x: fix gpio_base and add verbosity

PATCH Superseded Hartmut Knaack 2 participants 2 messages Oct 10, 2011 GPIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 gpio-pca953x: fix gpio_base and add verbosity

Inspired by the gpio-pcf857x driver, this patch will output information about the instantiated gpio-chip, including gpio start and end, chip type and if irq is used.

-------------------------------------------------------------

drivers/gpio/gpio-pca953x.c +0 -0
index ae479fd..4bdb88e 100644
@@ -683,6 +683,12 @@ static int __devinit pca953x_probe(struct

i2c_client *client,

     if (ret)
         goto out_failed;

+ dev_info(&client->dev, "gpios %d..%d added on a %s%s\n",

+         chip->gpio_chip.base,
+         chip->gpio_chip.base + chip->gpio_chip.ngpio - 1,
+         client->name,
+         client->irq ? " (irq ignored)" : "");
+   
     ret = gpiochip_add(&chip->gpio_chip);
     if (ret)
         goto out_failed_irq;
#1 lore raw
Quoted 11 lines · Hartmut Knaack

Inspired by the gpio-pcf857x driver, this patch will output information about the instantiated gpio-chip, including gpio start and end, chip type and if irq is used.

-------------------------------------------------------------

drivers/gpio/gpio-pca953x.c +0 -0
index ae479fd..4bdb88e 100644

drivers/gpio/gpio-pca953x.c static int __devinit pca953x_probe(struct · line 692

Quoted 10 lines
drivers/gpio/gpio-pca953x.c +6 -0
@@ -683,6 +683,12 @@ static int __devinit pca953x_probe(struct
 i2c_client *client,
     if (ret)
         goto out_failed;
 
+    dev_info(&client->dev, "gpios %d..%d added on a %s%s\n",
+         chip->gpio_chip.base,
+         chip->gpio_chip.base + chip->gpio_chip.ngpio - 1,
+         client->name,
+         client->irq ? " (irq ignored)" : "");
+   

If we want this, why not move it into gpiochip_add rather than duplicating it in each driver? If you want to keep it here it should probably be moved below the gpiochip_add, since the above would still print if gpiochip_add failed.

Quoted 4 lines
drivers/gpio/gpio-pca953x.c +0 -0
     ret = gpiochip_add(&chip->gpio_chip);
     if (ret)
         goto out_failed_irq;

~Ryan