dell_rbu.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. /*
  2. * dell_rbu.c
  3. * Bios Update driver for Dell systems
  4. * Author: Dell Inc
  5. * Abhay Salunke <abhay_salunke@dell.com>
  6. *
  7. * Copyright (C) 2005 Dell Inc.
  8. *
  9. * Remote BIOS Update (rbu) driver is used for updating DELL BIOS by
  10. * creating entries in the /sys file systems on Linux 2.6 and higher
  11. * kernels. The driver supports two mechanism to update the BIOS namely
  12. * contiguous and packetized. Both these methods still require having some
  13. * application to set the CMOS bit indicating the BIOS to update itself
  14. * after a reboot.
  15. *
  16. * Contiguous method:
  17. * This driver writes the incoming data in a monolithic image by allocating
  18. * contiguous physical pages large enough to accommodate the incoming BIOS
  19. * image size.
  20. *
  21. * Packetized method:
  22. * The driver writes the incoming packet image by allocating a new packet
  23. * on every time the packet data is written. This driver requires an
  24. * application to break the BIOS image in to fixed sized packet chunks.
  25. *
  26. * See Documentation/dell_rbu.txt for more info.
  27. *
  28. * This program is free software; you can redistribute it and/or modify
  29. * it under the terms of the GNU General Public License v2.0 as published by
  30. * the Free Software Foundation
  31. *
  32. * This program is distributed in the hope that it will be useful,
  33. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  34. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  35. * GNU General Public License for more details.
  36. */
  37. #include <linux/version.h>
  38. #include <linux/config.h>
  39. #include <linux/init.h>
  40. #include <linux/module.h>
  41. #include <linux/string.h>
  42. #include <linux/errno.h>
  43. #include <linux/blkdev.h>
  44. #include <linux/device.h>
  45. #include <linux/spinlock.h>
  46. #include <linux/moduleparam.h>
  47. #include <linux/firmware.h>
  48. #include <linux/dma-mapping.h>
  49. MODULE_AUTHOR("Abhay Salunke <abhay_salunke@dell.com>");
  50. MODULE_DESCRIPTION("Driver for updating BIOS image on DELL systems");
  51. MODULE_LICENSE("GPL");
  52. MODULE_VERSION("2.0");
  53. #define BIOS_SCAN_LIMIT 0xffffffff
  54. #define MAX_IMAGE_LENGTH 16
  55. static struct _rbu_data {
  56. void *image_update_buffer;
  57. unsigned long image_update_buffer_size;
  58. unsigned long bios_image_size;
  59. int image_update_ordernum;
  60. int dma_alloc;
  61. spinlock_t lock;
  62. unsigned long packet_read_count;
  63. unsigned long packet_write_count;
  64. unsigned long num_packets;
  65. unsigned long packetsize;
  66. int entry_created;
  67. } rbu_data;
  68. static char image_type[MAX_IMAGE_LENGTH + 1] = "mono";
  69. module_param_string(image_type, image_type, sizeof (image_type), 0);
  70. MODULE_PARM_DESC(image_type, "BIOS image type. choose- mono or packet");
  71. struct packet_data {
  72. struct list_head list;
  73. size_t length;
  74. void *data;
  75. int ordernum;
  76. };
  77. static struct packet_data packet_data_head;
  78. static struct platform_device *rbu_device;
  79. static int context;
  80. static dma_addr_t dell_rbu_dmaaddr;
  81. static void init_packet_head(void)
  82. {
  83. INIT_LIST_HEAD(&packet_data_head.list);
  84. rbu_data.packet_write_count = 0;
  85. rbu_data.packet_read_count = 0;
  86. rbu_data.num_packets = 0;
  87. rbu_data.packetsize = 0;
  88. }
  89. static int fill_last_packet(void *data, size_t length)
  90. {
  91. struct list_head *ptemp_list;
  92. struct packet_data *packet = NULL;
  93. int packet_count = 0;
  94. pr_debug("fill_last_packet: entry \n");
  95. if (!rbu_data.num_packets) {
  96. pr_debug("fill_last_packet: num_packets=0\n");
  97. return -ENOMEM;
  98. }
  99. packet_count = rbu_data.num_packets;
  100. ptemp_list = (&packet_data_head.list)->prev;
  101. packet = list_entry(ptemp_list, struct packet_data, list);
  102. if ((rbu_data.packet_write_count + length) > rbu_data.packetsize) {
  103. pr_debug("dell_rbu:%s: packet size data "
  104. "overrun\n", __FUNCTION__);
  105. return -EINVAL;
  106. }
  107. pr_debug("fill_last_packet : buffer = %p\n", packet->data);
  108. memcpy((packet->data + rbu_data.packet_write_count), data, length);
  109. if ((rbu_data.packet_write_count + length) == rbu_data.packetsize) {
  110. /*
  111. * this was the last data chunk in the packet
  112. * so reinitialize the packet data counter to zero
  113. */
  114. rbu_data.packet_write_count = 0;
  115. } else
  116. rbu_data.packet_write_count += length;
  117. pr_debug("fill_last_packet: exit \n");
  118. return 0;
  119. }
  120. static int create_packet(size_t length)
  121. {
  122. struct packet_data *newpacket;
  123. int ordernum = 0;
  124. pr_debug("create_packet: entry \n");
  125. if (!rbu_data.packetsize) {
  126. pr_debug("create_packet: packetsize not specified\n");
  127. return -EINVAL;
  128. }
  129. spin_unlock(&rbu_data.lock);
  130. newpacket = kmalloc(sizeof (struct packet_data), GFP_KERNEL);
  131. spin_lock(&rbu_data.lock);
  132. if (!newpacket) {
  133. printk(KERN_WARNING
  134. "dell_rbu:%s: failed to allocate new "
  135. "packet\n", __FUNCTION__);
  136. return -ENOMEM;
  137. }
  138. ordernum = get_order(length);
  139. /*
  140. * there is no upper limit on memory
  141. * address for packetized mechanism
  142. */
  143. spin_unlock(&rbu_data.lock);
  144. newpacket->data = (unsigned char *) __get_free_pages(GFP_KERNEL,
  145. ordernum);
  146. spin_lock(&rbu_data.lock);
  147. pr_debug("create_packet: newpacket %p\n", newpacket->data);
  148. if (!newpacket->data) {
  149. printk(KERN_WARNING
  150. "dell_rbu:%s: failed to allocate new "
  151. "packet\n", __FUNCTION__);
  152. kfree(newpacket);
  153. return -ENOMEM;
  154. }
  155. newpacket->ordernum = ordernum;
  156. ++rbu_data.num_packets;
  157. /*
  158. * initialize the newly created packet headers
  159. */
  160. INIT_LIST_HEAD(&newpacket->list);
  161. list_add_tail(&newpacket->list, &packet_data_head.list);
  162. /*
  163. * packets have fixed size
  164. */
  165. newpacket->length = rbu_data.packetsize;
  166. pr_debug("create_packet: exit \n");
  167. return 0;
  168. }
  169. static int packetize_data(void *data, size_t length)
  170. {
  171. int rc = 0;
  172. if (!rbu_data.packet_write_count) {
  173. if ((rc = create_packet(length)))
  174. return rc;
  175. }
  176. if ((rc = fill_last_packet(data, length)))
  177. return rc;
  178. return rc;
  179. }
  180. static int do_packet_read(char *data, struct list_head *ptemp_list,
  181. int length, int bytes_read, int *list_read_count)
  182. {
  183. void *ptemp_buf;
  184. struct packet_data *newpacket = NULL;
  185. int bytes_copied = 0;
  186. int j = 0;
  187. newpacket = list_entry(ptemp_list, struct packet_data, list);
  188. *list_read_count += newpacket->length;
  189. if (*list_read_count > bytes_read) {
  190. /* point to the start of unread data */
  191. j = newpacket->length - (*list_read_count - bytes_read);
  192. /* point to the offset in the packet buffer */
  193. ptemp_buf = (u8 *) newpacket->data + j;
  194. /*
  195. * check if there is enough room in
  196. * * the incoming buffer
  197. */
  198. if (length > (*list_read_count - bytes_read))
  199. /*
  200. * copy what ever is there in this
  201. * packet and move on
  202. */
  203. bytes_copied = (*list_read_count - bytes_read);
  204. else
  205. /* copy the remaining */
  206. bytes_copied = length;
  207. memcpy(data, ptemp_buf, bytes_copied);
  208. }
  209. return bytes_copied;
  210. }
  211. static int packet_read_list(char *data, size_t *pread_length)
  212. {
  213. struct list_head *ptemp_list;
  214. int temp_count = 0;
  215. int bytes_copied = 0;
  216. int bytes_read = 0;
  217. int remaining_bytes = 0;
  218. char *pdest = data;
  219. /* check if we have any packets */
  220. if (0 == rbu_data.num_packets)
  221. return -ENOMEM;
  222. remaining_bytes = *pread_length;
  223. bytes_read = rbu_data.packet_read_count;
  224. ptemp_list = (&packet_data_head.list)->next;
  225. while (!list_empty(ptemp_list)) {
  226. bytes_copied = do_packet_read(pdest, ptemp_list,
  227. remaining_bytes, bytes_read, &temp_count);
  228. remaining_bytes -= bytes_copied;
  229. bytes_read += bytes_copied;
  230. pdest += bytes_copied;
  231. /*
  232. * check if we reached end of buffer before reaching the
  233. * last packet
  234. */
  235. if (remaining_bytes == 0)
  236. break;
  237. ptemp_list = ptemp_list->next;
  238. }
  239. /*finally set the bytes read */
  240. *pread_length = bytes_read - rbu_data.packet_read_count;
  241. rbu_data.packet_read_count = bytes_read;
  242. return 0;
  243. }
  244. static void packet_empty_list(void)
  245. {
  246. struct list_head *ptemp_list;
  247. struct list_head *pnext_list;
  248. struct packet_data *newpacket;
  249. ptemp_list = (&packet_data_head.list)->next;
  250. while (!list_empty(ptemp_list)) {
  251. newpacket =
  252. list_entry(ptemp_list, struct packet_data, list);
  253. pnext_list = ptemp_list->next;
  254. list_del(ptemp_list);
  255. ptemp_list = pnext_list;
  256. /*
  257. * zero out the RBU packet memory before freeing
  258. * to make sure there are no stale RBU packets left in memory
  259. */
  260. memset(newpacket->data, 0, rbu_data.packetsize);
  261. free_pages((unsigned long) newpacket->data,
  262. newpacket->ordernum);
  263. kfree(newpacket);
  264. }
  265. rbu_data.packet_write_count = 0;
  266. rbu_data.packet_read_count = 0;
  267. rbu_data.num_packets = 0;
  268. rbu_data.packetsize = 0;
  269. }
  270. /*
  271. * img_update_free: Frees the buffer allocated for storing BIOS image
  272. * Always called with lock held and returned with lock held
  273. */
  274. static void img_update_free(void)
  275. {
  276. if (!rbu_data.image_update_buffer)
  277. return;
  278. /*
  279. * zero out this buffer before freeing it to get rid of any stale
  280. * BIOS image copied in memory.
  281. */
  282. memset(rbu_data.image_update_buffer, 0,
  283. rbu_data.image_update_buffer_size);
  284. if (rbu_data.dma_alloc == 1)
  285. dma_free_coherent(NULL, rbu_data.bios_image_size,
  286. rbu_data.image_update_buffer, dell_rbu_dmaaddr);
  287. else
  288. free_pages((unsigned long) rbu_data.image_update_buffer,
  289. rbu_data.image_update_ordernum);
  290. /*
  291. * Re-initialize the rbu_data variables after a free
  292. */
  293. rbu_data.image_update_ordernum = -1;
  294. rbu_data.image_update_buffer = NULL;
  295. rbu_data.image_update_buffer_size = 0;
  296. rbu_data.bios_image_size = 0;
  297. rbu_data.dma_alloc = 0;
  298. }
  299. /*
  300. * img_update_realloc: This function allocates the contiguous pages to
  301. * accommodate the requested size of data. The memory address and size
  302. * values are stored globally and on every call to this function the new
  303. * size is checked to see if more data is required than the existing size.
  304. * If true the previous memory is freed and new allocation is done to
  305. * accommodate the new size. If the incoming size is less then than the
  306. * already allocated size, then that memory is reused. This function is
  307. * called with lock held and returns with lock held.
  308. */
  309. static int img_update_realloc(unsigned long size)
  310. {
  311. unsigned char *image_update_buffer = NULL;
  312. unsigned long rc;
  313. unsigned long img_buf_phys_addr;
  314. int ordernum;
  315. int dma_alloc = 0;
  316. /*
  317. * check if the buffer of sufficient size has been
  318. * already allocated
  319. */
  320. if (rbu_data.image_update_buffer_size >= size) {
  321. /*
  322. * check for corruption
  323. */
  324. if ((size != 0) && (rbu_data.image_update_buffer == NULL)) {
  325. printk(KERN_ERR "dell_rbu:%s: corruption "
  326. "check failed\n", __FUNCTION__);
  327. return -EINVAL;
  328. }
  329. /*
  330. * we have a valid pre-allocated buffer with
  331. * sufficient size
  332. */
  333. return 0;
  334. }
  335. /*
  336. * free any previously allocated buffer
  337. */
  338. img_update_free();
  339. spin_unlock(&rbu_data.lock);
  340. ordernum = get_order(size);
  341. image_update_buffer =
  342. (unsigned char *) __get_free_pages(GFP_KERNEL, ordernum);
  343. img_buf_phys_addr =
  344. (unsigned long) virt_to_phys(image_update_buffer);
  345. if (img_buf_phys_addr > BIOS_SCAN_LIMIT) {
  346. free_pages((unsigned long) image_update_buffer, ordernum);
  347. ordernum = -1;
  348. image_update_buffer = dma_alloc_coherent(NULL, size,
  349. &dell_rbu_dmaaddr, GFP_KERNEL);
  350. dma_alloc = 1;
  351. }
  352. spin_lock(&rbu_data.lock);
  353. if (image_update_buffer != NULL) {
  354. rbu_data.image_update_buffer = image_update_buffer;
  355. rbu_data.image_update_buffer_size = size;
  356. rbu_data.bios_image_size =
  357. rbu_data.image_update_buffer_size;
  358. rbu_data.image_update_ordernum = ordernum;
  359. rbu_data.dma_alloc = dma_alloc;
  360. rc = 0;
  361. } else {
  362. pr_debug("Not enough memory for image update:"
  363. "size = %ld\n", size);
  364. rc = -ENOMEM;
  365. }
  366. return rc;
  367. }
  368. static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count)
  369. {
  370. int retval;
  371. size_t bytes_left;
  372. size_t data_length;
  373. char *ptempBuf = buffer;
  374. unsigned long imagesize;
  375. /* check to see if we have something to return */
  376. if (rbu_data.num_packets == 0) {
  377. pr_debug("read_packet_data: no packets written\n");
  378. retval = -ENOMEM;
  379. goto read_rbu_data_exit;
  380. }
  381. imagesize = rbu_data.num_packets * rbu_data.packetsize;
  382. if (pos > imagesize) {
  383. retval = 0;
  384. printk(KERN_WARNING "dell_rbu:read_packet_data: "
  385. "data underrun\n");
  386. goto read_rbu_data_exit;
  387. }
  388. bytes_left = imagesize - pos;
  389. data_length = min(bytes_left, count);
  390. if ((retval = packet_read_list(ptempBuf, &data_length)) < 0)
  391. goto read_rbu_data_exit;
  392. if ((pos + count) > imagesize) {
  393. rbu_data.packet_read_count = 0;
  394. /* this was the last copy */
  395. retval = bytes_left;
  396. } else
  397. retval = count;
  398. read_rbu_data_exit:
  399. return retval;
  400. }
  401. static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
  402. {
  403. unsigned char *ptemp = NULL;
  404. size_t bytes_left = 0;
  405. size_t data_length = 0;
  406. ssize_t ret_count = 0;
  407. /* check to see if we have something to return */
  408. if ((rbu_data.image_update_buffer == NULL) ||
  409. (rbu_data.bios_image_size == 0)) {
  410. pr_debug("read_rbu_data_mono: image_update_buffer %p ,"
  411. "bios_image_size %lu\n",
  412. rbu_data.image_update_buffer,
  413. rbu_data.bios_image_size);
  414. ret_count = -ENOMEM;
  415. goto read_rbu_data_exit;
  416. }
  417. if (pos > rbu_data.bios_image_size) {
  418. ret_count = 0;
  419. goto read_rbu_data_exit;
  420. }
  421. bytes_left = rbu_data.bios_image_size - pos;
  422. data_length = min(bytes_left, count);
  423. ptemp = rbu_data.image_update_buffer;
  424. memcpy(buffer, (ptemp + pos), data_length);
  425. if ((pos + count) > rbu_data.bios_image_size)
  426. /* this was the last copy */
  427. ret_count = bytes_left;
  428. else
  429. ret_count = count;
  430. read_rbu_data_exit:
  431. return ret_count;
  432. }
  433. static ssize_t read_rbu_data(struct kobject *kobj, char *buffer,
  434. loff_t pos, size_t count)
  435. {
  436. ssize_t ret_count = 0;
  437. spin_lock(&rbu_data.lock);
  438. if (!strcmp(image_type, "mono"))
  439. ret_count = read_rbu_mono_data(buffer, pos, count);
  440. else if (!strcmp(image_type, "packet"))
  441. ret_count = read_packet_data(buffer, pos, count);
  442. else
  443. pr_debug("read_rbu_data: invalid image type specified\n");
  444. spin_unlock(&rbu_data.lock);
  445. return ret_count;
  446. }
  447. static void callbackfn_rbu(const struct firmware *fw, void *context)
  448. {
  449. int rc = 0;
  450. if (!fw || !fw->size) {
  451. rbu_data.entry_created = 0;
  452. return;
  453. }
  454. spin_lock(&rbu_data.lock);
  455. if (!strcmp(image_type, "mono")) {
  456. if (!img_update_realloc(fw->size))
  457. memcpy(rbu_data.image_update_buffer,
  458. fw->data, fw->size);
  459. } else if (!strcmp(image_type, "packet")) {
  460. if (!rbu_data.packetsize)
  461. rbu_data.packetsize = fw->size;
  462. else if (rbu_data.packetsize != fw->size) {
  463. packet_empty_list();
  464. rbu_data.packetsize = fw->size;
  465. }
  466. packetize_data(fw->data, fw->size);
  467. } else
  468. pr_debug("invalid image type specified.\n");
  469. spin_unlock(&rbu_data.lock);
  470. rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG,
  471. "dell_rbu", &rbu_device->dev, &context, callbackfn_rbu);
  472. if (rc)
  473. printk(KERN_ERR
  474. "dell_rbu:%s request_firmware_nowait failed"
  475. " %d\n", __FUNCTION__, rc);
  476. else
  477. rbu_data.entry_created = 1;
  478. }
  479. static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer,
  480. loff_t pos, size_t count)
  481. {
  482. int size = 0;
  483. if (!pos)
  484. size = sprintf(buffer, "%s\n", image_type);
  485. return size;
  486. }
  487. static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer,
  488. loff_t pos, size_t count)
  489. {
  490. int rc = count;
  491. int req_firm_rc = 0;
  492. int i;
  493. spin_lock(&rbu_data.lock);
  494. /*
  495. * Find the first newline or space
  496. */
  497. for (i = 0; i < count; ++i)
  498. if (buffer[i] == '\n' || buffer[i] == ' ') {
  499. buffer[i] = '\0';
  500. break;
  501. }
  502. if (i == count)
  503. buffer[count] = '\0';
  504. if (strstr(buffer, "mono"))
  505. strcpy(image_type, "mono");
  506. else if (strstr(buffer, "packet"))
  507. strcpy(image_type, "packet");
  508. else if (strstr(buffer, "init")) {
  509. /*
  510. * If due to the user error the driver gets in a bad
  511. * state where even though it is loaded , the
  512. * /sys/class/firmware/dell_rbu entries are missing.
  513. * to cover this situation the user can recreate entries
  514. * by writing init to image_type.
  515. */
  516. if (!rbu_data.entry_created) {
  517. spin_unlock(&rbu_data.lock);
  518. req_firm_rc = request_firmware_nowait(THIS_MODULE,
  519. FW_ACTION_NOHOTPLUG, "dell_rbu",
  520. &rbu_device->dev, &context,
  521. callbackfn_rbu);
  522. if (req_firm_rc) {
  523. printk(KERN_ERR
  524. "dell_rbu:%s request_firmware_nowait"
  525. " failed %d\n", __FUNCTION__, rc);
  526. rc = -EIO;
  527. } else
  528. rbu_data.entry_created = 1;
  529. spin_lock(&rbu_data.lock);
  530. }
  531. } else {
  532. printk(KERN_WARNING "dell_rbu: image_type is invalid\n");
  533. spin_unlock(&rbu_data.lock);
  534. return -EINVAL;
  535. }
  536. /* we must free all previous allocations */
  537. packet_empty_list();
  538. img_update_free();
  539. spin_unlock(&rbu_data.lock);
  540. return rc;
  541. }
  542. static struct bin_attribute rbu_data_attr = {
  543. .attr = {
  544. .name = "data",
  545. .owner = THIS_MODULE,
  546. .mode = 0444,
  547. },
  548. .read = read_rbu_data,
  549. };
  550. static struct bin_attribute rbu_image_type_attr = {
  551. .attr = {
  552. .name = "image_type",
  553. .owner = THIS_MODULE,
  554. .mode = 0644,
  555. },
  556. .read = read_rbu_image_type,
  557. .write = write_rbu_image_type,
  558. };
  559. static int __init dcdrbu_init(void)
  560. {
  561. int rc = 0;
  562. spin_lock_init(&rbu_data.lock);
  563. init_packet_head();
  564. rbu_device =
  565. platform_device_register_simple("dell_rbu", -1, NULL, 0);
  566. if (!rbu_device) {
  567. printk(KERN_ERR
  568. "dell_rbu:%s:platform_device_register_simple "
  569. "failed\n", __FUNCTION__);
  570. return -EIO;
  571. }
  572. sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_data_attr);
  573. sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_image_type_attr);
  574. rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG,
  575. "dell_rbu", &rbu_device->dev, &context, callbackfn_rbu);
  576. if (rc)
  577. printk(KERN_ERR "dell_rbu:%s:request_firmware_nowait"
  578. " failed %d\n", __FUNCTION__, rc);
  579. else
  580. rbu_data.entry_created = 1;
  581. return rc;
  582. }
  583. static __exit void dcdrbu_exit(void)
  584. {
  585. spin_lock(&rbu_data.lock);
  586. packet_empty_list();
  587. img_update_free();
  588. spin_unlock(&rbu_data.lock);
  589. platform_device_unregister(rbu_device);
  590. }
  591. module_exit(dcdrbu_exit);
  592. module_init(dcdrbu_init);