aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sysdev.h
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2006-05-08 01:45:57 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-21 15:40:48 -0400
commit670dd90d81f60ef429cbba54ad235e9207f4d444 (patch)
tree817c62329690f69cb32439d00c25023dfe977402 /include/linux/sysdev.h
parent1740757e8f94c6899705eb6f5434de9404992778 (diff)
[PATCH] Driver Core: Allow sysdev_class have attributes
allow sysdev_class adding attribute. Next patch will use the new API to add an attribute under /sys/device/system/cpu/. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/sysdev.h')
-rw-r--r--include/linux/sysdev.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index 2a4b432e1176..166a2e58c287 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -37,11 +37,27 @@ struct sysdev_class {
37 struct kset kset; 37 struct kset kset;
38}; 38};
39 39
40struct sysdev_class_attribute {
41 struct attribute attr;
42 ssize_t (*show)(struct sysdev_class *, char *);
43 ssize_t (*store)(struct sysdev_class *, const char *, size_t);
44};
45
46#define SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
47struct sysdev_class_attribute attr_##_name = { \
48 .attr = {.name = __stringify(_name), .mode = _mode }, \
49 .show = _show, \
50 .store = _store, \
51};
52
40 53
41extern int sysdev_class_register(struct sysdev_class *); 54extern int sysdev_class_register(struct sysdev_class *);
42extern void sysdev_class_unregister(struct sysdev_class *); 55extern void sysdev_class_unregister(struct sysdev_class *);
43 56
44 57extern int sysdev_class_create_file(struct sysdev_class *,
58 struct sysdev_class_attribute *);
59extern void sysdev_class_remove_file(struct sysdev_class *,
60 struct sysdev_class_attribute *);
45/** 61/**
46 * Auxillary system device drivers. 62 * Auxillary system device drivers.
47 */ 63 */