aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/device.h97
1 files changed, 0 insertions, 97 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 1a060265acea..832fb0eb2933 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -35,7 +35,6 @@ struct device;
35struct device_driver; 35struct device_driver;
36struct driver_private; 36struct driver_private;
37struct class; 37struct class;
38struct class_device;
39struct bus_type; 38struct bus_type;
40struct bus_type_private; 39struct bus_type_private;
41 40
@@ -190,13 +189,10 @@ struct class {
190 struct kset class_dirs; 189 struct kset class_dirs;
191 struct semaphore sem; /* locks children, devices, interfaces */ 190 struct semaphore sem; /* locks children, devices, interfaces */
192 struct class_attribute *class_attrs; 191 struct class_attribute *class_attrs;
193 struct class_device_attribute *class_dev_attrs;
194 struct device_attribute *dev_attrs; 192 struct device_attribute *dev_attrs;
195 193
196 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
197 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 194 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
198 195
199 void (*release)(struct class_device *dev);
200 void (*class_release)(struct class *class); 196 void (*class_release)(struct class *class);
201 void (*dev_release)(struct device *dev); 197 void (*dev_release)(struct device *dev);
202 198
@@ -210,9 +206,6 @@ extern int class_for_each_device(struct class *class, void *data,
210 int (*fn)(struct device *dev, void *data)); 206 int (*fn)(struct device *dev, void *data));
211extern struct device *class_find_device(struct class *class, void *data, 207extern struct device *class_find_device(struct class *class, void *data,
212 int (*match)(struct device *, void *)); 208 int (*match)(struct device *, void *));
213extern struct class_device *class_find_child(struct class *class, void *data,
214 int (*match)(struct class_device *, void *));
215
216 209
217struct class_attribute { 210struct class_attribute {
218 struct attribute attr; 211 struct attribute attr;
@@ -228,92 +221,10 @@ extern int __must_check class_create_file(struct class *class,
228extern void class_remove_file(struct class *class, 221extern void class_remove_file(struct class *class,
229 const struct class_attribute *attr); 222 const struct class_attribute *attr);
230 223
231struct class_device_attribute {
232 struct attribute attr;
233 ssize_t (*show)(struct class_device *, char *buf);
234 ssize_t (*store)(struct class_device *, const char *buf, size_t count);
235};
236
237#define CLASS_DEVICE_ATTR(_name, _mode, _show, _store) \
238struct class_device_attribute class_device_attr_##_name = \
239 __ATTR(_name, _mode, _show, _store)
240
241extern int __must_check class_device_create_file(struct class_device *,
242 const struct class_device_attribute *);
243
244/**
245 * struct class_device - class devices
246 * @class: pointer to the parent class for this class device. This is required.
247 * @devt: for internal use by the driver core only.
248 * @node: for internal use by the driver core only.
249 * @kobj: for internal use by the driver core only.
250 * @groups: optional additional groups to be created
251 * @dev: if set, a symlink to the struct device is created in the sysfs
252 * directory for this struct class device.
253 * @class_data: pointer to whatever you want to store here for this struct
254 * class_device. Use class_get_devdata() and class_set_devdata() to get and
255 * set this pointer.
256 * @parent: pointer to a struct class_device that is the parent of this struct
257 * class_device. If NULL, this class_device will show up at the root of the
258 * struct class in sysfs (which is probably what you want to have happen.)
259 * @release: pointer to a release function for this struct class_device. If
260 * set, this will be called instead of the class specific release function.
261 * Only use this if you want to override the default release function, like
262 * when you are nesting class_device structures.
263 * @uevent: pointer to a uevent function for this struct class_device. If
264 * set, this will be called instead of the class specific uevent function.
265 * Only use this if you want to override the default uevent function, like
266 * when you are nesting class_device structures.
267 */
268struct class_device {
269 struct list_head node;
270
271 struct kobject kobj;
272 struct class *class;
273 dev_t devt;
274 struct device *dev;
275 void *class_data;
276 struct class_device *parent;
277 struct attribute_group **groups;
278
279 void (*release)(struct class_device *dev);
280 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
281 char class_id[BUS_ID_SIZE];
282};
283
284static inline void *class_get_devdata(struct class_device *dev)
285{
286 return dev->class_data;
287}
288
289static inline void class_set_devdata(struct class_device *dev, void *data)
290{
291 dev->class_data = data;
292}
293
294
295extern int __must_check class_device_register(struct class_device *);
296extern void class_device_unregister(struct class_device *);
297extern void class_device_initialize(struct class_device *);
298extern int __must_check class_device_add(struct class_device *);
299extern void class_device_del(struct class_device *);
300
301extern struct class_device *class_device_get(struct class_device *);
302extern void class_device_put(struct class_device *);
303
304extern void class_device_remove_file(struct class_device *,
305 const struct class_device_attribute *);
306extern int __must_check class_device_create_bin_file(struct class_device *,
307 struct bin_attribute *);
308extern void class_device_remove_bin_file(struct class_device *,
309 struct bin_attribute *);
310
311struct class_interface { 224struct class_interface {
312 struct list_head node; 225 struct list_head node;
313 struct class *class; 226 struct class *class;
314 227
315 int (*add) (struct class_device *, struct class_interface *);
316 void (*remove) (struct class_device *, struct class_interface *);
317 int (*add_dev) (struct device *, struct class_interface *); 228 int (*add_dev) (struct device *, struct class_interface *);
318 void (*remove_dev) (struct device *, struct class_interface *); 229 void (*remove_dev) (struct device *, struct class_interface *);
319}; 230};
@@ -323,13 +234,6 @@ extern void class_interface_unregister(struct class_interface *);
323 234
324extern struct class *class_create(struct module *owner, const char *name); 235extern struct class *class_create(struct module *owner, const char *name);
325extern void class_destroy(struct class *cls); 236extern void class_destroy(struct class *cls);
326extern struct class_device *class_device_create(struct class *cls,
327 struct class_device *parent,
328 dev_t devt,
329 struct device *device,
330 const char *fmt, ...)
331 __attribute__((format(printf, 5, 6)));
332extern void class_device_destroy(struct class *cls, dev_t devt);
333 237
334/* 238/*
335 * The type of device, "struct device" is embedded in. A class 239 * The type of device, "struct device" is embedded in. A class
@@ -465,7 +369,6 @@ struct device {
465 spinlock_t devres_lock; 369 spinlock_t devres_lock;
466 struct list_head devres_head; 370 struct list_head devres_head;
467 371
468 /* class_device migration path */
469 struct list_head node; 372 struct list_head node;
470 struct class *class; 373 struct class *class;
471 dev_t devt; /* dev_t, creates the sysfs "dev" */ 374 dev_t devt; /* dev_t, creates the sysfs "dev" */