sched: eliminate rq_clock() use
[usb.git] / drivers / base / class.c
blob4d2222618b780f47dfa54e40246dbd9e4c8bdcc7
1 /*
2 * class.c - basic device class management
4 * Copyright (c) 2002-3 Patrick Mochel
5 * Copyright (c) 2002-3 Open Source Development Labs
6 * Copyright (c) 2003-2004 Greg Kroah-Hartman
7 * Copyright (c) 2003-2004 IBM Corp.
9 * This file is released under the GPLv2
13 #include <linux/device.h>
14 #include <linux/module.h>
15 #include <linux/init.h>
16 #include <linux/string.h>
17 #include <linux/kdev_t.h>
18 #include <linux/err.h>
19 #include <linux/slab.h>
20 #include "base.h"
22 #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr)
23 #define to_class(obj) container_of(obj, struct class, subsys.kobj)
25 static ssize_t
26 class_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
28 struct class_attribute * class_attr = to_class_attr(attr);
29 struct class * dc = to_class(kobj);
30 ssize_t ret = -EIO;
32 if (class_attr->show)
33 ret = class_attr->show(dc, buf);
34 return ret;
37 static ssize_t
38 class_attr_store(struct kobject * kobj, struct attribute * attr,
39 const char * buf, size_t count)
41 struct class_attribute * class_attr = to_class_attr(attr);
42 struct class * dc = to_class(kobj);
43 ssize_t ret = -EIO;
45 if (class_attr->store)
46 ret = class_attr->store(dc, buf, count);
47 return ret;
50 static void class_release(struct kobject * kobj)
52 struct class *class = to_class(kobj);
54 pr_debug("class '%s': release.\n", class->name);
56 if (class->class_release)
57 class->class_release(class);
58 else
59 pr_debug("class '%s' does not have a release() function, "
60 "be careful\n", class->name);
63 static struct sysfs_ops class_sysfs_ops = {
64 .show = class_attr_show,
65 .store = class_attr_store,
68 static struct kobj_type ktype_class = {
69 .sysfs_ops = &class_sysfs_ops,
70 .release = class_release,
73 /* Hotplug events for classes go to the class_obj subsys */
74 static decl_subsys(class, &ktype_class, NULL);
77 int class_create_file(struct class * cls, const struct class_attribute * attr)
79 int error;
80 if (cls) {
81 error = sysfs_create_file(&cls->subsys.kobj, &attr->attr);
82 } else
83 error = -EINVAL;
84 return error;
87 void class_remove_file(struct class * cls, const struct class_attribute * attr)
89 if (cls)
90 sysfs_remove_file(&cls->subsys.kobj, &attr->attr);
93 static struct class *class_get(struct class *cls)
95 if (cls)
96 return container_of(subsys_get(&cls->subsys), struct class, subsys);
97 return NULL;
100 static void class_put(struct class * cls)
102 if (cls)
103 subsys_put(&cls->subsys);
107 static int add_class_attrs(struct class * cls)
109 int i;
110 int error = 0;
112 if (cls->class_attrs) {
113 for (i = 0; attr_name(cls->class_attrs[i]); i++) {
114 error = class_create_file(cls,&cls->class_attrs[i]);
115 if (error)
116 goto Err;
119 Done:
120 return error;
121 Err:
122 while (--i >= 0)
123 class_remove_file(cls,&cls->class_attrs[i]);
124 goto Done;
127 static void remove_class_attrs(struct class * cls)
129 int i;
131 if (cls->class_attrs) {
132 for (i = 0; attr_name(cls->class_attrs[i]); i++)
133 class_remove_file(cls,&cls->class_attrs[i]);
137 int class_register(struct class * cls)
139 int error;
141 pr_debug("device class '%s': registering\n", cls->name);
143 INIT_LIST_HEAD(&cls->children);
144 INIT_LIST_HEAD(&cls->devices);
145 INIT_LIST_HEAD(&cls->interfaces);
146 kset_init(&cls->class_dirs);
147 init_MUTEX(&cls->sem);
148 error = kobject_set_name(&cls->subsys.kobj, "%s", cls->name);
149 if (error)
150 return error;
152 subsys_set_kset(cls, class_subsys);
154 error = subsystem_register(&cls->subsys);
155 if (!error) {
156 error = add_class_attrs(class_get(cls));
157 class_put(cls);
159 return error;
162 void class_unregister(struct class * cls)
164 pr_debug("device class '%s': unregistering\n", cls->name);
165 remove_class_attrs(cls);
166 subsystem_unregister(&cls->subsys);
169 static void class_create_release(struct class *cls)
171 pr_debug("%s called for %s\n", __FUNCTION__, cls->name);
172 kfree(cls);
175 static void class_device_create_release(struct class_device *class_dev)
177 pr_debug("%s called for %s\n", __FUNCTION__, class_dev->class_id);
178 kfree(class_dev);
181 /* needed to allow these devices to have parent class devices */
182 static int class_device_create_uevent(struct class_device *class_dev,
183 char **envp, int num_envp,
184 char *buffer, int buffer_size)
186 pr_debug("%s called for %s\n", __FUNCTION__, class_dev->class_id);
187 return 0;
191 * class_create - create a struct class structure
192 * @owner: pointer to the module that is to "own" this struct class
193 * @name: pointer to a string for the name of this class.
195 * This is used to create a struct class pointer that can then be used
196 * in calls to class_device_create().
198 * Note, the pointer created here is to be destroyed when finished by
199 * making a call to class_destroy().
201 struct class *class_create(struct module *owner, const char *name)
203 struct class *cls;
204 int retval;
206 cls = kzalloc(sizeof(*cls), GFP_KERNEL);
207 if (!cls) {
208 retval = -ENOMEM;
209 goto error;
212 cls->name = name;
213 cls->owner = owner;
214 cls->class_release = class_create_release;
215 cls->release = class_device_create_release;
217 retval = class_register(cls);
218 if (retval)
219 goto error;
221 return cls;
223 error:
224 kfree(cls);
225 return ERR_PTR(retval);
229 * class_destroy - destroys a struct class structure
230 * @cls: pointer to the struct class that is to be destroyed
232 * Note, the pointer to be destroyed must have been created with a call
233 * to class_create().
235 void class_destroy(struct class *cls)
237 if ((cls == NULL) || (IS_ERR(cls)))
238 return;
240 class_unregister(cls);
243 /* Class Device Stuff */
245 int class_device_create_file(struct class_device * class_dev,
246 const struct class_device_attribute * attr)
248 int error = -EINVAL;
249 if (class_dev)
250 error = sysfs_create_file(&class_dev->kobj, &attr->attr);
251 return error;
254 void class_device_remove_file(struct class_device * class_dev,
255 const struct class_device_attribute * attr)
257 if (class_dev)
258 sysfs_remove_file(&class_dev->kobj, &attr->attr);
261 int class_device_create_bin_file(struct class_device *class_dev,
262 struct bin_attribute *attr)
264 int error = -EINVAL;
265 if (class_dev)
266 error = sysfs_create_bin_file(&class_dev->kobj, attr);
267 return error;
270 void class_device_remove_bin_file(struct class_device *class_dev,
271 struct bin_attribute *attr)
273 if (class_dev)
274 sysfs_remove_bin_file(&class_dev->kobj, attr);
277 static ssize_t
278 class_device_attr_show(struct kobject * kobj, struct attribute * attr,
279 char * buf)
281 struct class_device_attribute * class_dev_attr = to_class_dev_attr(attr);
282 struct class_device * cd = to_class_dev(kobj);
283 ssize_t ret = 0;
285 if (class_dev_attr->show)
286 ret = class_dev_attr->show(cd, buf);
287 return ret;
290 static ssize_t
291 class_device_attr_store(struct kobject * kobj, struct attribute * attr,
292 const char * buf, size_t count)
294 struct class_device_attribute * class_dev_attr = to_class_dev_attr(attr);
295 struct class_device * cd = to_class_dev(kobj);
296 ssize_t ret = 0;
298 if (class_dev_attr->store)
299 ret = class_dev_attr->store(cd, buf, count);
300 return ret;
303 static struct sysfs_ops class_dev_sysfs_ops = {
304 .show = class_device_attr_show,
305 .store = class_device_attr_store,
308 static void class_dev_release(struct kobject * kobj)
310 struct class_device *cd = to_class_dev(kobj);
311 struct class * cls = cd->class;
313 pr_debug("device class '%s': release.\n", cd->class_id);
315 if (cd->release)
316 cd->release(cd);
317 else if (cls->release)
318 cls->release(cd);
319 else {
320 printk(KERN_ERR "Class Device '%s' does not have a release() function, "
321 "it is broken and must be fixed.\n",
322 cd->class_id);
323 WARN_ON(1);
327 static struct kobj_type ktype_class_device = {
328 .sysfs_ops = &class_dev_sysfs_ops,
329 .release = class_dev_release,
332 static int class_uevent_filter(struct kset *kset, struct kobject *kobj)
334 struct kobj_type *ktype = get_ktype(kobj);
336 if (ktype == &ktype_class_device) {
337 struct class_device *class_dev = to_class_dev(kobj);
338 if (class_dev->class)
339 return 1;
341 return 0;
344 static const char *class_uevent_name(struct kset *kset, struct kobject *kobj)
346 struct class_device *class_dev = to_class_dev(kobj);
348 return class_dev->class->name;
351 #ifdef CONFIG_SYSFS_DEPRECATED
352 char *make_class_name(const char *name, struct kobject *kobj)
354 char *class_name;
355 int size;
357 size = strlen(name) + strlen(kobject_name(kobj)) + 2;
359 class_name = kmalloc(size, GFP_KERNEL);
360 if (!class_name)
361 return NULL;
363 strcpy(class_name, name);
364 strcat(class_name, ":");
365 strcat(class_name, kobject_name(kobj));
366 return class_name;
369 static int make_deprecated_class_device_links(struct class_device *class_dev)
371 char *class_name;
372 int error;
374 if (!class_dev->dev)
375 return 0;
377 class_name = make_class_name(class_dev->class->name, &class_dev->kobj);
378 if (class_name)
379 error = sysfs_create_link(&class_dev->dev->kobj,
380 &class_dev->kobj, class_name);
381 else
382 error = -ENOMEM;
383 kfree(class_name);
384 return error;
387 static void remove_deprecated_class_device_links(struct class_device *class_dev)
389 char *class_name;
391 if (!class_dev->dev)
392 return;
394 class_name = make_class_name(class_dev->class->name, &class_dev->kobj);
395 if (class_name)
396 sysfs_remove_link(&class_dev->dev->kobj, class_name);
397 kfree(class_name);
399 #else
400 static inline int make_deprecated_class_device_links(struct class_device *cd)
401 { return 0; }
402 static void remove_deprecated_class_device_links(struct class_device *cd)
404 #endif
406 static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp,
407 int num_envp, char *buffer, int buffer_size)
409 struct class_device *class_dev = to_class_dev(kobj);
410 struct device *dev = class_dev->dev;
411 int i = 0;
412 int length = 0;
413 int retval = 0;
415 pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id);
417 if (MAJOR(class_dev->devt)) {
418 add_uevent_var(envp, num_envp, &i,
419 buffer, buffer_size, &length,
420 "MAJOR=%u", MAJOR(class_dev->devt));
422 add_uevent_var(envp, num_envp, &i,
423 buffer, buffer_size, &length,
424 "MINOR=%u", MINOR(class_dev->devt));
427 if (dev) {
428 const char *path = kobject_get_path(&dev->kobj, GFP_KERNEL);
429 if (path) {
430 add_uevent_var(envp, num_envp, &i,
431 buffer, buffer_size, &length,
432 "PHYSDEVPATH=%s", path);
433 kfree(path);
436 if (dev->bus)
437 add_uevent_var(envp, num_envp, &i,
438 buffer, buffer_size, &length,
439 "PHYSDEVBUS=%s", dev->bus->name);
441 if (dev->driver)
442 add_uevent_var(envp, num_envp, &i,
443 buffer, buffer_size, &length,
444 "PHYSDEVDRIVER=%s", dev->driver->name);
447 /* terminate, set to next free slot, shrink available space */
448 envp[i] = NULL;
449 envp = &envp[i];
450 num_envp -= i;
451 buffer = &buffer[length];
452 buffer_size -= length;
454 if (class_dev->uevent) {
455 /* have the class device specific function add its stuff */
456 retval = class_dev->uevent(class_dev, envp, num_envp,
457 buffer, buffer_size);
458 if (retval)
459 pr_debug("class_dev->uevent() returned %d\n", retval);
460 } else if (class_dev->class->uevent) {
461 /* have the class specific function add its stuff */
462 retval = class_dev->class->uevent(class_dev, envp, num_envp,
463 buffer, buffer_size);
464 if (retval)
465 pr_debug("class->uevent() returned %d\n", retval);
468 return retval;
471 static struct kset_uevent_ops class_uevent_ops = {
472 .filter = class_uevent_filter,
473 .name = class_uevent_name,
474 .uevent = class_uevent,
477 static decl_subsys(class_obj, &ktype_class_device, &class_uevent_ops);
480 static int class_device_add_attrs(struct class_device * cd)
482 int i;
483 int error = 0;
484 struct class * cls = cd->class;
486 if (cls->class_dev_attrs) {
487 for (i = 0; attr_name(cls->class_dev_attrs[i]); i++) {
488 error = class_device_create_file(cd,
489 &cls->class_dev_attrs[i]);
490 if (error)
491 goto Err;
494 Done:
495 return error;
496 Err:
497 while (--i >= 0)
498 class_device_remove_file(cd,&cls->class_dev_attrs[i]);
499 goto Done;
502 static void class_device_remove_attrs(struct class_device * cd)
504 int i;
505 struct class * cls = cd->class;
507 if (cls->class_dev_attrs) {
508 for (i = 0; attr_name(cls->class_dev_attrs[i]); i++)
509 class_device_remove_file(cd,&cls->class_dev_attrs[i]);
513 static int class_device_add_groups(struct class_device * cd)
515 int i;
516 int error = 0;
518 if (cd->groups) {
519 for (i = 0; cd->groups[i]; i++) {
520 error = sysfs_create_group(&cd->kobj, cd->groups[i]);
521 if (error) {
522 while (--i >= 0)
523 sysfs_remove_group(&cd->kobj, cd->groups[i]);
524 goto out;
528 out:
529 return error;
532 static void class_device_remove_groups(struct class_device * cd)
534 int i;
535 if (cd->groups) {
536 for (i = 0; cd->groups[i]; i++) {
537 sysfs_remove_group(&cd->kobj, cd->groups[i]);
542 static ssize_t show_dev(struct class_device *class_dev, char *buf)
544 return print_dev_t(buf, class_dev->devt);
547 static struct class_device_attribute class_devt_attr =
548 __ATTR(dev, S_IRUGO, show_dev, NULL);
550 static ssize_t store_uevent(struct class_device *class_dev,
551 const char *buf, size_t count)
553 kobject_uevent(&class_dev->kobj, KOBJ_ADD);
554 return count;
557 static struct class_device_attribute class_uevent_attr =
558 __ATTR(uevent, S_IWUSR, NULL, store_uevent);
560 void class_device_initialize(struct class_device *class_dev)
562 kobj_set_kset_s(class_dev, class_obj_subsys);
563 kobject_init(&class_dev->kobj);
564 INIT_LIST_HEAD(&class_dev->node);
567 int class_device_add(struct class_device *class_dev)
569 struct class *parent_class = NULL;
570 struct class_device *parent_class_dev = NULL;
571 struct class_interface *class_intf;
572 int error = -EINVAL;
574 class_dev = class_device_get(class_dev);
575 if (!class_dev)
576 return -EINVAL;
578 if (!strlen(class_dev->class_id))
579 goto out1;
581 parent_class = class_get(class_dev->class);
582 if (!parent_class)
583 goto out1;
585 parent_class_dev = class_device_get(class_dev->parent);
587 pr_debug("CLASS: registering class device: ID = '%s'\n",
588 class_dev->class_id);
590 /* first, register with generic layer. */
591 error = kobject_set_name(&class_dev->kobj, "%s", class_dev->class_id);
592 if (error)
593 goto out2;
595 if (parent_class_dev)
596 class_dev->kobj.parent = &parent_class_dev->kobj;
597 else
598 class_dev->kobj.parent = &parent_class->subsys.kobj;
600 error = kobject_add(&class_dev->kobj);
601 if (error)
602 goto out2;
604 /* add the needed attributes to this device */
605 error = sysfs_create_link(&class_dev->kobj,
606 &parent_class->subsys.kobj, "subsystem");
607 if (error)
608 goto out3;
610 error = class_device_create_file(class_dev, &class_uevent_attr);
611 if (error)
612 goto out3;
614 if (MAJOR(class_dev->devt)) {
615 error = class_device_create_file(class_dev, &class_devt_attr);
616 if (error)
617 goto out4;
620 error = class_device_add_attrs(class_dev);
621 if (error)
622 goto out5;
624 if (class_dev->dev) {
625 error = sysfs_create_link(&class_dev->kobj,
626 &class_dev->dev->kobj, "device");
627 if (error)
628 goto out6;
631 error = class_device_add_groups(class_dev);
632 if (error)
633 goto out7;
635 error = make_deprecated_class_device_links(class_dev);
636 if (error)
637 goto out8;
639 kobject_uevent(&class_dev->kobj, KOBJ_ADD);
641 /* notify any interfaces this device is now here */
642 down(&parent_class->sem);
643 list_add_tail(&class_dev->node, &parent_class->children);
644 list_for_each_entry(class_intf, &parent_class->interfaces, node) {
645 if (class_intf->add)
646 class_intf->add(class_dev, class_intf);
648 up(&parent_class->sem);
650 goto out1;
652 out8:
653 class_device_remove_groups(class_dev);
654 out7:
655 if (class_dev->dev)
656 sysfs_remove_link(&class_dev->kobj, "device");
657 out6:
658 class_device_remove_attrs(class_dev);
659 out5:
660 if (MAJOR(class_dev->devt))
661 class_device_remove_file(class_dev, &class_devt_attr);
662 out4:
663 class_device_remove_file(class_dev, &class_uevent_attr);
664 out3:
665 kobject_del(&class_dev->kobj);
666 out2:
667 if(parent_class_dev)
668 class_device_put(parent_class_dev);
669 class_put(parent_class);
670 out1:
671 class_device_put(class_dev);
672 return error;
675 int class_device_register(struct class_device *class_dev)
677 class_device_initialize(class_dev);
678 return class_device_add(class_dev);
682 * class_device_create - creates a class device and registers it with sysfs
683 * @cls: pointer to the struct class that this device should be registered to.
684 * @parent: pointer to the parent struct class_device of this new device, if any.
685 * @devt: the dev_t for the char device to be added.
686 * @device: a pointer to a struct device that is assiociated with this class device.
687 * @fmt: string for the class device's name
689 * This function can be used by char device classes. A struct
690 * class_device will be created in sysfs, registered to the specified
691 * class.
692 * A "dev" file will be created, showing the dev_t for the device, if
693 * the dev_t is not 0,0.
694 * If a pointer to a parent struct class_device is passed in, the newly
695 * created struct class_device will be a child of that device in sysfs.
696 * The pointer to the struct class_device will be returned from the
697 * call. Any further sysfs files that might be required can be created
698 * using this pointer.
700 * Note: the struct class passed to this function must have previously
701 * been created with a call to class_create().
703 struct class_device *class_device_create(struct class *cls,
704 struct class_device *parent,
705 dev_t devt,
706 struct device *device,
707 const char *fmt, ...)
709 va_list args;
710 struct class_device *class_dev = NULL;
711 int retval = -ENODEV;
713 if (cls == NULL || IS_ERR(cls))
714 goto error;
716 class_dev = kzalloc(sizeof(*class_dev), GFP_KERNEL);
717 if (!class_dev) {
718 retval = -ENOMEM;
719 goto error;
722 class_dev->devt = devt;
723 class_dev->dev = device;
724 class_dev->class = cls;
725 class_dev->parent = parent;
726 class_dev->release = class_device_create_release;
727 class_dev->uevent = class_device_create_uevent;
729 va_start(args, fmt);
730 vsnprintf(class_dev->class_id, BUS_ID_SIZE, fmt, args);
731 va_end(args);
732 retval = class_device_register(class_dev);
733 if (retval)
734 goto error;
736 return class_dev;
738 error:
739 kfree(class_dev);
740 return ERR_PTR(retval);
743 void class_device_del(struct class_device *class_dev)
745 struct class *parent_class = class_dev->class;
746 struct class_device *parent_device = class_dev->parent;
747 struct class_interface *class_intf;
749 if (parent_class) {
750 down(&parent_class->sem);
751 list_del_init(&class_dev->node);
752 list_for_each_entry(class_intf, &parent_class->interfaces, node)
753 if (class_intf->remove)
754 class_intf->remove(class_dev, class_intf);
755 up(&parent_class->sem);
758 if (class_dev->dev) {
759 remove_deprecated_class_device_links(class_dev);
760 sysfs_remove_link(&class_dev->kobj, "device");
762 sysfs_remove_link(&class_dev->kobj, "subsystem");
763 class_device_remove_file(class_dev, &class_uevent_attr);
764 if (MAJOR(class_dev->devt))
765 class_device_remove_file(class_dev, &class_devt_attr);
766 class_device_remove_attrs(class_dev);
767 class_device_remove_groups(class_dev);
769 kobject_uevent(&class_dev->kobj, KOBJ_REMOVE);
770 kobject_del(&class_dev->kobj);
772 class_device_put(parent_device);
773 class_put(parent_class);
776 void class_device_unregister(struct class_device *class_dev)
778 pr_debug("CLASS: Unregistering class device. ID = '%s'\n",
779 class_dev->class_id);
780 class_device_del(class_dev);
781 class_device_put(class_dev);
785 * class_device_destroy - removes a class device that was created with class_device_create()
786 * @cls: the pointer to the struct class that this device was registered * with.
787 * @devt: the dev_t of the device that was previously registered.
789 * This call unregisters and cleans up a class device that was created with a
790 * call to class_device_create()
792 void class_device_destroy(struct class *cls, dev_t devt)
794 struct class_device *class_dev = NULL;
795 struct class_device *class_dev_tmp;
797 down(&cls->sem);
798 list_for_each_entry(class_dev_tmp, &cls->children, node) {
799 if (class_dev_tmp->devt == devt) {
800 class_dev = class_dev_tmp;
801 break;
804 up(&cls->sem);
806 if (class_dev)
807 class_device_unregister(class_dev);
810 struct class_device * class_device_get(struct class_device *class_dev)
812 if (class_dev)
813 return to_class_dev(kobject_get(&class_dev->kobj));
814 return NULL;
817 void class_device_put(struct class_device *class_dev)
819 if (class_dev)
820 kobject_put(&class_dev->kobj);
824 int class_interface_register(struct class_interface *class_intf)
826 struct class *parent;
827 struct class_device *class_dev;
828 struct device *dev;
830 if (!class_intf || !class_intf->class)
831 return -ENODEV;
833 parent = class_get(class_intf->class);
834 if (!parent)
835 return -EINVAL;
837 down(&parent->sem);
838 list_add_tail(&class_intf->node, &parent->interfaces);
839 if (class_intf->add) {
840 list_for_each_entry(class_dev, &parent->children, node)
841 class_intf->add(class_dev, class_intf);
843 if (class_intf->add_dev) {
844 list_for_each_entry(dev, &parent->devices, node)
845 class_intf->add_dev(dev, class_intf);
847 up(&parent->sem);
849 return 0;
852 void class_interface_unregister(struct class_interface *class_intf)
854 struct class * parent = class_intf->class;
855 struct class_device *class_dev;
856 struct device *dev;
858 if (!parent)
859 return;
861 down(&parent->sem);
862 list_del_init(&class_intf->node);
863 if (class_intf->remove) {
864 list_for_each_entry(class_dev, &parent->children, node)
865 class_intf->remove(class_dev, class_intf);
867 if (class_intf->remove_dev) {
868 list_for_each_entry(dev, &parent->devices, node)
869 class_intf->remove_dev(dev, class_intf);
871 up(&parent->sem);
873 class_put(parent);
876 int __init classes_init(void)
878 int retval;
880 retval = subsystem_register(&class_subsys);
881 if (retval)
882 return retval;
884 /* ick, this is ugly, the things we go through to keep from showing up
885 * in sysfs... */
886 subsystem_init(&class_obj_subsys);
887 if (!class_obj_subsys.kobj.parent)
888 class_obj_subsys.kobj.parent = &class_obj_subsys.kobj;
889 return 0;
892 EXPORT_SYMBOL_GPL(class_create_file);
893 EXPORT_SYMBOL_GPL(class_remove_file);
894 EXPORT_SYMBOL_GPL(class_register);
895 EXPORT_SYMBOL_GPL(class_unregister);
896 EXPORT_SYMBOL_GPL(class_create);
897 EXPORT_SYMBOL_GPL(class_destroy);
899 EXPORT_SYMBOL_GPL(class_device_register);
900 EXPORT_SYMBOL_GPL(class_device_unregister);
901 EXPORT_SYMBOL_GPL(class_device_initialize);
902 EXPORT_SYMBOL_GPL(class_device_add);
903 EXPORT_SYMBOL_GPL(class_device_del);
904 EXPORT_SYMBOL_GPL(class_device_get);
905 EXPORT_SYMBOL_GPL(class_device_put);
906 EXPORT_SYMBOL_GPL(class_device_create);
907 EXPORT_SYMBOL_GPL(class_device_destroy);
908 EXPORT_SYMBOL_GPL(class_device_create_file);
909 EXPORT_SYMBOL_GPL(class_device_remove_file);
910 EXPORT_SYMBOL_GPL(class_device_create_bin_file);
911 EXPORT_SYMBOL_GPL(class_device_remove_bin_file);
913 EXPORT_SYMBOL_GPL(class_interface_register);
914 EXPORT_SYMBOL_GPL(class_interface_unregister);