]> git.hungrycats.org Git - linux/commitdiff
driverfs: Declare DEVICE_ATTR macro for initializing device attributes
authorPatrick Mochel <mochel@osdl.org>
Thu, 1 Aug 2002 03:48:04 +0000 (20:48 -0700)
committerPatrick Mochel <mochel@osdl.org>
Thu, 1 Aug 2002 03:48:04 +0000 (20:48 -0700)
(hide internal format of the structure)

include/linux/driverfs_fs.h

index dceb539d91dcf2ab37581328eb5ce3399a32cd0a..2bfeb8d4acde86a51048d4eebc6ce11774bcd3aa 100644 (file)
@@ -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 *);