linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: remove spurious gpio_unexport debug error.
@ 2010-07-22 21:05 Gregory Bean
  2010-07-23  4:58 ` Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Gregory Bean @ 2010-07-22 21:05 UTC (permalink / raw)
  To: akpm
  Cc: linux-arm-msm, linux-arm-kernel, linux-kernel, Gregory Bean,
	Jani Nikula, David Brownell, Greg Kroah-Hartman,
	Uwe Kleine-König

Make gpio_unexport generate success instead of an -EINVAL
if asked to unexport a line which is not exported, because
the only result of that condition is a pr_debug
which complains of what is really a harmless no-op:
when an unexported gpio is unexported again, nothing happens.
That's not a failure, just a trivial border case.
Since gpio_free calls gpio_unexport unconditionally
and exported gpio lines are uncommon, most calls to
gpio_free with debug flags enabled generate -EINVAL
warnings in the log, causing unnecessary stress.

Signed-off-by: Gregory Bean <gbean@codeaurora.org>
---
 drivers/gpio/gpiolib.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 3ca3654..b718aea 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -914,7 +914,8 @@ void gpio_unexport(unsigned gpio)
 			status = 0;
 		} else
 			status = -ENODEV;
-	}
+	} else
+		status = 0;
 
 	mutex_unlock(&sysfs_lock);
 done:
-- 
1.7.0.4

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: remove spurious gpio_unexport debug error.
  2010-07-22 21:05 [PATCH] gpio: remove spurious gpio_unexport debug error Gregory Bean
@ 2010-07-23  4:58 ` Uwe Kleine-König
  2010-07-26 22:32   ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2010-07-23  4:58 UTC (permalink / raw)
  To: Gregory Bean
  Cc: akpm, linux-arm-msm, linux-arm-kernel, linux-kernel, Jani Nikula,
	David Brownell, Greg Kroah-Hartman

Hello,

On Thu, Jul 22, 2010 at 02:05:58PM -0700, Gregory Bean wrote:
> Make gpio_unexport generate success instead of an -EINVAL
> if asked to unexport a line which is not exported, because
> the only result of that condition is a pr_debug
> which complains of what is really a harmless no-op:
> when an unexported gpio is unexported again, nothing happens.
> That's not a failure, just a trivial border case.
> Since gpio_free calls gpio_unexport unconditionally
> and exported gpio lines are uncommon, most calls to
> gpio_free with debug flags enabled generate -EINVAL
> warnings in the log, causing unnecessary stress.
I noticed that a few days ago, too.  Just didn't come around to fix it
myself.
 
> Signed-off-by: Gregory Bean <gbean@codeaurora.org>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Thanks
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: remove spurious gpio_unexport debug error.
  2010-07-23  4:58 ` Uwe Kleine-König
@ 2010-07-26 22:32   ` Andrew Morton
  2010-07-27 15:32     ` Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2010-07-26 22:32 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Gregory Bean, linux-arm-msm, linux-arm-kernel, linux-kernel,
	Jani Nikula, David Brownell, Greg Kroah-Hartman, Jon Povey

On Fri, 23 Jul 2010 06:58:07 +0200
Uwe Kleine-K__nig <u.kleine-koenig@pengutronix.de> wrote:

> Hello,
> 
> On Thu, Jul 22, 2010 at 02:05:58PM -0700, Gregory Bean wrote:
> > Make gpio_unexport generate success instead of an -EINVAL
> > if asked to unexport a line which is not exported, because
> > the only result of that condition is a pr_debug
> > which complains of what is really a harmless no-op:
> > when an unexported gpio is unexported again, nothing happens.
> > That's not a failure, just a trivial border case.
> > Since gpio_free calls gpio_unexport unconditionally
> > and exported gpio lines are uncommon, most calls to
> > gpio_free with debug flags enabled generate -EINVAL
> > warnings in the log, causing unnecessary stress.
> I noticed that a few days ago, too.  Just didn't come around to fix it
> myself.
>  
> > Signed-off-by: Gregory Bean <gbean@codeaurora.org>
> Acked-by: Uwe Kleine-K__nig <u.kleine-koenig@pengutronix.de>
> 

Jon got there first ;)



Subject: gpio: fix spurious printk when freeing a gpio


From: Jon Povey <jon.povey@racelogic.co.uk>

When freeing a gpio that has not been exported, gpio_unexport() prints a
debug message when it should just fall through silently.

Example spurious message:

	gpio_unexport: gpio0 status -22

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/gpio/gpiolib.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff -puN drivers/gpio/gpiolib.c~gpio-fix-spurious-printk-when-freeing-a-gpio drivers/gpio/gpiolib.c
--- a/drivers/gpio/gpiolib.c~gpio-fix-spurious-printk-when-freeing-a-gpio
+++ a/drivers/gpio/gpiolib.c
@@ -893,10 +893,12 @@ EXPORT_SYMBOL_GPL(gpio_sysfs_set_active_
 void gpio_unexport(unsigned gpio)
 {
 	struct gpio_desc	*desc;
-	int			status = -EINVAL;
+	int			status = 0;
 
-	if (!gpio_is_valid(gpio))
+	if (!gpio_is_valid(gpio)) {
+		status = -EINVAL;
 		goto done;
+	}
 
 	mutex_lock(&sysfs_lock);
 
@@ -911,7 +913,6 @@ void gpio_unexport(unsigned gpio)
 			clear_bit(FLAG_EXPORT, &desc->flags);
 			put_device(dev);
 			device_unregister(dev);
-			status = 0;
 		} else
 			status = -ENODEV;
 	}
_


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: remove spurious gpio_unexport debug error.
  2010-07-26 22:32   ` Andrew Morton
@ 2010-07-27 15:32     ` Uwe Kleine-König
  0 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2010-07-27 15:32 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Gregory Bean, linux-arm-msm, linux-arm-kernel, linux-kernel,
	Jani Nikula, David Brownell, Greg Kroah-Hartman, Jon Povey

Hello Andrew,

On Mon, Jul 26, 2010 at 03:32:36PM -0700, Andrew Morton wrote:
> On Fri, 23 Jul 2010 06:58:07 +0200
> Uwe Kleine-K__nig <u.kleine-koenig@pengutronix.de> wrote:
> 
> > Hello,
> > 
> > On Thu, Jul 22, 2010 at 02:05:58PM -0700, Gregory Bean wrote:
> > > Make gpio_unexport generate success instead of an -EINVAL
> > > if asked to unexport a line which is not exported, because
> > > the only result of that condition is a pr_debug
> > > which complains of what is really a harmless no-op:
> > > when an unexported gpio is unexported again, nothing happens.
> > > That's not a failure, just a trivial border case.
> > > Since gpio_free calls gpio_unexport unconditionally
> > > and exported gpio lines are uncommon, most calls to
> > > gpio_free with debug flags enabled generate -EINVAL
> > > warnings in the log, causing unnecessary stress.
> > I noticed that a few days ago, too.  Just didn't come around to fix it
> > myself.
> >  
> > > Signed-off-by: Gregory Bean <gbean@codeaurora.org>
> > Acked-by: Uwe Kleine-K__nig <u.kleine-koenig@pengutronix.de>
> > 
> 
> Jon got there first ;)
OK, then he can get my ack, too.

Thanks
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-07-27 15:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-22 21:05 [PATCH] gpio: remove spurious gpio_unexport debug error Gregory Bean
2010-07-23  4:58 ` Uwe Kleine-König
2010-07-26 22:32   ` Andrew Morton
2010-07-27 15:32     ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).