Skip to contentSkip to conversation

gpiolib: don't bother warning when failing to get gpios

PATCH In review Heikki Krogerus 3 participants 4 messages Nov 29, 2013 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpiolib: don't bother warning when failing to get gpios

It's the drivers responsibility to react on failure to get the gpio descriptors and not the frameworks. Since there are some common peripherals that may or may not have certain pins connected to gpio lines, depending on the platform, printing the warning there may end up generating useless bug reports.

---
 drivers/gpio/gpiolib.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpiolib.c +1 -3
index 4e10b10..2f0305e 100644
@@ -2434,10 +2434,8 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
 		desc = gpiod_find(dev, con_id, idx, &flags);
 	}
 
-	if (IS_ERR(desc)) {
-		dev_warn(dev, "lookup for GPIO %s failed\n", con_id);
+	if (IS_ERR(desc))
 		return desc;
-	}
 
 	status = gpiod_request(desc, con_id);
 
Signature · 1 line
1.8.4.4
#1 lore raw
Quoted 17 lines · Heikki Krogerus

It's the drivers responsibility to react on failure to get the gpio descriptors and not the frameworks. Since there are some common peripherals that may or may not have certain pins connected to gpio lines, depending on the platform, printing the warning there may end up generating useless bug reports.

---
 drivers/gpio/gpiolib.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpiolib.c +0 -0
index 4e10b10..2f0305e 100644

drivers/gpio/gpiolib.c struct gpio_desc *__must_check gpiod_get_index(struct device *dev, · line 2440

Quoted 10 lines
drivers/gpio/gpiolib.c +1 -3
@@ -2434,10 +2434,8 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
                desc = gpiod_find(dev, con_id, idx, &flags);
        }
 
-       if (IS_ERR(desc)) {
-               dev_warn(dev, "lookup for GPIO %s failed\n", con_id);
+       if (IS_ERR(desc))
                return desc;
-       }
 
        status = gpiod_request(desc, con_id);

I kind of agree with the logic that motivates this patch, but how about turning this warning into dev_dbg() instead so that people who wish so can still continue using it?

#2 lore raw

Hi,

Quoted 15 lines · Alexandre Courbot

On Fri, Nov 29, 2013 at 6:16 PM, Heikki Krogerus

Quoted 14 lines
drivers/gpio/gpiolib.c +1 -3
index 4e10b10..2f0305e 100644
@@ -2434,10 +2434,8 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
                desc = gpiod_find(dev, con_id, idx, &flags);
        }
 
-       if (IS_ERR(desc)) {
-               dev_warn(dev, "lookup for GPIO %s failed\n", con_id);
+       if (IS_ERR(desc))
                return desc;
-       }
 
Quoted 5 lines

drivers/gpio/gpiolib.c struct gpio_desc *__must_check gpiod_get_index(struct device *dev, · line 2440

Quoted 1 line
drivers/gpio/gpiolib.c +0 -0
        status = gpiod_request(desc, con_id);

I kind of agree with the logic that motivates this patch, but how about turning this warning into dev_dbg() instead so that people who wish so can still continue using it?

Sure, I'll send v2 of this and do just that.

Thanks,

Signature · 1 line
heikki
#3 lore raw
Quoted 16 lines · Heikki Krogerus
Quoted 15 lines · Alexandre Courbot

On Fri, Nov 29, 2013 at 6:16 PM, Heikki Krogerus

Quoted 14 lines
drivers/gpio/gpiolib.c +1 -3
index 4e10b10..2f0305e 100644
@@ -2434,10 +2434,8 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
                desc = gpiod_find(dev, con_id, idx, &flags);
        }
 
-       if (IS_ERR(desc)) {
-               dev_warn(dev, "lookup for GPIO %s failed\n", con_id);
+       if (IS_ERR(desc))
                return desc;
-       }
 
Quoted 7 lines
Quoted 5 lines

drivers/gpio/gpiolib.c struct gpio_desc *__must_check gpiod_get_index(struct device *dev, · line 2440

Quoted 1 line
drivers/gpio/gpiolib.c +0 -0
        status = gpiod_request(desc, con_id);

I kind of agree with the logic that motivates this patch, but how about turning this warning into dev_dbg() instead so that people who wish so can still continue using it?

Sure, I'll send v2 of this and do just that.

Please do, this has been a bit noisy and should probably go in as a fix.

Yours,
Linus Walleij