[PATCH] Switch Kprobes inline functions to __kprobes for x86_64
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / base / class.c
blob0e71dff327cd896509060a66f9fe348972253460
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/config.h>
14 #include <linux/device.h>
15 #include <linux/module.h>
16 #include <linux/init.h>
17 #include <linux/string.h>
18 #include <linux/kdev_t.h>
19 #include <linux/err.h>
20 #include <linux/slab.h>
21 #include "base.h"
23 #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr)
24 #define to_class(obj) container_of(obj, struct class, subsys.kset.kobj)
26 static ssize_t
27 class_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
29 struct class_attribute * class_attr = to_class_attr(attr);
30 struct class * dc = to_class(kobj);
31 ssize_t ret = -EIO;
33 if (class_attr->show)
34 ret = class_attr->show(dc, buf);
35 return ret;
38 static ssize_t
39 class_attr_store(struct kobject * kobj, struct attribute * attr,
40 const char * buf, size_t count)
42 struct class_attribute * class_attr = to_class_attr(attr);
43 struct class * dc = to_class(kobj);
44 ssize_t ret = -EIO;
46 if (class_attr->store)
47 ret = class_attr->store(dc, buf, count);
48 return ret;
51 static void class_release(struct kobject * kobj)
53 struct class *class = to_class(kobj);
55 pr_debug("class '%s': release.\n", class->name);
57 if (class->class_release)
58 class->class_release(class);
59 else
60 pr_debug("class '%s' does not have a release() function, "
61 "be careful\n", class->name);
64 static struct sysfs_ops class_sysfs_ops = {
65 .show = class_attr_show,
66 .store = class_attr_store,
69 static struct kobj_type ktype_class = {
70 .sysfs_ops = &class_sysfs_ops,
71 .release = class_release,
74 /* Hotplug events for classes go to the class_obj subsys */
75 static decl_subsys(class, &ktype_class, NULL);
78 int class_create_file(struct class * cls, const struct class_attribute * attr)
80 int error;
81 if (cls) {
82 error = sysfs_create_file(&cls->subsys.kset.kobj, &attr->attr);
83 } else
84 error = -EINVAL;
85 return error;
88 void class_remove_file(struct class * cls, const struct class_attribute * attr)
90 if (cls)
91 sysfs_remove_file(&cls->subsys.kset.kobj, &attr->attr);
94 struct class * class_get(struct class * cls)
96 if (cls)
97 return container_of(subsys_get(&cls->subsys), struct class, subsys);
98 return NULL;
101 void class_put(struct class * cls)
103 if (cls)
104 subsys_put(&cls->subsys);
108 static int add_class_attrs(struct class * cls)
110 int i;
111 int error = 0;
113 if (cls->class_attrs) {
114 for (i = 0; attr_name(cls->class_attrs[i]); i++) {
115 error = class_create_file(cls,&cls->class_attrs[i]);
116 if (error)
117 goto Err;
120 Done:
121 return error;
122 Err:
123 while (--i >= 0)
124 class_remove_file(cls,&cls->class_attrs[i]);
125 goto Done;
128 static void remove_class_attrs(struct class * cls)
130 int i;
132 if (cls->class_attrs) {
133 for (i = 0; attr_name(cls->class_attrs[i]); i++)
134 class_remove_file(cls,&cls->class_attrs[i]);
138 int class_register(struct class * cls)
140 int error;
142 pr_debug("device class '%s': registering\n", cls->name);
144 INIT_LIST_HEAD(&cls->children);
145 INIT_LIST_HEAD(&cls->interfaces);
146 init_MUTEX(&cls->sem);
147 error = kobject_set_name(&cls->subsys.kset.kobj, "%s", cls->name);
148 if (error)
149 return error;
151 subsys_set_kset(cls, class_subsys);
153 error = subsystem_register(&cls->subsys);
154 if (!error) {
155 error = add_class_attrs(class_get(cls));
156 class_put(cls);
158 return error;
161 void class_unregister(struct class * cls)
163 pr_debug("device class '%s': unregistering\n", cls->name);
164 remove_class_attrs(cls);
165 subsystem_unregister(&cls->subsys);
168 static void class_create_release(struct class *cls)
170 pr_debug("%s called for %s\n", __FUNCTION__, cls->name);
171 kfree(cls);
174 static void class_device_create_release(struct class_device *class_dev)
176 pr_debug("%s called for %s\n", __FUNCTION__, class_dev->class_id);
177 kfree(class_dev);
180 /* needed to allow these devices to have parent class devices */
181 static int class_device_create_uevent(struct class_device *class_dev,
182 char **envp, int num_envp,
183 char *buffer, int buffer_size)
185 pr_debug("%s called for %s\n", __FUNCTION__, class_dev->class_id);
186 return 0;
190 * class_create - create a struct class structure
191 * @owner: pointer to the module that is to "own" this struct class
192 * @name: pointer to a string for the name of this class.
194 * This is used to create a struct class pointer that can then be used
195 * in calls to class_device_create().
197 * Note, the pointer created here is to be destroyed when finished by
198 * making a call to class_destroy().
200 struct class *class_create(struct module *owner, char *name)
202 struct class *cls;
203 int retval;
205 cls = kzalloc(sizeof(*cls), GFP_KERNEL);
206 if (!cls) {
207 retval = -ENOMEM;
208 goto error;
211 cls->name = name;
212 cls->owner = owner;
213 cls->class_release = class_create_release;
214 cls->release = class_device_create_release;
216 retval = class_register(cls);
217 if (retval)
218 goto error;
220 return cls;
222 error:
223 kfree(cls);
224 return ERR_PTR(retval);
228 * class_destroy - destroys a struct class structure
229 * @cs: pointer to the struct class that is to be destroyed
231 * Note, the pointer to be destroyed must have been created with a call
232 * to class_create().
234 void class_destroy(struct class *cls)
236 if ((cls == NULL) || (IS_ERR(cls)))
237 return;
239 class_unregister(cls);
242 /* Class Device Stuff */
244 int class_device_create_file(struct class_device * class_dev,
245 const struct class_device_attribute * attr)
247 int error = -EINVAL;
248 if (class_dev)
249 error = sysfs_create_file(&class_dev->kobj, &attr->attr);
250 return error;
253 void class_device_remove_file(struct class_device * class_dev,
254 const struct class_device_attribute * attr)
256 if (class_dev)
257 sysfs_remove_file(&class_dev->kobj, &attr->attr);
260 int class_device_create_bin_file(struct class_device *class_dev,
261 struct bin_attribute *attr)
263 int error = -EINVAL;
264 if (class_dev)
265 error = sysfs_create_bin_file(&class_dev->kobj, attr);
266 return error;
269 void class_device_remove_bin_file(struct class_device *class_dev,
270 struct bin_attribute *attr)
272 if (class_dev)
273 sysfs_remove_bin_file(&class_dev->kobj, attr);
276 static ssize_t
277 class_device_attr_show(struct kobject * kobj, struct attribute * attr,
278 char * buf)
280 struct class_device_attribute * class_dev_attr = to_class_dev_attr(attr);
281 struct class_device * cd = to_class_dev(kobj);
282 ssize_t ret = 0;
284 if (class_dev_attr->show)
285 ret = class_dev_attr->show(cd, buf);
286 return ret;
289 static ssize_t
290 class_device_attr_store(struct kobject * kobj, struct attribute * attr,
291 const char * buf, size_t count)
293 struct class_device_attribute * class_dev_attr = to_class_dev_attr(attr);
294 struct class_device * cd = to_class_dev(kobj);
295 ssize_t ret = 0;
297 if (class_dev_attr->store)
298 ret = class_dev_attr->store(cd, buf, count);
299 return ret;
302 static struct sysfs_ops class_dev_sysfs_ops = {
303 .show = class_device_attr_show,
304 .store = class_device_attr_store,
307 static void class_dev_release(struct kobject * kobj)
309 struct class_device *cd = to_class_dev(kobj);
310 struct class * cls = cd->class;
312 pr_debug("device class '%s': release.\n", cd->class_id);
314 kfree(cd->devt_attr);
315 cd->devt_attr = NULL;
317 if (cd->release)
318 cd->release(cd);
319 else if (cls->release)
320 cls->release(cd);
321 else {
322 printk(KERN_ERR "Class Device '%s' does not have a release() function, "
323 "it is broken and must be fixed.\n",
324 cd->class_id);
325 WARN_ON(1);
329 static struct kobj_type ktype_class_device = {
330 .sysfs_ops = &class_dev_sysfs_ops,
331 .release = class_dev_release,
334 static int class_uevent_filter(struct kset *kset, struct kobject *kobj)
336 struct kobj_type *ktype = get_ktype(kobj);
338 if (ktype == &ktype_class_device) {
339 struct class_device *class_dev = to_class_dev(kobj);
340 if (class_dev->class)
341 return 1;
343 return 0;
346 static const char *class_uevent_name(struct kset *kset, struct kobject *kobj)
348 struct class_device *class_dev = to_class_dev(kobj);
350 return class_dev->class->name;
353 static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp,
354 int num_envp, char *buffer, int buffer_size)
356 struct class_device *class_dev = to_class_dev(kobj);
357 int i = 0;
358 int length = 0;
359 int retval = 0;
361 pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id);
363 if (class_dev->dev) {
364 /* add physical device, backing this device */
365 struct device *dev = class_dev->dev;
366 char *path = kobject_get_path(&dev->kobj, GFP_KERNEL);
368 add_uevent_var(envp, num_envp, &i, buffer, buffer_size,
369 &length, "PHYSDEVPATH=%s", path);
370 kfree(path);
372 if (dev->bus)
373 add_uevent_var(envp, num_envp, &i,
374 buffer, buffer_size, &length,
375 "PHYSDEVBUS=%s", dev->bus->name);
377 if (dev->driver)
378 add_uevent_var(envp, num_envp, &i,
379 buffer, buffer_size, &length,
380 "PHYSDEVDRIVER=%s", dev->driver->name);
383 if (MAJOR(class_dev->devt)) {
384 add_uevent_var(envp, num_envp, &i,
385 buffer, buffer_size, &length,
386 "MAJOR=%u", MAJOR(class_dev->devt));
388 add_uevent_var(envp, num_envp, &i,
389 buffer, buffer_size, &length,
390 "MINOR=%u", MINOR(class_dev->devt));
393 /* terminate, set to next free slot, shrink available space */
394 envp[i] = NULL;
395 envp = &envp[i];
396 num_envp -= i;
397 buffer = &buffer[length];
398 buffer_size -= length;
400 if (class_dev->uevent) {
401 /* have the class device specific function add its stuff */
402 retval = class_dev->uevent(class_dev, envp, num_envp,
403 buffer, buffer_size);
404 if (retval)
405 pr_debug("class_dev->uevent() returned %d\n", retval);
406 } else if (class_dev->class->uevent) {
407 /* have the class specific function add its stuff */
408 retval = class_dev->class->uevent(class_dev, envp, num_envp,
409 buffer, buffer_size);
410 if (retval)
411 pr_debug("class->uevent() returned %d\n", retval);
414 return retval;
417 static struct kset_uevent_ops class_uevent_ops = {
418 .filter = class_uevent_filter,
419 .name = class_uevent_name,
420 .uevent = class_uevent,
423 static decl_subsys(class_obj, &ktype_class_device, &class_uevent_ops);
426 static int class_device_add_attrs(struct class_device * cd)
428 int i;
429 int error = 0;
430 struct class * cls = cd->class;
432 if (cls->class_dev_attrs) {
433 for (i = 0; attr_name(cls->class_dev_attrs[i]); i++) {
434 error = class_device_create_file(cd,
435 &cls->class_dev_attrs[i]);
436 if (error)
437 goto Err;
440 Done:
441 return error;
442 Err:
443 while (--i >= 0)
444 class_device_remove_file(cd,&cls->class_dev_attrs[i]);
445 goto Done;
448 static void class_device_remove_attrs(struct class_device * cd)
450 int i;
451 struct class * cls = cd->class;
453 if (cls->class_dev_attrs) {
454 for (i = 0; attr_name(cls->class_dev_attrs[i]); i++)
455 class_device_remove_file(cd,&cls->class_dev_attrs[i]);
459 static ssize_t show_dev(struct class_device *class_dev, char *buf)
461 return print_dev_t(buf, class_dev->devt);
464 static ssize_t store_uevent(struct class_device *class_dev,
465 const char *buf, size_t count)
467 kobject_uevent(&class_dev->kobj, KOBJ_ADD);
468 return count;
471 void class_device_initialize(struct class_device *class_dev)
473 kobj_set_kset_s(class_dev, class_obj_subsys);
474 kobject_init(&class_dev->kobj);
475 INIT_LIST_HEAD(&class_dev->node);
478 static char *make_class_name(struct class_device *class_dev)
480 char *name;
481 int size;
483 size = strlen(class_dev->class->name) +
484 strlen(kobject_name(&class_dev->kobj)) + 2;
486 name = kmalloc(size, GFP_KERNEL);
487 if (!name)
488 return ERR_PTR(-ENOMEM);
490 strcpy(name, class_dev->class->name);
491 strcat(name, ":");
492 strcat(name, kobject_name(&class_dev->kobj));
493 return name;
496 int class_device_add(struct class_device *class_dev)
498 struct class *parent_class = NULL;
499 struct class_device *parent_class_dev = NULL;
500 struct class_interface *class_intf;
501 char *class_name = NULL;
502 int error = -EINVAL;
504 class_dev = class_device_get(class_dev);
505 if (!class_dev)
506 return -EINVAL;
508 if (!strlen(class_dev->class_id))
509 goto register_done;
511 parent_class = class_get(class_dev->class);
512 if (!parent_class)
513 goto register_done;
514 parent_class_dev = class_device_get(class_dev->parent);
516 pr_debug("CLASS: registering class device: ID = '%s'\n",
517 class_dev->class_id);
519 /* first, register with generic layer. */
520 kobject_set_name(&class_dev->kobj, "%s", class_dev->class_id);
521 if (parent_class_dev)
522 class_dev->kobj.parent = &parent_class_dev->kobj;
523 else
524 class_dev->kobj.parent = &parent_class->subsys.kset.kobj;
526 error = kobject_add(&class_dev->kobj);
527 if (error)
528 goto register_done;
530 /* add the needed attributes to this device */
531 class_dev->uevent_attr.attr.name = "uevent";
532 class_dev->uevent_attr.attr.mode = S_IWUSR;
533 class_dev->uevent_attr.attr.owner = parent_class->owner;
534 class_dev->uevent_attr.store = store_uevent;
535 class_device_create_file(class_dev, &class_dev->uevent_attr);
537 if (MAJOR(class_dev->devt)) {
538 struct class_device_attribute *attr;
539 attr = kzalloc(sizeof(*attr), GFP_KERNEL);
540 if (!attr) {
541 error = -ENOMEM;
542 kobject_del(&class_dev->kobj);
543 goto register_done;
545 attr->attr.name = "dev";
546 attr->attr.mode = S_IRUGO;
547 attr->attr.owner = parent_class->owner;
548 attr->show = show_dev;
549 class_device_create_file(class_dev, attr);
550 class_dev->devt_attr = attr;
553 class_device_add_attrs(class_dev);
554 if (class_dev->dev) {
555 class_name = make_class_name(class_dev);
556 sysfs_create_link(&class_dev->kobj,
557 &class_dev->dev->kobj, "device");
558 sysfs_create_link(&class_dev->dev->kobj, &class_dev->kobj,
559 class_name);
562 kobject_uevent(&class_dev->kobj, KOBJ_ADD);
564 /* notify any interfaces this device is now here */
565 down(&parent_class->sem);
566 list_add_tail(&class_dev->node, &parent_class->children);
567 list_for_each_entry(class_intf, &parent_class->interfaces, node) {
568 if (class_intf->add)
569 class_intf->add(class_dev, class_intf);
571 up(&parent_class->sem);
573 register_done:
574 if (error) {
575 class_put(parent_class);
576 class_device_put(parent_class_dev);
578 class_device_put(class_dev);
579 kfree(class_name);
580 return error;
583 int class_device_register(struct class_device *class_dev)
585 class_device_initialize(class_dev);
586 return class_device_add(class_dev);
590 * class_device_create - creates a class device and registers it with sysfs
591 * @cs: pointer to the struct class that this device should be registered to.
592 * @parent: pointer to the parent struct class_device of this new device, if any.
593 * @dev: the dev_t for the char device to be added.
594 * @device: a pointer to a struct device that is assiociated with this class device.
595 * @fmt: string for the class device's name
597 * This function can be used by char device classes. A struct
598 * class_device will be created in sysfs, registered to the specified
599 * class.
600 * A "dev" file will be created, showing the dev_t for the device, if
601 * the dev_t is not 0,0.
602 * If a pointer to a parent struct class_device is passed in, the newly
603 * created struct class_device will be a child of that device in sysfs.
604 * The pointer to the struct class_device will be returned from the
605 * call. Any further sysfs files that might be required can be created
606 * using this pointer.
608 * Note: the struct class passed to this function must have previously
609 * been created with a call to class_create().
611 struct class_device *class_device_create(struct class *cls,
612 struct class_device *parent,
613 dev_t devt,
614 struct device *device, char *fmt, ...)
616 va_list args;
617 struct class_device *class_dev = NULL;
618 int retval = -ENODEV;
620 if (cls == NULL || IS_ERR(cls))
621 goto error;
623 class_dev = kzalloc(sizeof(*class_dev), GFP_KERNEL);
624 if (!class_dev) {
625 retval = -ENOMEM;
626 goto error;
629 class_dev->devt = devt;
630 class_dev->dev = device;
631 class_dev->class = cls;
632 class_dev->parent = parent;
633 class_dev->release = class_device_create_release;
634 class_dev->uevent = class_device_create_uevent;
636 va_start(args, fmt);
637 vsnprintf(class_dev->class_id, BUS_ID_SIZE, fmt, args);
638 va_end(args);
639 retval = class_device_register(class_dev);
640 if (retval)
641 goto error;
643 return class_dev;
645 error:
646 kfree(class_dev);
647 return ERR_PTR(retval);
650 void class_device_del(struct class_device *class_dev)
652 struct class *parent_class = class_dev->class;
653 struct class_device *parent_device = class_dev->parent;
654 struct class_interface *class_intf;
655 char *class_name = NULL;
657 if (parent_class) {
658 down(&parent_class->sem);
659 list_del_init(&class_dev->node);
660 list_for_each_entry(class_intf, &parent_class->interfaces, node)
661 if (class_intf->remove)
662 class_intf->remove(class_dev, class_intf);
663 up(&parent_class->sem);
666 if (class_dev->dev) {
667 class_name = make_class_name(class_dev);
668 sysfs_remove_link(&class_dev->kobj, "device");
669 sysfs_remove_link(&class_dev->dev->kobj, class_name);
671 class_device_remove_file(class_dev, &class_dev->uevent_attr);
672 if (class_dev->devt_attr)
673 class_device_remove_file(class_dev, class_dev->devt_attr);
674 class_device_remove_attrs(class_dev);
676 kobject_uevent(&class_dev->kobj, KOBJ_REMOVE);
677 kobject_del(&class_dev->kobj);
679 class_device_put(parent_device);
680 class_put(parent_class);
681 kfree(class_name);
684 void class_device_unregister(struct class_device *class_dev)
686 pr_debug("CLASS: Unregistering class device. ID = '%s'\n",
687 class_dev->class_id);
688 class_device_del(class_dev);
689 class_device_put(class_dev);
693 * class_device_destroy - removes a class device that was created with class_device_create()
694 * @cls: the pointer to the struct class that this device was registered * with.
695 * @dev: the dev_t of the device that was previously registered.
697 * This call unregisters and cleans up a class device that was created with a
698 * call to class_device_create()
700 void class_device_destroy(struct class *cls, dev_t devt)
702 struct class_device *class_dev = NULL;
703 struct class_device *class_dev_tmp;
705 down(&cls->sem);
706 list_for_each_entry(class_dev_tmp, &cls->children, node) {
707 if (class_dev_tmp->devt == devt) {
708 class_dev = class_dev_tmp;
709 break;
712 up(&cls->sem);
714 if (class_dev)
715 class_device_unregister(class_dev);
718 int class_device_rename(struct class_device *class_dev, char *new_name)
720 int error = 0;
721 char *old_class_name = NULL, *new_class_name = NULL;
723 class_dev = class_device_get(class_dev);
724 if (!class_dev)
725 return -EINVAL;
727 pr_debug("CLASS: renaming '%s' to '%s'\n", class_dev->class_id,
728 new_name);
730 if (class_dev->dev)
731 old_class_name = make_class_name(class_dev);
733 strlcpy(class_dev->class_id, new_name, KOBJ_NAME_LEN);
735 error = kobject_rename(&class_dev->kobj, new_name);
737 if (class_dev->dev) {
738 new_class_name = make_class_name(class_dev);
739 sysfs_create_link(&class_dev->dev->kobj, &class_dev->kobj,
740 new_class_name);
741 sysfs_remove_link(&class_dev->dev->kobj, old_class_name);
743 class_device_put(class_dev);
745 kfree(old_class_name);
746 kfree(new_class_name);
748 return error;
751 struct class_device * class_device_get(struct class_device *class_dev)
753 if (class_dev)
754 return to_class_dev(kobject_get(&class_dev->kobj));
755 return NULL;
758 void class_device_put(struct class_device *class_dev)
760 if (class_dev)
761 kobject_put(&class_dev->kobj);
765 int class_interface_register(struct class_interface *class_intf)
767 struct class *parent;
768 struct class_device *class_dev;
770 if (!class_intf || !class_intf->class)
771 return -ENODEV;
773 parent = class_get(class_intf->class);
774 if (!parent)
775 return -EINVAL;
777 down(&parent->sem);
778 list_add_tail(&class_intf->node, &parent->interfaces);
779 if (class_intf->add) {
780 list_for_each_entry(class_dev, &parent->children, node)
781 class_intf->add(class_dev, class_intf);
783 up(&parent->sem);
785 return 0;
788 void class_interface_unregister(struct class_interface *class_intf)
790 struct class * parent = class_intf->class;
791 struct class_device *class_dev;
793 if (!parent)
794 return;
796 down(&parent->sem);
797 list_del_init(&class_intf->node);
798 if (class_intf->remove) {
799 list_for_each_entry(class_dev, &parent->children, node)
800 class_intf->remove(class_dev, class_intf);
802 up(&parent->sem);
804 class_put(parent);
809 int __init classes_init(void)
811 int retval;
813 retval = subsystem_register(&class_subsys);
814 if (retval)
815 return retval;
817 /* ick, this is ugly, the things we go through to keep from showing up
818 * in sysfs... */
819 subsystem_init(&class_obj_subsys);
820 if (!class_obj_subsys.kset.subsys)
821 class_obj_subsys.kset.subsys = &class_obj_subsys;
822 return 0;
825 EXPORT_SYMBOL_GPL(class_create_file);
826 EXPORT_SYMBOL_GPL(class_remove_file);
827 EXPORT_SYMBOL_GPL(class_register);
828 EXPORT_SYMBOL_GPL(class_unregister);
829 EXPORT_SYMBOL_GPL(class_get);
830 EXPORT_SYMBOL_GPL(class_put);
831 EXPORT_SYMBOL_GPL(class_create);
832 EXPORT_SYMBOL_GPL(class_destroy);
834 EXPORT_SYMBOL_GPL(class_device_register);
835 EXPORT_SYMBOL_GPL(class_device_unregister);
836 EXPORT_SYMBOL_GPL(class_device_initialize);
837 EXPORT_SYMBOL_GPL(class_device_add);
838 EXPORT_SYMBOL_GPL(class_device_del);
839 EXPORT_SYMBOL_GPL(class_device_get);
840 EXPORT_SYMBOL_GPL(class_device_put);
841 EXPORT_SYMBOL_GPL(class_device_create);
842 EXPORT_SYMBOL_GPL(class_device_destroy);
843 EXPORT_SYMBOL_GPL(class_device_create_file);
844 EXPORT_SYMBOL_GPL(class_device_remove_file);
845 EXPORT_SYMBOL_GPL(class_device_create_bin_file);
846 EXPORT_SYMBOL_GPL(class_device_remove_bin_file);
848 EXPORT_SYMBOL_GPL(class_interface_register);
849 EXPORT_SYMBOL_GPL(class_interface_unregister);