lkml.org 
[lkml]   [2004]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: bus_type->dev_attrs not properly thought out
Date
On Saturday 18 September 2004 09:56 am, Russell King wrote:

>
> static struct device_attributes mmc_dev_attrs[] = {
> {
> {
> .name = "cid",
> .owner = THIS_MODULE,
> .mode = S_IRUGO,
> },
> .show = mmc_dev_show_cid,
> }, {
> {
> .name = "csd",
> .owner = THIS_MODULE,
> .mode = S_IRUGO,
> },
> .show = mmc_dev_show_csd,
> }, {
> {
> .name = "date",
> .owner = THIS_MODULE,
> .mode = S_IRUGO,
> },
> .show = mmc_dev_show_date,
> }, ... etc ...
> };
>
> Hardly elegant, hardly clean, and hardly foolproof from silly C'n'P
> errors.
>

What's wrong with the following (drivers/input/serio/serio.c):

static struct device_attribute serio_device_attrs[] = {
__ATTR(description, S_IRUGO, serio_show_description, NULL),
__ATTR(driver, S_IWUSR | S_IRUGO, serio_show_driver, serio_rebind_driver),
__ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode),
__ATTR_NULL
};

Pretty compact and expressive IMHO.

--
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:06    [W:0.104 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site