From 8d1290b87459b8fb52a9d9ed5f3c02e7c17aa03c Mon Sep 17 00:00:00 2001 From: Patrick Mochel Date: Wed, 31 Jul 2002 20:48:04 -0700 Subject: driverfs: Declare DEVICE_ATTR macro for initializing device attributes (hide internal format of the structure) --- include/linux/driverfs_fs.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include/linux') diff --git a/include/linux/driverfs_fs.h b/include/linux/driverfs_fs.h index dceb539d91dc..2bfeb8d4acde 100644 --- a/include/linux/driverfs_fs.h +++ b/include/linux/driverfs_fs.h @@ -37,11 +37,18 @@ struct device; struct device_attribute { char * name; mode_t mode; - ssize_t (*show)(struct device * dev, char * buf, size_t count, loff_t off); ssize_t (*store)(struct device * dev, const char * buf, size_t count, loff_t off); }; +#define DEVICE_ATTR(_name,_str,_mode,_show,_store) \ +struct device_attribute dev_attr_##_name = { \ + .name = _str, \ + .mode = _mode, \ + .show = _show, \ + .store = _store, \ +}; + extern int driverfs_create_dir(struct driver_dir_entry *, struct driver_dir_entry *); -- cgit v1.2.3