aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sysdev.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sysdev.h')
-rw-r--r--include/linux/sysdev.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index f395bb3fa2f2..1154c29f4101 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -27,10 +27,12 @@
27 27
28 28
29struct sys_device; 29struct sys_device;
30struct sysdev_class_attribute;
30 31
31struct sysdev_class { 32struct sysdev_class {
32 const char *name; 33 const char *name;
33 struct list_head drivers; 34 struct list_head drivers;
35 struct sysdev_class_attribute **attrs;
34 36
35 /* Default operations for these types of devices */ 37 /* Default operations for these types of devices */
36 int (*shutdown)(struct sys_device *); 38 int (*shutdown)(struct sys_device *);
@@ -41,8 +43,10 @@ struct sysdev_class {
41 43
42struct sysdev_class_attribute { 44struct sysdev_class_attribute {
43 struct attribute attr; 45 struct attribute attr;
44 ssize_t (*show)(struct sysdev_class *, char *); 46 ssize_t (*show)(struct sysdev_class *, struct sysdev_class_attribute *,
45 ssize_t (*store)(struct sysdev_class *, const char *, size_t); 47 char *);
48 ssize_t (*store)(struct sysdev_class *, struct sysdev_class_attribute *,
49 const char *, size_t);
46}; 50};
47 51
48#define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \ 52#define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \
@@ -119,6 +123,19 @@ struct sysdev_attribute {
119extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); 123extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *);
120extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); 124extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *);
121 125
126/* Create/remove NULL terminated attribute list */
127static inline int
128sysdev_create_files(struct sys_device *d, struct sysdev_attribute **a)
129{
130 return sysfs_create_files(&d->kobj, (const struct attribute **)a);
131}
132
133static inline void
134sysdev_remove_files(struct sys_device *d, struct sysdev_attribute **a)
135{
136 return sysfs_remove_files(&d->kobj, (const struct attribute **)a);
137}
138
122struct sysdev_ext_attribute { 139struct sysdev_ext_attribute {
123 struct sysdev_attribute attr; 140 struct sysdev_attribute attr;
124 void *var; 141 void *var;