diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/sysdev.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h index 8dcf3162b21b..f395bb3fa2f2 100644 --- a/include/linux/sysdev.h +++ b/include/linux/sysdev.h | |||
@@ -119,4 +119,38 @@ struct sysdev_attribute { | |||
119 | extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); | 119 | extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); |
120 | extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); | 120 | extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); |
121 | 121 | ||
122 | struct sysdev_ext_attribute { | ||
123 | struct sysdev_attribute attr; | ||
124 | void *var; | ||
125 | }; | ||
126 | |||
127 | /* | ||
128 | * Support for simple variable sysdev attributes. | ||
129 | * The pointer to the variable is stored in a sysdev_ext_attribute | ||
130 | */ | ||
131 | |||
132 | /* Add more types as needed */ | ||
133 | |||
134 | extern ssize_t sysdev_show_ulong(struct sys_device *, struct sysdev_attribute *, | ||
135 | char *); | ||
136 | extern ssize_t sysdev_store_ulong(struct sys_device *, | ||
137 | struct sysdev_attribute *, const char *, size_t); | ||
138 | extern ssize_t sysdev_show_int(struct sys_device *, struct sysdev_attribute *, | ||
139 | char *); | ||
140 | extern ssize_t sysdev_store_int(struct sys_device *, | ||
141 | struct sysdev_attribute *, const char *, size_t); | ||
142 | |||
143 | #define _SYSDEV_ULONG_ATTR(_name, _mode, _var) \ | ||
144 | { _SYSDEV_ATTR(_name, _mode, sysdev_show_ulong, sysdev_store_ulong), \ | ||
145 | &(_var) } | ||
146 | #define SYSDEV_ULONG_ATTR(_name, _mode, _var) \ | ||
147 | struct sysdev_ext_attribute attr_##_name = \ | ||
148 | _SYSDEV_ULONG_ATTR(_name, _mode, _var); | ||
149 | #define _SYSDEV_INT_ATTR(_name, _mode, _var) \ | ||
150 | { _SYSDEV_ATTR(_name, _mode, sysdev_show_int, sysdev_store_int), \ | ||
151 | &(_var) } | ||
152 | #define SYSDEV_INT_ATTR(_name, _mode, _var) \ | ||
153 | struct sysdev_ext_attribute attr_##_name = \ | ||
154 | _SYSDEV_INT_ATTR(_name, _mode, _var); | ||
155 | |||
122 | #endif /* _SYSDEV_H_ */ | 156 | #endif /* _SYSDEV_H_ */ |