class.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  1. /*
  2. * class.c - basic device class management
  3. *
  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.
  8. *
  9. * This file is released under the GPLv2
  10. *
  11. */
  12. #include <linux/config.h>
  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 "base.h"
  20. #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr)
  21. #define to_class(obj) container_of(obj, struct class, subsys.kset.kobj)
  22. static ssize_t
  23. class_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
  24. {
  25. struct class_attribute * class_attr = to_class_attr(attr);
  26. struct class * dc = to_class(kobj);
  27. ssize_t ret = -EIO;
  28. if (class_attr->show)
  29. ret = class_attr->show(dc, buf);
  30. return ret;
  31. }
  32. static ssize_t
  33. class_attr_store(struct kobject * kobj, struct attribute * attr,
  34. const char * buf, size_t count)
  35. {
  36. struct class_attribute * class_attr = to_class_attr(attr);
  37. struct class * dc = to_class(kobj);
  38. ssize_t ret = -EIO;
  39. if (class_attr->store)
  40. ret = class_attr->store(dc, buf, count);
  41. return ret;
  42. }
  43. static void class_release(struct kobject * kobj)
  44. {
  45. struct class *class = to_class(kobj);
  46. pr_debug("class '%s': release.\n", class->name);
  47. if (class->class_release)
  48. class->class_release(class);
  49. else
  50. pr_debug("class '%s' does not have a release() function, "
  51. "be careful\n", class->name);
  52. }
  53. static struct sysfs_ops class_sysfs_ops = {
  54. .show = class_attr_show,
  55. .store = class_attr_store,
  56. };
  57. static struct kobj_type ktype_class = {
  58. .sysfs_ops = &class_sysfs_ops,
  59. .release = class_release,
  60. };
  61. /* Hotplug events for classes go to the class_obj subsys */
  62. static decl_subsys(class, &ktype_class, NULL);
  63. int class_create_file(struct class * cls, const struct class_attribute * attr)
  64. {
  65. int error;
  66. if (cls) {
  67. error = sysfs_create_file(&cls->subsys.kset.kobj, &attr->attr);
  68. } else
  69. error = -EINVAL;
  70. return error;
  71. }
  72. void class_remove_file(struct class * cls, const struct class_attribute * attr)
  73. {
  74. if (cls)
  75. sysfs_remove_file(&cls->subsys.kset.kobj, &attr->attr);
  76. }
  77. struct class * class_get(struct class * cls)
  78. {
  79. if (cls)
  80. return container_of(subsys_get(&cls->subsys), struct class, subsys);
  81. return NULL;
  82. }
  83. void class_put(struct class * cls)
  84. {
  85. subsys_put(&cls->subsys);
  86. }
  87. static int add_class_attrs(struct class * cls)
  88. {
  89. int i;
  90. int error = 0;
  91. if (cls->class_attrs) {
  92. for (i = 0; attr_name(cls->class_attrs[i]); i++) {
  93. error = class_create_file(cls,&cls->class_attrs[i]);
  94. if (error)
  95. goto Err;
  96. }
  97. }
  98. Done:
  99. return error;
  100. Err:
  101. while (--i >= 0)
  102. class_remove_file(cls,&cls->class_attrs[i]);
  103. goto Done;
  104. }
  105. static void remove_class_attrs(struct class * cls)
  106. {
  107. int i;
  108. if (cls->class_attrs) {
  109. for (i = 0; attr_name(cls->class_attrs[i]); i++)
  110. class_remove_file(cls,&cls->class_attrs[i]);
  111. }
  112. }
  113. int class_register(struct class * cls)
  114. {
  115. int error;
  116. pr_debug("device class '%s': registering\n", cls->name);
  117. INIT_LIST_HEAD(&cls->children);
  118. INIT_LIST_HEAD(&cls->interfaces);
  119. init_MUTEX(&cls->sem);
  120. error = kobject_set_name(&cls->subsys.kset.kobj, "%s", cls->name);
  121. if (error)
  122. return error;
  123. subsys_set_kset(cls, class_subsys);
  124. error = subsystem_register(&cls->subsys);
  125. if (!error) {
  126. error = add_class_attrs(class_get(cls));
  127. class_put(cls);
  128. }
  129. return error;
  130. }
  131. void class_unregister(struct class * cls)
  132. {
  133. pr_debug("device class '%s': unregistering\n", cls->name);
  134. remove_class_attrs(cls);
  135. subsystem_unregister(&cls->subsys);
  136. }
  137. static void class_create_release(struct class *cls)
  138. {
  139. kfree(cls);
  140. }
  141. static void class_device_create_release(struct class_device *class_dev)
  142. {
  143. kfree(class_dev);
  144. }
  145. /**
  146. * class_create - create a struct class structure
  147. * @owner: pointer to the module that is to "own" this struct class
  148. * @name: pointer to a string for the name of this class.
  149. *
  150. * This is used to create a struct class pointer that can then be used
  151. * in calls to class_device_create().
  152. *
  153. * Note, the pointer created here is to be destroyed when finished by
  154. * making a call to class_destroy().
  155. */
  156. struct class *class_create(struct module *owner, char *name)
  157. {
  158. struct class *cls;
  159. int retval;
  160. cls = kmalloc(sizeof(struct class), GFP_KERNEL);
  161. if (!cls) {
  162. retval = -ENOMEM;
  163. goto error;
  164. }
  165. memset(cls, 0x00, sizeof(struct class));
  166. cls->name = name;
  167. cls->owner = owner;
  168. cls->class_release = class_create_release;
  169. cls->release = class_device_create_release;
  170. retval = class_register(cls);
  171. if (retval)
  172. goto error;
  173. return cls;
  174. error:
  175. kfree(cls);
  176. return ERR_PTR(retval);
  177. }
  178. /**
  179. * class_destroy - destroys a struct class structure
  180. * @cs: pointer to the struct class that is to be destroyed
  181. *
  182. * Note, the pointer to be destroyed must have been created with a call
  183. * to class_create().
  184. */
  185. void class_destroy(struct class *cls)
  186. {
  187. if ((cls == NULL) || (IS_ERR(cls)))
  188. return;
  189. class_unregister(cls);
  190. }
  191. /* Class Device Stuff */
  192. int class_device_create_file(struct class_device * class_dev,
  193. const struct class_device_attribute * attr)
  194. {
  195. int error = -EINVAL;
  196. if (class_dev)
  197. error = sysfs_create_file(&class_dev->kobj, &attr->attr);
  198. return error;
  199. }
  200. void class_device_remove_file(struct class_device * class_dev,
  201. const struct class_device_attribute * attr)
  202. {
  203. if (class_dev)
  204. sysfs_remove_file(&class_dev->kobj, &attr->attr);
  205. }
  206. int class_device_create_bin_file(struct class_device *class_dev,
  207. struct bin_attribute *attr)
  208. {
  209. int error = -EINVAL;
  210. if (class_dev)
  211. error = sysfs_create_bin_file(&class_dev->kobj, attr);
  212. return error;
  213. }
  214. void class_device_remove_bin_file(struct class_device *class_dev,
  215. struct bin_attribute *attr)
  216. {
  217. if (class_dev)
  218. sysfs_remove_bin_file(&class_dev->kobj, attr);
  219. }
  220. static ssize_t
  221. class_device_attr_show(struct kobject * kobj, struct attribute * attr,
  222. char * buf)
  223. {
  224. struct class_device_attribute * class_dev_attr = to_class_dev_attr(attr);
  225. struct class_device * cd = to_class_dev(kobj);
  226. ssize_t ret = 0;
  227. if (class_dev_attr->show)
  228. ret = class_dev_attr->show(cd, buf);
  229. return ret;
  230. }
  231. static ssize_t
  232. class_device_attr_store(struct kobject * kobj, struct attribute * attr,
  233. const char * buf, size_t count)
  234. {
  235. struct class_device_attribute * class_dev_attr = to_class_dev_attr(attr);
  236. struct class_device * cd = to_class_dev(kobj);
  237. ssize_t ret = 0;
  238. if (class_dev_attr->store)
  239. ret = class_dev_attr->store(cd, buf, count);
  240. return ret;
  241. }
  242. static struct sysfs_ops class_dev_sysfs_ops = {
  243. .show = class_device_attr_show,
  244. .store = class_device_attr_store,
  245. };
  246. static void class_dev_release(struct kobject * kobj)
  247. {
  248. struct class_device *cd = to_class_dev(kobj);
  249. struct class * cls = cd->class;
  250. pr_debug("device class '%s': release.\n", cd->class_id);
  251. if (cd->devt_attr) {
  252. kfree(cd->devt_attr);
  253. cd->devt_attr = NULL;
  254. }
  255. if (cls->release)
  256. cls->release(cd);
  257. else {
  258. printk(KERN_ERR "Device class '%s' does not have a release() function, "
  259. "it is broken and must be fixed.\n",
  260. cd->class_id);
  261. WARN_ON(1);
  262. }
  263. }
  264. static struct kobj_type ktype_class_device = {
  265. .sysfs_ops = &class_dev_sysfs_ops,
  266. .release = class_dev_release,
  267. };
  268. static int class_hotplug_filter(struct kset *kset, struct kobject *kobj)
  269. {
  270. struct kobj_type *ktype = get_ktype(kobj);
  271. if (ktype == &ktype_class_device) {
  272. struct class_device *class_dev = to_class_dev(kobj);
  273. if (class_dev->class)
  274. return 1;
  275. }
  276. return 0;
  277. }
  278. static const char *class_hotplug_name(struct kset *kset, struct kobject *kobj)
  279. {
  280. struct class_device *class_dev = to_class_dev(kobj);
  281. return class_dev->class->name;
  282. }
  283. static int class_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
  284. int num_envp, char *buffer, int buffer_size)
  285. {
  286. struct class_device *class_dev = to_class_dev(kobj);
  287. int i = 0;
  288. int length = 0;
  289. int retval = 0;
  290. pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id);
  291. if (class_dev->dev) {
  292. /* add physical device, backing this device */
  293. struct device *dev = class_dev->dev;
  294. char *path = kobject_get_path(&dev->kobj, GFP_KERNEL);
  295. add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size,
  296. &length, "PHYSDEVPATH=%s", path);
  297. kfree(path);
  298. if (dev->bus)
  299. add_hotplug_env_var(envp, num_envp, &i,
  300. buffer, buffer_size, &length,
  301. "PHYSDEVBUS=%s", dev->bus->name);
  302. if (dev->driver)
  303. add_hotplug_env_var(envp, num_envp, &i,
  304. buffer, buffer_size, &length,
  305. "PHYSDEVDRIVER=%s", dev->driver->name);
  306. }
  307. if (MAJOR(class_dev->devt)) {
  308. add_hotplug_env_var(envp, num_envp, &i,
  309. buffer, buffer_size, &length,
  310. "MAJOR=%u", MAJOR(class_dev->devt));
  311. add_hotplug_env_var(envp, num_envp, &i,
  312. buffer, buffer_size, &length,
  313. "MINOR=%u", MINOR(class_dev->devt));
  314. }
  315. /* terminate, set to next free slot, shrink available space */
  316. envp[i] = NULL;
  317. envp = &envp[i];
  318. num_envp -= i;
  319. buffer = &buffer[length];
  320. buffer_size -= length;
  321. if (class_dev->class->hotplug) {
  322. /* have the bus specific function add its stuff */
  323. retval = class_dev->class->hotplug (class_dev, envp, num_envp,
  324. buffer, buffer_size);
  325. if (retval) {
  326. pr_debug ("%s - hotplug() returned %d\n",
  327. __FUNCTION__, retval);
  328. }
  329. }
  330. return retval;
  331. }
  332. static struct kset_hotplug_ops class_hotplug_ops = {
  333. .filter = class_hotplug_filter,
  334. .name = class_hotplug_name,
  335. .hotplug = class_hotplug,
  336. };
  337. static decl_subsys(class_obj, &ktype_class_device, &class_hotplug_ops);
  338. static int class_device_add_attrs(struct class_device * cd)
  339. {
  340. int i;
  341. int error = 0;
  342. struct class * cls = cd->class;
  343. if (cls->class_dev_attrs) {
  344. for (i = 0; attr_name(cls->class_dev_attrs[i]); i++) {
  345. error = class_device_create_file(cd,
  346. &cls->class_dev_attrs[i]);
  347. if (error)
  348. goto Err;
  349. }
  350. }
  351. Done:
  352. return error;
  353. Err:
  354. while (--i >= 0)
  355. class_device_remove_file(cd,&cls->class_dev_attrs[i]);
  356. goto Done;
  357. }
  358. static void class_device_remove_attrs(struct class_device * cd)
  359. {
  360. int i;
  361. struct class * cls = cd->class;
  362. if (cls->class_dev_attrs) {
  363. for (i = 0; attr_name(cls->class_dev_attrs[i]); i++)
  364. class_device_remove_file(cd,&cls->class_dev_attrs[i]);
  365. }
  366. }
  367. static ssize_t show_dev(struct class_device *class_dev, char *buf)
  368. {
  369. return print_dev_t(buf, class_dev->devt);
  370. }
  371. void class_device_initialize(struct class_device *class_dev)
  372. {
  373. kobj_set_kset_s(class_dev, class_obj_subsys);
  374. kobject_init(&class_dev->kobj);
  375. INIT_LIST_HEAD(&class_dev->node);
  376. }
  377. int class_device_add(struct class_device *class_dev)
  378. {
  379. struct class * parent = NULL;
  380. struct class_interface * class_intf;
  381. int error;
  382. class_dev = class_device_get(class_dev);
  383. if (!class_dev)
  384. return -EINVAL;
  385. if (!strlen(class_dev->class_id)) {
  386. error = -EINVAL;
  387. goto register_done;
  388. }
  389. parent = class_get(class_dev->class);
  390. pr_debug("CLASS: registering class device: ID = '%s'\n",
  391. class_dev->class_id);
  392. /* first, register with generic layer. */
  393. kobject_set_name(&class_dev->kobj, "%s", class_dev->class_id);
  394. if (parent)
  395. class_dev->kobj.parent = &parent->subsys.kset.kobj;
  396. if ((error = kobject_add(&class_dev->kobj)))
  397. goto register_done;
  398. /* add the needed attributes to this device */
  399. if (MAJOR(class_dev->devt)) {
  400. struct class_device_attribute *attr;
  401. attr = kmalloc(sizeof(*attr), GFP_KERNEL);
  402. if (!attr) {
  403. error = -ENOMEM;
  404. kobject_del(&class_dev->kobj);
  405. goto register_done;
  406. }
  407. memset(attr, sizeof(*attr), 0x00);
  408. attr->attr.name = "dev";
  409. attr->attr.mode = S_IRUGO;
  410. attr->attr.owner = parent->owner;
  411. attr->show = show_dev;
  412. attr->store = NULL;
  413. class_device_create_file(class_dev, attr);
  414. class_dev->devt_attr = attr;
  415. }
  416. class_device_add_attrs(class_dev);
  417. if (class_dev->dev)
  418. sysfs_create_link(&class_dev->kobj,
  419. &class_dev->dev->kobj, "device");
  420. /* notify any interfaces this device is now here */
  421. if (parent) {
  422. down(&parent->sem);
  423. list_add_tail(&class_dev->node, &parent->children);
  424. list_for_each_entry(class_intf, &parent->interfaces, node)
  425. if (class_intf->add)
  426. class_intf->add(class_dev);
  427. up(&parent->sem);
  428. }
  429. kobject_hotplug(&class_dev->kobj, KOBJ_ADD);
  430. register_done:
  431. if (error && parent)
  432. class_put(parent);
  433. class_device_put(class_dev);
  434. return error;
  435. }
  436. int class_device_register(struct class_device *class_dev)
  437. {
  438. class_device_initialize(class_dev);
  439. return class_device_add(class_dev);
  440. }
  441. /**
  442. * class_device_create - creates a class device and registers it with sysfs
  443. * @cs: pointer to the struct class that this device should be registered to.
  444. * @dev: the dev_t for the char device to be added.
  445. * @device: a pointer to a struct device that is assiociated with this class device.
  446. * @fmt: string for the class device's name
  447. *
  448. * This function can be used by char device classes. A struct
  449. * class_device will be created in sysfs, registered to the specified
  450. * class. A "dev" file will be created, showing the dev_t for the
  451. * device. The pointer to the struct class_device will be returned from
  452. * the call. Any further sysfs files that might be required can be
  453. * created using this pointer.
  454. *
  455. * Note: the struct class passed to this function must have previously
  456. * been created with a call to class_create().
  457. */
  458. struct class_device *class_device_create(struct class *cls, dev_t devt,
  459. struct device *device, char *fmt, ...)
  460. {
  461. va_list args;
  462. struct class_device *class_dev = NULL;
  463. int retval = -ENODEV;
  464. if (cls == NULL || IS_ERR(cls))
  465. goto error;
  466. class_dev = kmalloc(sizeof(struct class_device), GFP_KERNEL);
  467. if (!class_dev) {
  468. retval = -ENOMEM;
  469. goto error;
  470. }
  471. memset(class_dev, 0x00, sizeof(struct class_device));
  472. class_dev->devt = devt;
  473. class_dev->dev = device;
  474. class_dev->class = cls;
  475. va_start(args, fmt);
  476. vsnprintf(class_dev->class_id, BUS_ID_SIZE, fmt, args);
  477. va_end(args);
  478. retval = class_device_register(class_dev);
  479. if (retval)
  480. goto error;
  481. return class_dev;
  482. error:
  483. kfree(class_dev);
  484. return ERR_PTR(retval);
  485. }
  486. void class_device_del(struct class_device *class_dev)
  487. {
  488. struct class * parent = class_dev->class;
  489. struct class_interface * class_intf;
  490. if (parent) {
  491. down(&parent->sem);
  492. list_del_init(&class_dev->node);
  493. list_for_each_entry(class_intf, &parent->interfaces, node)
  494. if (class_intf->remove)
  495. class_intf->remove(class_dev);
  496. up(&parent->sem);
  497. }
  498. if (class_dev->dev)
  499. sysfs_remove_link(&class_dev->kobj, "device");
  500. if (class_dev->devt_attr)
  501. class_device_remove_file(class_dev, class_dev->devt_attr);
  502. class_device_remove_attrs(class_dev);
  503. kobject_hotplug(&class_dev->kobj, KOBJ_REMOVE);
  504. kobject_del(&class_dev->kobj);
  505. if (parent)
  506. class_put(parent);
  507. }
  508. void class_device_unregister(struct class_device *class_dev)
  509. {
  510. pr_debug("CLASS: Unregistering class device. ID = '%s'\n",
  511. class_dev->class_id);
  512. class_device_del(class_dev);
  513. class_device_put(class_dev);
  514. }
  515. /**
  516. * class_device_destroy - removes a class device that was created with class_device_create()
  517. * @cls: the pointer to the struct class that this device was registered * with.
  518. * @dev: the dev_t of the device that was previously registered.
  519. *
  520. * This call unregisters and cleans up a class device that was created with a
  521. * call to class_device_create()
  522. */
  523. void class_device_destroy(struct class *cls, dev_t devt)
  524. {
  525. struct class_device *class_dev = NULL;
  526. struct class_device *class_dev_tmp;
  527. down(&cls->sem);
  528. list_for_each_entry(class_dev_tmp, &cls->children, node) {
  529. if (class_dev_tmp->devt == devt) {
  530. class_dev = class_dev_tmp;
  531. break;
  532. }
  533. }
  534. up(&cls->sem);
  535. if (class_dev)
  536. class_device_unregister(class_dev);
  537. }
  538. int class_device_rename(struct class_device *class_dev, char *new_name)
  539. {
  540. int error = 0;
  541. class_dev = class_device_get(class_dev);
  542. if (!class_dev)
  543. return -EINVAL;
  544. pr_debug("CLASS: renaming '%s' to '%s'\n", class_dev->class_id,
  545. new_name);
  546. strlcpy(class_dev->class_id, new_name, KOBJ_NAME_LEN);
  547. error = kobject_rename(&class_dev->kobj, new_name);
  548. class_device_put(class_dev);
  549. return error;
  550. }
  551. struct class_device * class_device_get(struct class_device *class_dev)
  552. {
  553. if (class_dev)
  554. return to_class_dev(kobject_get(&class_dev->kobj));
  555. return NULL;
  556. }
  557. void class_device_put(struct class_device *class_dev)
  558. {
  559. kobject_put(&class_dev->kobj);
  560. }
  561. int class_interface_register(struct class_interface *class_intf)
  562. {
  563. struct class *parent;
  564. struct class_device *class_dev;
  565. if (!class_intf || !class_intf->class)
  566. return -ENODEV;
  567. parent = class_get(class_intf->class);
  568. if (!parent)
  569. return -EINVAL;
  570. down(&parent->sem);
  571. list_add_tail(&class_intf->node, &parent->interfaces);
  572. if (class_intf->add) {
  573. list_for_each_entry(class_dev, &parent->children, node)
  574. class_intf->add(class_dev);
  575. }
  576. up(&parent->sem);
  577. return 0;
  578. }
  579. void class_interface_unregister(struct class_interface *class_intf)
  580. {
  581. struct class * parent = class_intf->class;
  582. struct class_device *class_dev;
  583. if (!parent)
  584. return;
  585. down(&parent->sem);
  586. list_del_init(&class_intf->node);
  587. if (class_intf->remove) {
  588. list_for_each_entry(class_dev, &parent->children, node)
  589. class_intf->remove(class_dev);
  590. }
  591. up(&parent->sem);
  592. class_put(parent);
  593. }
  594. int __init classes_init(void)
  595. {
  596. int retval;
  597. retval = subsystem_register(&class_subsys);
  598. if (retval)
  599. return retval;
  600. /* ick, this is ugly, the things we go through to keep from showing up
  601. * in sysfs... */
  602. subsystem_init(&class_obj_subsys);
  603. if (!class_obj_subsys.kset.subsys)
  604. class_obj_subsys.kset.subsys = &class_obj_subsys;
  605. return 0;
  606. }
  607. EXPORT_SYMBOL_GPL(class_create_file);
  608. EXPORT_SYMBOL_GPL(class_remove_file);
  609. EXPORT_SYMBOL_GPL(class_register);
  610. EXPORT_SYMBOL_GPL(class_unregister);
  611. EXPORT_SYMBOL_GPL(class_get);
  612. EXPORT_SYMBOL_GPL(class_put);
  613. EXPORT_SYMBOL_GPL(class_create);
  614. EXPORT_SYMBOL_GPL(class_destroy);
  615. EXPORT_SYMBOL_GPL(class_device_register);
  616. EXPORT_SYMBOL_GPL(class_device_unregister);
  617. EXPORT_SYMBOL_GPL(class_device_initialize);
  618. EXPORT_SYMBOL_GPL(class_device_add);
  619. EXPORT_SYMBOL_GPL(class_device_del);
  620. EXPORT_SYMBOL_GPL(class_device_get);
  621. EXPORT_SYMBOL_GPL(class_device_put);
  622. EXPORT_SYMBOL_GPL(class_device_create);
  623. EXPORT_SYMBOL_GPL(class_device_destroy);
  624. EXPORT_SYMBOL_GPL(class_device_create_file);
  625. EXPORT_SYMBOL_GPL(class_device_remove_file);
  626. EXPORT_SYMBOL_GPL(class_device_create_bin_file);
  627. EXPORT_SYMBOL_GPL(class_device_remove_bin_file);
  628. EXPORT_SYMBOL_GPL(class_interface_register);
  629. EXPORT_SYMBOL_GPL(class_interface_unregister);