Skip to contentSkip to conversation

gpio-pca953x: fix gpio_base and add verbosity

PATCH In review Hartmut Knaack 2 participants 4 messages Oct 11, 2011 – Oct 13, 2011 GPIO

lore
Share & tools
lore
#0 lore raw

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

Sorry, I messed up the porting from my work files to clean git repo. This should be right now.
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 0721d85..f1a4fad 100644
@@ -687,6 +687,12 @@ static int __devinit pca953x_probe(struct

i2c_client *client,
if (ret)
goto out_failed_irq;

+ 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 (pdata && pdata->setup) {
ret = pdata->setup(client, chip->gpio_chip.base,
chip->gpio_chip.ngpio, pdata->context);

#1 lore raw
Quoted 13 lines · Hartmut Knaack

Sorry, I messed up the porting from my work files to clean git repo. This should be right now.
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 0721d85..f1a4fad 100644

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

Quoted 10 lines
drivers/gpio/gpio-pca953x.c +6 -0
@@ -687,6 +687,12 @@ static int __devinit pca953x_probe(struct
 i2c_client *client,
 	if (ret)
 		goto out_failed_irq;
 
+	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)" : "");
+

dev_dbg() for this I think.

Quoted 4 lines
drivers/gpio/gpio-pca953x.c +0 -0
 	if (pdata && pdata->setup) {
 		ret = pdata->setup(client, chip->gpio_chip.base,

chip->gpio_chip.ngpio, pdata->context);

#2 lore raw
Quoted 18 lines · Grant Likely
Quoted 17 lines · Hartmut Knaack

Sorry, I messed up the porting from my work files to clean git repo. This should be right now.
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 0721d85..f1a4fad 100644
@@ -687,6 +687,12 @@ static int __devinit pca953x_probe(struct
 i2c_client *client,
 	if (ret)
 		goto out_failed_irq;
 
Quoted 7 lines

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

Quoted 6 lines
drivers/gpio/gpio-pca953x.c +6 -0
+	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)" : "");
+

dev_dbg() for this I think.

A short look into all other gpio drivers revealed which functions are normally used for that purpose:
pr_info: gpio-xilinx
dev_info: gpio-pcf857x, gpio-nomadik, gpio-janz-ttl, gpio-cs5535, gpio-adp5588
printk: gpio-bt8xx
I took that one from the pcf857x driver, but personally I also think that info is an appropriate verbosity level.
Empowered by Ryan Mallon's comment I thought about removing those functions from gpio driver code and move it to gpiochip_add function. This way reducing redundancy and improving uniformity. It's just 7 drivers + gpiolib, which need to be changed. What do you think?

Quoted 10 lines
Quoted 4 lines
drivers/gpio/gpio-pca953x.c +0 -0
 	if (pdata && pdata->setup) {
 		ret = pdata->setup(client, chip->gpio_chip.base,

chip->gpio_chip.ngpio, pdata->context);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw
Quoted 26 lines · Hartmut Knaack
Quoted 18 lines · Grant Likely
Quoted 17 lines · Hartmut Knaack

Sorry, I messed up the porting from my work files to clean git repo. This should be right now.
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 0721d85..f1a4fad 100644
@@ -687,6 +687,12 @@ static int __devinit pca953x_probe(struct
 i2c_client *client,
 	if (ret)
 		goto out_failed_irq;
 
Quoted 7 lines

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

Quoted 6 lines
drivers/gpio/gpio-pca953x.c +6 -0
+	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)" : "");
+

dev_dbg() for this I think.

Quoted 10 lines

A short look into all other gpio drivers revealed which functions are normally used for that purpose:
pr_info: gpio-xilinx
dev_info: gpio-pcf857x, gpio-nomadik, gpio-janz-ttl, gpio-cs5535, gpio-adp5588
printk: gpio-bt8xx
I took that one from the pcf857x driver, but personally I also think that info is an appropriate verbosity level.
Empowered by Ryan Mallon's comment I thought about removing those functions from gpio driver code and move it to gpiochip_add function. This way reducing redundancy and improving uniformity. It's just 7 drivers + gpiolib, which need to be changed. What do you think?

Quoted 4 lines
Quoted 4 lines
drivers/gpio/gpio-pca953x.c +0 -0
 	if (pdata && pdata->setup) {
 		ret = pdata->setup(client, chip->gpio_chip.base,

chip->gpio_chip.ngpio, pdata->context);

Draft a patch and we'll see what it looks like.

g.