firmware_class.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. /*
  2. * firmware_class.c - Multi purpose firmware loading support
  3. *
  4. * Copyright (c) 2003 Manuel Estrada Sainz
  5. *
  6. * Please see Documentation/firmware_class/ for more information.
  7. *
  8. */
  9. #include <linux/capability.h>
  10. #include <linux/device.h>
  11. #include <linux/module.h>
  12. #include <linux/init.h>
  13. #include <linux/timer.h>
  14. #include <linux/vmalloc.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/bitops.h>
  17. #include <linux/mutex.h>
  18. #include <linux/kthread.h>
  19. #include <linux/highmem.h>
  20. #include <linux/firmware.h>
  21. #define to_dev(obj) container_of(obj, struct device, kobj)
  22. MODULE_AUTHOR("Manuel Estrada Sainz");
  23. MODULE_DESCRIPTION("Multi purpose firmware loading support");
  24. MODULE_LICENSE("GPL");
  25. enum {
  26. FW_STATUS_LOADING,
  27. FW_STATUS_DONE,
  28. FW_STATUS_ABORT,
  29. };
  30. static int loading_timeout = 60; /* In seconds */
  31. /* fw_lock could be moved to 'struct firmware_priv' but since it is just
  32. * guarding for corner cases a global lock should be OK */
  33. static DEFINE_MUTEX(fw_lock);
  34. struct firmware_priv {
  35. char *fw_id;
  36. struct completion completion;
  37. struct bin_attribute attr_data;
  38. struct firmware *fw;
  39. unsigned long status;
  40. struct page **pages;
  41. int nr_pages;
  42. int page_array_size;
  43. const char *vdata;
  44. struct timer_list timeout;
  45. };
  46. #ifdef CONFIG_FW_LOADER
  47. extern struct builtin_fw __start_builtin_fw[];
  48. extern struct builtin_fw __end_builtin_fw[];
  49. #else /* Module case. Avoid ifdefs later; it'll all optimise out */
  50. static struct builtin_fw *__start_builtin_fw;
  51. static struct builtin_fw *__end_builtin_fw;
  52. #endif
  53. static void
  54. fw_load_abort(struct firmware_priv *fw_priv)
  55. {
  56. set_bit(FW_STATUS_ABORT, &fw_priv->status);
  57. wmb();
  58. complete(&fw_priv->completion);
  59. }
  60. static ssize_t
  61. firmware_timeout_show(struct class *class,
  62. struct class_attribute *attr,
  63. char *buf)
  64. {
  65. return sprintf(buf, "%d\n", loading_timeout);
  66. }
  67. /**
  68. * firmware_timeout_store - set number of seconds to wait for firmware
  69. * @class: device class pointer
  70. * @buf: buffer to scan for timeout value
  71. * @count: number of bytes in @buf
  72. *
  73. * Sets the number of seconds to wait for the firmware. Once
  74. * this expires an error will be returned to the driver and no
  75. * firmware will be provided.
  76. *
  77. * Note: zero means 'wait forever'.
  78. **/
  79. static ssize_t
  80. firmware_timeout_store(struct class *class,
  81. struct class_attribute *attr,
  82. const char *buf, size_t count)
  83. {
  84. loading_timeout = simple_strtol(buf, NULL, 10);
  85. if (loading_timeout < 0)
  86. loading_timeout = 0;
  87. return count;
  88. }
  89. static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store);
  90. static void fw_dev_release(struct device *dev);
  91. static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
  92. {
  93. struct firmware_priv *fw_priv = dev_get_drvdata(dev);
  94. if (add_uevent_var(env, "FIRMWARE=%s", fw_priv->fw_id))
  95. return -ENOMEM;
  96. if (add_uevent_var(env, "TIMEOUT=%i", loading_timeout))
  97. return -ENOMEM;
  98. return 0;
  99. }
  100. static struct class firmware_class = {
  101. .name = "firmware",
  102. .dev_uevent = firmware_uevent,
  103. .dev_release = fw_dev_release,
  104. };
  105. static ssize_t firmware_loading_show(struct device *dev,
  106. struct device_attribute *attr, char *buf)
  107. {
  108. struct firmware_priv *fw_priv = dev_get_drvdata(dev);
  109. int loading = test_bit(FW_STATUS_LOADING, &fw_priv->status);
  110. return sprintf(buf, "%d\n", loading);
  111. }
  112. /* Some architectures don't have PAGE_KERNEL_RO */
  113. #ifndef PAGE_KERNEL_RO
  114. #define PAGE_KERNEL_RO PAGE_KERNEL
  115. #endif
  116. /**
  117. * firmware_loading_store - set value in the 'loading' control file
  118. * @dev: device pointer
  119. * @attr: device attribute pointer
  120. * @buf: buffer to scan for loading control value
  121. * @count: number of bytes in @buf
  122. *
  123. * The relevant values are:
  124. *
  125. * 1: Start a load, discarding any previous partial load.
  126. * 0: Conclude the load and hand the data to the driver code.
  127. * -1: Conclude the load with an error and discard any written data.
  128. **/
  129. static ssize_t firmware_loading_store(struct device *dev,
  130. struct device_attribute *attr,
  131. const char *buf, size_t count)
  132. {
  133. struct firmware_priv *fw_priv = dev_get_drvdata(dev);
  134. int loading = simple_strtol(buf, NULL, 10);
  135. int i;
  136. switch (loading) {
  137. case 1:
  138. mutex_lock(&fw_lock);
  139. if (!fw_priv->fw) {
  140. mutex_unlock(&fw_lock);
  141. break;
  142. }
  143. vfree(fw_priv->fw->data);
  144. fw_priv->fw->data = NULL;
  145. for (i = 0; i < fw_priv->nr_pages; i++)
  146. __free_page(fw_priv->pages[i]);
  147. kfree(fw_priv->pages);
  148. fw_priv->pages = NULL;
  149. fw_priv->page_array_size = 0;
  150. fw_priv->nr_pages = 0;
  151. fw_priv->fw->size = 0;
  152. set_bit(FW_STATUS_LOADING, &fw_priv->status);
  153. mutex_unlock(&fw_lock);
  154. break;
  155. case 0:
  156. if (test_bit(FW_STATUS_LOADING, &fw_priv->status)) {
  157. vfree(fw_priv->fw->data);
  158. fw_priv->fw->data = vmap(fw_priv->pages,
  159. fw_priv->nr_pages,
  160. 0, PAGE_KERNEL_RO);
  161. if (!fw_priv->fw->data) {
  162. dev_err(dev, "%s: vmap() failed\n", __func__);
  163. goto err;
  164. }
  165. /* Pages will be freed by vfree() */
  166. fw_priv->page_array_size = 0;
  167. fw_priv->nr_pages = 0;
  168. complete(&fw_priv->completion);
  169. clear_bit(FW_STATUS_LOADING, &fw_priv->status);
  170. break;
  171. }
  172. /* fallthrough */
  173. default:
  174. dev_err(dev, "%s: unexpected value (%d)\n", __func__, loading);
  175. /* fallthrough */
  176. case -1:
  177. err:
  178. fw_load_abort(fw_priv);
  179. break;
  180. }
  181. return count;
  182. }
  183. static DEVICE_ATTR(loading, 0644, firmware_loading_show, firmware_loading_store);
  184. static ssize_t
  185. firmware_data_read(struct kobject *kobj, struct bin_attribute *bin_attr,
  186. char *buffer, loff_t offset, size_t count)
  187. {
  188. struct device *dev = to_dev(kobj);
  189. struct firmware_priv *fw_priv = dev_get_drvdata(dev);
  190. struct firmware *fw;
  191. ssize_t ret_count;
  192. mutex_lock(&fw_lock);
  193. fw = fw_priv->fw;
  194. if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) {
  195. ret_count = -ENODEV;
  196. goto out;
  197. }
  198. if (offset > fw->size) {
  199. ret_count = 0;
  200. goto out;
  201. }
  202. if (count > fw->size - offset)
  203. count = fw->size - offset;
  204. ret_count = count;
  205. while (count) {
  206. void *page_data;
  207. int page_nr = offset >> PAGE_SHIFT;
  208. int page_ofs = offset & (PAGE_SIZE-1);
  209. int page_cnt = min_t(size_t, PAGE_SIZE - page_ofs, count);
  210. page_data = kmap(fw_priv->pages[page_nr]);
  211. memcpy(buffer, page_data + page_ofs, page_cnt);
  212. kunmap(fw_priv->pages[page_nr]);
  213. buffer += page_cnt;
  214. offset += page_cnt;
  215. count -= page_cnt;
  216. }
  217. out:
  218. mutex_unlock(&fw_lock);
  219. return ret_count;
  220. }
  221. static int
  222. fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size)
  223. {
  224. int pages_needed = ALIGN(min_size, PAGE_SIZE) >> PAGE_SHIFT;
  225. /* If the array of pages is too small, grow it... */
  226. if (fw_priv->page_array_size < pages_needed) {
  227. int new_array_size = max(pages_needed,
  228. fw_priv->page_array_size * 2);
  229. struct page **new_pages;
  230. new_pages = kmalloc(new_array_size * sizeof(void *),
  231. GFP_KERNEL);
  232. if (!new_pages) {
  233. fw_load_abort(fw_priv);
  234. return -ENOMEM;
  235. }
  236. memcpy(new_pages, fw_priv->pages,
  237. fw_priv->page_array_size * sizeof(void *));
  238. memset(&new_pages[fw_priv->page_array_size], 0, sizeof(void *) *
  239. (new_array_size - fw_priv->page_array_size));
  240. kfree(fw_priv->pages);
  241. fw_priv->pages = new_pages;
  242. fw_priv->page_array_size = new_array_size;
  243. }
  244. while (fw_priv->nr_pages < pages_needed) {
  245. fw_priv->pages[fw_priv->nr_pages] =
  246. alloc_page(GFP_KERNEL | __GFP_HIGHMEM);
  247. if (!fw_priv->pages[fw_priv->nr_pages]) {
  248. fw_load_abort(fw_priv);
  249. return -ENOMEM;
  250. }
  251. fw_priv->nr_pages++;
  252. }
  253. return 0;
  254. }
  255. /**
  256. * firmware_data_write - write method for firmware
  257. * @kobj: kobject for the device
  258. * @bin_attr: bin_attr structure
  259. * @buffer: buffer being written
  260. * @offset: buffer offset for write in total data store area
  261. * @count: buffer size
  262. *
  263. * Data written to the 'data' attribute will be later handed to
  264. * the driver as a firmware image.
  265. **/
  266. static ssize_t
  267. firmware_data_write(struct kobject *kobj, struct bin_attribute *bin_attr,
  268. char *buffer, loff_t offset, size_t count)
  269. {
  270. struct device *dev = to_dev(kobj);
  271. struct firmware_priv *fw_priv = dev_get_drvdata(dev);
  272. struct firmware *fw;
  273. ssize_t retval;
  274. if (!capable(CAP_SYS_RAWIO))
  275. return -EPERM;
  276. mutex_lock(&fw_lock);
  277. fw = fw_priv->fw;
  278. if (!fw || test_bit(FW_STATUS_DONE, &fw_priv->status)) {
  279. retval = -ENODEV;
  280. goto out;
  281. }
  282. retval = fw_realloc_buffer(fw_priv, offset + count);
  283. if (retval)
  284. goto out;
  285. retval = count;
  286. while (count) {
  287. void *page_data;
  288. int page_nr = offset >> PAGE_SHIFT;
  289. int page_ofs = offset & (PAGE_SIZE - 1);
  290. int page_cnt = min_t(size_t, PAGE_SIZE - page_ofs, count);
  291. page_data = kmap(fw_priv->pages[page_nr]);
  292. memcpy(page_data + page_ofs, buffer, page_cnt);
  293. kunmap(fw_priv->pages[page_nr]);
  294. buffer += page_cnt;
  295. offset += page_cnt;
  296. count -= page_cnt;
  297. }
  298. fw->size = max_t(size_t, offset, fw->size);
  299. out:
  300. mutex_unlock(&fw_lock);
  301. return retval;
  302. }
  303. static struct bin_attribute firmware_attr_data_tmpl = {
  304. .attr = {.name = "data", .mode = 0644},
  305. .size = 0,
  306. .read = firmware_data_read,
  307. .write = firmware_data_write,
  308. };
  309. static void fw_dev_release(struct device *dev)
  310. {
  311. struct firmware_priv *fw_priv = dev_get_drvdata(dev);
  312. int i;
  313. for (i = 0; i < fw_priv->nr_pages; i++)
  314. __free_page(fw_priv->pages[i]);
  315. kfree(fw_priv->pages);
  316. kfree(fw_priv->fw_id);
  317. kfree(fw_priv);
  318. kfree(dev);
  319. module_put(THIS_MODULE);
  320. }
  321. static void
  322. firmware_class_timeout(u_long data)
  323. {
  324. struct firmware_priv *fw_priv = (struct firmware_priv *) data;
  325. fw_load_abort(fw_priv);
  326. }
  327. static int fw_register_device(struct device **dev_p, const char *fw_name,
  328. struct device *device)
  329. {
  330. int retval;
  331. struct firmware_priv *fw_priv = kzalloc(sizeof(*fw_priv),
  332. GFP_KERNEL);
  333. struct device *f_dev = kzalloc(sizeof(*f_dev), GFP_KERNEL);
  334. *dev_p = NULL;
  335. if (!fw_priv || !f_dev) {
  336. dev_err(device, "%s: kmalloc failed\n", __func__);
  337. retval = -ENOMEM;
  338. goto error_kfree;
  339. }
  340. init_completion(&fw_priv->completion);
  341. fw_priv->attr_data = firmware_attr_data_tmpl;
  342. fw_priv->fw_id = kstrdup(fw_name, GFP_KERNEL);
  343. if (!fw_priv->fw_id) {
  344. dev_err(device, "%s: Firmware name allocation failed\n",
  345. __func__);
  346. retval = -ENOMEM;
  347. goto error_kfree;
  348. }
  349. fw_priv->timeout.function = firmware_class_timeout;
  350. fw_priv->timeout.data = (u_long) fw_priv;
  351. init_timer(&fw_priv->timeout);
  352. dev_set_name(f_dev, "%s", dev_name(device));
  353. f_dev->parent = device;
  354. f_dev->class = &firmware_class;
  355. dev_set_drvdata(f_dev, fw_priv);
  356. dev_set_uevent_suppress(f_dev, 1);
  357. retval = device_register(f_dev);
  358. if (retval) {
  359. dev_err(device, "%s: device_register failed\n", __func__);
  360. put_device(f_dev);
  361. return retval;
  362. }
  363. *dev_p = f_dev;
  364. return 0;
  365. error_kfree:
  366. kfree(f_dev);
  367. kfree(fw_priv);
  368. return retval;
  369. }
  370. static int fw_setup_device(struct firmware *fw, struct device **dev_p,
  371. const char *fw_name, struct device *device,
  372. int uevent)
  373. {
  374. struct device *f_dev;
  375. struct firmware_priv *fw_priv;
  376. int retval;
  377. *dev_p = NULL;
  378. retval = fw_register_device(&f_dev, fw_name, device);
  379. if (retval)
  380. goto out;
  381. /* Need to pin this module until class device is destroyed */
  382. __module_get(THIS_MODULE);
  383. fw_priv = dev_get_drvdata(f_dev);
  384. fw_priv->fw = fw;
  385. retval = sysfs_create_bin_file(&f_dev->kobj, &fw_priv->attr_data);
  386. if (retval) {
  387. dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__);
  388. goto error_unreg;
  389. }
  390. retval = device_create_file(f_dev, &dev_attr_loading);
  391. if (retval) {
  392. dev_err(device, "%s: device_create_file failed\n", __func__);
  393. goto error_unreg;
  394. }
  395. if (uevent)
  396. dev_set_uevent_suppress(f_dev, 0);
  397. *dev_p = f_dev;
  398. goto out;
  399. error_unreg:
  400. device_unregister(f_dev);
  401. out:
  402. return retval;
  403. }
  404. static int
  405. _request_firmware(const struct firmware **firmware_p, const char *name,
  406. struct device *device, int uevent)
  407. {
  408. struct device *f_dev;
  409. struct firmware_priv *fw_priv;
  410. struct firmware *firmware;
  411. struct builtin_fw *builtin;
  412. int retval;
  413. if (!firmware_p)
  414. return -EINVAL;
  415. *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL);
  416. if (!firmware) {
  417. dev_err(device, "%s: kmalloc(struct firmware) failed\n",
  418. __func__);
  419. retval = -ENOMEM;
  420. goto out;
  421. }
  422. for (builtin = __start_builtin_fw; builtin != __end_builtin_fw;
  423. builtin++) {
  424. if (strcmp(name, builtin->name))
  425. continue;
  426. dev_info(device, "firmware: using built-in firmware %s\n",
  427. name);
  428. firmware->size = builtin->size;
  429. firmware->data = builtin->data;
  430. return 0;
  431. }
  432. if (uevent)
  433. dev_info(device, "firmware: requesting %s\n", name);
  434. retval = fw_setup_device(firmware, &f_dev, name, device, uevent);
  435. if (retval)
  436. goto error_kfree_fw;
  437. fw_priv = dev_get_drvdata(f_dev);
  438. if (uevent) {
  439. if (loading_timeout > 0) {
  440. fw_priv->timeout.expires = jiffies + loading_timeout * HZ;
  441. add_timer(&fw_priv->timeout);
  442. }
  443. kobject_uevent(&f_dev->kobj, KOBJ_ADD);
  444. wait_for_completion(&fw_priv->completion);
  445. set_bit(FW_STATUS_DONE, &fw_priv->status);
  446. del_timer_sync(&fw_priv->timeout);
  447. } else
  448. wait_for_completion(&fw_priv->completion);
  449. mutex_lock(&fw_lock);
  450. if (!fw_priv->fw->size || test_bit(FW_STATUS_ABORT, &fw_priv->status)) {
  451. retval = -ENOENT;
  452. release_firmware(fw_priv->fw);
  453. *firmware_p = NULL;
  454. }
  455. fw_priv->fw = NULL;
  456. mutex_unlock(&fw_lock);
  457. device_unregister(f_dev);
  458. goto out;
  459. error_kfree_fw:
  460. kfree(firmware);
  461. *firmware_p = NULL;
  462. out:
  463. return retval;
  464. }
  465. /**
  466. * request_firmware: - send firmware request and wait for it
  467. * @firmware_p: pointer to firmware image
  468. * @name: name of firmware file
  469. * @device: device for which firmware is being loaded
  470. *
  471. * @firmware_p will be used to return a firmware image by the name
  472. * of @name for device @device.
  473. *
  474. * Should be called from user context where sleeping is allowed.
  475. *
  476. * @name will be used as $FIRMWARE in the uevent environment and
  477. * should be distinctive enough not to be confused with any other
  478. * firmware image for this or any other device.
  479. **/
  480. int
  481. request_firmware(const struct firmware **firmware_p, const char *name,
  482. struct device *device)
  483. {
  484. int uevent = 1;
  485. return _request_firmware(firmware_p, name, device, uevent);
  486. }
  487. /**
  488. * release_firmware: - release the resource associated with a firmware image
  489. * @fw: firmware resource to release
  490. **/
  491. void
  492. release_firmware(const struct firmware *fw)
  493. {
  494. struct builtin_fw *builtin;
  495. if (fw) {
  496. for (builtin = __start_builtin_fw; builtin != __end_builtin_fw;
  497. builtin++) {
  498. if (fw->data == builtin->data)
  499. goto free_fw;
  500. }
  501. vfree(fw->data);
  502. free_fw:
  503. kfree(fw);
  504. }
  505. }
  506. /* Async support */
  507. struct firmware_work {
  508. struct work_struct work;
  509. struct module *module;
  510. const char *name;
  511. struct device *device;
  512. void *context;
  513. void (*cont)(const struct firmware *fw, void *context);
  514. int uevent;
  515. };
  516. static int
  517. request_firmware_work_func(void *arg)
  518. {
  519. struct firmware_work *fw_work = arg;
  520. const struct firmware *fw;
  521. int ret;
  522. if (!arg) {
  523. WARN_ON(1);
  524. return 0;
  525. }
  526. ret = _request_firmware(&fw, fw_work->name, fw_work->device,
  527. fw_work->uevent);
  528. fw_work->cont(fw, fw_work->context);
  529. module_put(fw_work->module);
  530. kfree(fw_work);
  531. return ret;
  532. }
  533. /**
  534. * request_firmware_nowait - asynchronous version of request_firmware
  535. * @module: module requesting the firmware
  536. * @uevent: sends uevent to copy the firmware image if this flag
  537. * is non-zero else the firmware copy must be done manually.
  538. * @name: name of firmware file
  539. * @device: device for which firmware is being loaded
  540. * @gfp: allocation flags
  541. * @context: will be passed over to @cont, and
  542. * @fw may be %NULL if firmware request fails.
  543. * @cont: function will be called asynchronously when the firmware
  544. * request is over.
  545. *
  546. * Asynchronous variant of request_firmware() for user contexts where
  547. * it is not possible to sleep for long time. It can't be called
  548. * in atomic contexts.
  549. **/
  550. int
  551. request_firmware_nowait(
  552. struct module *module, int uevent,
  553. const char *name, struct device *device, gfp_t gfp, void *context,
  554. void (*cont)(const struct firmware *fw, void *context))
  555. {
  556. struct task_struct *task;
  557. struct firmware_work *fw_work = kmalloc(sizeof (struct firmware_work),
  558. gfp);
  559. if (!fw_work)
  560. return -ENOMEM;
  561. if (!try_module_get(module)) {
  562. kfree(fw_work);
  563. return -EFAULT;
  564. }
  565. *fw_work = (struct firmware_work) {
  566. .module = module,
  567. .name = name,
  568. .device = device,
  569. .context = context,
  570. .cont = cont,
  571. .uevent = uevent,
  572. };
  573. task = kthread_run(request_firmware_work_func, fw_work,
  574. "firmware/%s", name);
  575. if (IS_ERR(task)) {
  576. fw_work->cont(NULL, fw_work->context);
  577. module_put(fw_work->module);
  578. kfree(fw_work);
  579. return PTR_ERR(task);
  580. }
  581. return 0;
  582. }
  583. static int __init
  584. firmware_class_init(void)
  585. {
  586. int error;
  587. error = class_register(&firmware_class);
  588. if (error) {
  589. printk(KERN_ERR "%s: class_register failed\n", __func__);
  590. return error;
  591. }
  592. error = class_create_file(&firmware_class, &class_attr_timeout);
  593. if (error) {
  594. printk(KERN_ERR "%s: class_create_file failed\n",
  595. __func__);
  596. class_unregister(&firmware_class);
  597. }
  598. return error;
  599. }
  600. static void __exit
  601. firmware_class_exit(void)
  602. {
  603. class_unregister(&firmware_class);
  604. }
  605. fs_initcall(firmware_class_init);
  606. module_exit(firmware_class_exit);
  607. EXPORT_SYMBOL(release_firmware);
  608. EXPORT_SYMBOL(request_firmware);
  609. EXPORT_SYMBOL(request_firmware_nowait);