All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: "Steven A. Falco" <sfalco@harris.com>
Cc: "linuxppc-dev@ozlabs.org" <linuxppc-dev@ozlabs.org>
Subject: Re: [PATCH] Modify sysfs gpio export so that "value" displays as 0 or 1
Date: Thu, 16 Oct 2008 12:46:37 -0700	[thread overview]
Message-ID: <200810161246.38091.david-b@pacbell.net> (raw)
In-Reply-To: <48EF60F1.1010001@harris.com>

On Friday 10 October 2008, Steven A. Falco wrote:
> gpiolib can export GPIOs to userspace via sysfs.  This patch modifies
> the gpio_value_show() so that any non-zero value is explicitly printed
> as "1", rather than whatever numerical value the lower-level driver returns.
> 
> Signed-off-by: Steve Falco <sfalco at harris.com>

I just forwarded this to Andrew (cc LKML) with my
signoff ... sorry I forgot to add you to the CC.  :(


> ---
> 
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 8d29405..36bf72b 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -237,7 +237,7 @@ static ssize_t gpio_value_show(struct device *dev,
>  	if (!test_bit(FLAG_EXPORT, &desc->flags))
>  		status = -EIO;
>  	else
> -		status = sprintf(buf, "%d\n", gpio_get_value_cansleep(gpio));
> +		status = sprintf(buf, "%d\n", !!gpio_get_value_cansleep(gpio));
>  
>  	mutex_unlock(&sysfs_lock);
>  	return status;
> 
> 

      reply	other threads:[~2008-10-16 19:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-10 14:04 [PATCH] Modify sysfs gpio export so that "value" displays as 0 or 1 Steven A. Falco
2008-10-16 19:46 ` David Brownell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200810161246.38091.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=sfalco@harris.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.