[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200908041402.00529.david-b@pacbell.net>
Date: Tue, 4 Aug 2009 14:02:00 -0700
From: David Brownell <david-b@...bell.net>
To: ben@...ff.org
Cc: linux-kernel@...r.kernel.org, akpm@...ux-foundation.org
Subject: Re: gpiolib: add names file in gpio chip sysfs.
On Monday 03 August 2009, ben@...ff.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);
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists