public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: ben@fluff.org
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: gpiolib: add names file in gpio chip sysfs.
Date: Tue, 4 Aug 2009 14:02:00 -0700	[thread overview]
Message-ID: <200908041402.00529.david-b@pacbell.net> (raw)
In-Reply-To: <20090803165536.345974601@fluff.org>

On Monday 03 August 2009, ben@fluff.org wrote:
> +static ssize_t chip_names_show(struct device *dev,
> +                              struct device_attribute *attr, char *buf)
> +{
> +       const struct gpio_chip*chip = dev_get_drvdata(dev);
> +       char **names = chip->names;
> +       int ptr = 0;
> +       int name;
> +
> +       if (!names)
> +               return -EINVAL;
> +
> +       for (name = 0; name < chip->ngpio && ptr < PAGE_SIZE; name++)
> +               ptr += snprintf(buf + ptr, PAGE_SIZE - ptr,
> +                               "%s\n", names[name] ? names[name] : "");

Surely the actual GPIO number should be there too?

This whole chip->names thing still seems odd to me,
since it's creating a redundant namespace.


> +
> +       return ptr;
> +}
> +DEVICE_ATTR(names, 0444, chip_names_show, NULL);
> +




  reply	other threads:[~2009-08-05  0:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-03 16:55 gpiolib: add names file in gpio chip sysfs ben
2009-08-04 21:02 ` David Brownell [this message]
2009-08-04 23:43 ` Andrew Morton
2009-09-29 10:47   ` Ben Dooks
2009-09-29 19:34     ` Andrew Morton

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=200908041402.00529.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=akpm@linux-foundation.org \
    --cc=ben@fluff.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox