public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: linux-kernel@vger.kernel.org
Cc: Russell King <rmk+lkml@arm.linux.org.uk>, Greg KH <greg@kroah.com>
Subject: Re: bus_type->dev_attrs not properly thought out
Date: Sat, 18 Sep 2004 10:43:41 -0500	[thread overview]
Message-ID: <200409181043.42268.dtor_core@ameritech.net> (raw)
In-Reply-To: <20040918155659.B17085@flint.arm.linux.org.uk>

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

  reply	other threads:[~2004-09-18 15:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-18 14:56 bus_type->dev_attrs not properly thought out Russell King
2004-09-18 15:43 ` Dmitry Torokhov [this message]
2004-09-18 15:57   ` Greg KH

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=200409181043.42268.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk+lkml@arm.linux.org.uk \
    /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