Messages in this thread | | | From | Dmitry Torokhov <> | Subject | Re: bus_type->dev_attrs not properly thought out | Date | Sat, 18 Sep 2004 10:43:41 -0500 |
| |
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/
| |