dell_rbu.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  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("3.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 num_packets;
  64. unsigned long packetsize;
  65. unsigned long imagesize;
  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,
  71. "BIOS image type. choose- mono or packet or init");
  72. struct packet_data {
  73. struct list_head list;
  74. size_t length;
  75. void *data;
  76. int ordernum;
  77. };
  78. static struct packet_data packet_data_head;
  79. static struct platform_device *rbu_device;
  80. static int context;
  81. static dma_addr_t dell_rbu_dmaaddr;
  82. static void init_packet_head(void)
  83. {
  84. INIT_LIST_HEAD(&packet_data_head.list);
  85. rbu_data.packet_read_count = 0;
  86. rbu_data.num_packets = 0;
  87. rbu_data.packetsize = 0;
  88. rbu_data.imagesize = 0;
  89. }
  90. static int create_packet(void *data, size_t length)
  91. {
  92. struct packet_data *newpacket;
  93. int ordernum = 0;
  94. pr_debug("create_packet: entry \n");
  95. if (!rbu_data.packetsize) {
  96. pr_debug("create_packet: packetsize not specified\n");
  97. return -EINVAL;
  98. }
  99. spin_unlock(&rbu_data.lock);
  100. newpacket = kmalloc(sizeof (struct packet_data), GFP_KERNEL);
  101. spin_lock(&rbu_data.lock);
  102. if (!newpacket) {
  103. printk(KERN_WARNING
  104. "dell_rbu:%s: failed to allocate new "
  105. "packet\n", __FUNCTION__);
  106. return -ENOMEM;
  107. }
  108. ordernum = get_order(length);
  109. /*
  110. * there is no upper limit on memory
  111. * address for packetized mechanism
  112. */
  113. spin_unlock(&rbu_data.lock);
  114. newpacket->data = (unsigned char *) __get_free_pages(GFP_KERNEL,
  115. ordernum);
  116. spin_lock(&rbu_data.lock);
  117. pr_debug("create_packet: newpacket %p\n", newpacket->data);
  118. if (!newpacket->data) {
  119. printk(KERN_WARNING
  120. "dell_rbu:%s: failed to allocate new "
  121. "packet\n", __FUNCTION__);
  122. kfree(newpacket);
  123. return -ENOMEM;
  124. }
  125. newpacket->ordernum = ordernum;
  126. ++rbu_data.num_packets;
  127. /*
  128. * initialize the newly created packet headers
  129. */
  130. INIT_LIST_HEAD(&newpacket->list);
  131. list_add_tail(&newpacket->list, &packet_data_head.list);
  132. /*
  133. * packets may not have fixed size
  134. */
  135. newpacket->length = length;
  136. memcpy(newpacket->data, data, length);
  137. pr_debug("create_packet: exit \n");
  138. return 0;
  139. }
  140. static int packetize_data(void *data, size_t length)
  141. {
  142. int rc = 0;
  143. int done = 0;
  144. int packet_length;
  145. u8 *temp;
  146. u8 *end = (u8 *) data + length;
  147. pr_debug("packetize_data: data length %d\n", length);
  148. if (!rbu_data.packetsize) {
  149. printk(KERN_WARNING
  150. "dell_rbu: packetsize not specified\n");
  151. return -EIO;
  152. }
  153. temp = (u8 *) data;
  154. /* packetize the hunk */
  155. while (!done) {
  156. if ((temp + rbu_data.packetsize) < end)
  157. packet_length = rbu_data.packetsize;
  158. else {
  159. /* this is the last packet */
  160. packet_length = end - temp;
  161. done = 1;
  162. }
  163. if ((rc = create_packet(temp, packet_length)))
  164. return rc;
  165. pr_debug("%lu:%lu\n", temp, (end - temp));
  166. temp += packet_length;
  167. }
  168. rbu_data.imagesize = length;
  169. return rc;
  170. }
  171. static int do_packet_read(char *data, struct list_head *ptemp_list,
  172. int length, int bytes_read, int *list_read_count)
  173. {
  174. void *ptemp_buf;
  175. struct packet_data *newpacket = NULL;
  176. int bytes_copied = 0;
  177. int j = 0;
  178. newpacket = list_entry(ptemp_list, struct packet_data, list);
  179. *list_read_count += newpacket->length;
  180. if (*list_read_count > bytes_read) {
  181. /* point to the start of unread data */
  182. j = newpacket->length - (*list_read_count - bytes_read);
  183. /* point to the offset in the packet buffer */
  184. ptemp_buf = (u8 *) newpacket->data + j;
  185. /*
  186. * check if there is enough room in
  187. * * the incoming buffer
  188. */
  189. if (length > (*list_read_count - bytes_read))
  190. /*
  191. * copy what ever is there in this
  192. * packet and move on
  193. */
  194. bytes_copied = (*list_read_count - bytes_read);
  195. else
  196. /* copy the remaining */
  197. bytes_copied = length;
  198. memcpy(data, ptemp_buf, bytes_copied);
  199. }
  200. return bytes_copied;
  201. }
  202. static int packet_read_list(char *data, size_t * pread_length)
  203. {
  204. struct list_head *ptemp_list;
  205. int temp_count = 0;
  206. int bytes_copied = 0;
  207. int bytes_read = 0;
  208. int remaining_bytes = 0;
  209. char *pdest = data;
  210. /* check if we have any packets */
  211. if (0 == rbu_data.num_packets)
  212. return -ENOMEM;
  213. remaining_bytes = *pread_length;
  214. bytes_read = rbu_data.packet_read_count;
  215. ptemp_list = (&packet_data_head.list)->next;
  216. while (!list_empty(ptemp_list)) {
  217. bytes_copied = do_packet_read(pdest, ptemp_list,
  218. remaining_bytes, bytes_read, &temp_count);
  219. remaining_bytes -= bytes_copied;
  220. bytes_read += bytes_copied;
  221. pdest += bytes_copied;
  222. /*
  223. * check if we reached end of buffer before reaching the
  224. * last packet
  225. */
  226. if (remaining_bytes == 0)
  227. break;
  228. ptemp_list = ptemp_list->next;
  229. }
  230. /*finally set the bytes read */
  231. *pread_length = bytes_read - rbu_data.packet_read_count;
  232. rbu_data.packet_read_count = bytes_read;
  233. return 0;
  234. }
  235. static void packet_empty_list(void)
  236. {
  237. struct list_head *ptemp_list;
  238. struct list_head *pnext_list;
  239. struct packet_data *newpacket;
  240. ptemp_list = (&packet_data_head.list)->next;
  241. while (!list_empty(ptemp_list)) {
  242. newpacket =
  243. list_entry(ptemp_list, struct packet_data, list);
  244. pnext_list = ptemp_list->next;
  245. list_del(ptemp_list);
  246. ptemp_list = pnext_list;
  247. /*
  248. * zero out the RBU packet memory before freeing
  249. * to make sure there are no stale RBU packets left in memory
  250. */
  251. memset(newpacket->data, 0, rbu_data.packetsize);
  252. free_pages((unsigned long) newpacket->data,
  253. newpacket->ordernum);
  254. kfree(newpacket);
  255. }
  256. rbu_data.packet_read_count = 0;
  257. rbu_data.num_packets = 0;
  258. rbu_data.imagesize = 0;
  259. }
  260. /*
  261. * img_update_free: Frees the buffer allocated for storing BIOS image
  262. * Always called with lock held and returned with lock held
  263. */
  264. static void img_update_free(void)
  265. {
  266. if (!rbu_data.image_update_buffer)
  267. return;
  268. /*
  269. * zero out this buffer before freeing it to get rid of any stale
  270. * BIOS image copied in memory.
  271. */
  272. memset(rbu_data.image_update_buffer, 0,
  273. rbu_data.image_update_buffer_size);
  274. if (rbu_data.dma_alloc == 1)
  275. dma_free_coherent(NULL, rbu_data.bios_image_size,
  276. rbu_data.image_update_buffer, dell_rbu_dmaaddr);
  277. else
  278. free_pages((unsigned long) rbu_data.image_update_buffer,
  279. rbu_data.image_update_ordernum);
  280. /*
  281. * Re-initialize the rbu_data variables after a free
  282. */
  283. rbu_data.image_update_ordernum = -1;
  284. rbu_data.image_update_buffer = NULL;
  285. rbu_data.image_update_buffer_size = 0;
  286. rbu_data.bios_image_size = 0;
  287. rbu_data.dma_alloc = 0;
  288. }
  289. /*
  290. * img_update_realloc: This function allocates the contiguous pages to
  291. * accommodate the requested size of data. The memory address and size
  292. * values are stored globally and on every call to this function the new
  293. * size is checked to see if more data is required than the existing size.
  294. * If true the previous memory is freed and new allocation is done to
  295. * accommodate the new size. If the incoming size is less then than the
  296. * already allocated size, then that memory is reused. This function is
  297. * called with lock held and returns with lock held.
  298. */
  299. static int img_update_realloc(unsigned long size)
  300. {
  301. unsigned char *image_update_buffer = NULL;
  302. unsigned long rc;
  303. unsigned long img_buf_phys_addr;
  304. int ordernum;
  305. int dma_alloc = 0;
  306. /*
  307. * check if the buffer of sufficient size has been
  308. * already allocated
  309. */
  310. if (rbu_data.image_update_buffer_size >= size) {
  311. /*
  312. * check for corruption
  313. */
  314. if ((size != 0) && (rbu_data.image_update_buffer == NULL)) {
  315. printk(KERN_ERR "dell_rbu:%s: corruption "
  316. "check failed\n", __FUNCTION__);
  317. return -EINVAL;
  318. }
  319. /*
  320. * we have a valid pre-allocated buffer with
  321. * sufficient size
  322. */
  323. return 0;
  324. }
  325. /*
  326. * free any previously allocated buffer
  327. */
  328. img_update_free();
  329. spin_unlock(&rbu_data.lock);
  330. ordernum = get_order(size);
  331. image_update_buffer =
  332. (unsigned char *) __get_free_pages(GFP_KERNEL, ordernum);
  333. img_buf_phys_addr =
  334. (unsigned long) virt_to_phys(image_update_buffer);
  335. if (img_buf_phys_addr > BIOS_SCAN_LIMIT) {
  336. free_pages((unsigned long) image_update_buffer, ordernum);
  337. ordernum = -1;
  338. image_update_buffer = dma_alloc_coherent(NULL, size,
  339. &dell_rbu_dmaaddr, GFP_KERNEL);
  340. dma_alloc = 1;
  341. }
  342. spin_lock(&rbu_data.lock);
  343. if (image_update_buffer != NULL) {
  344. rbu_data.image_update_buffer = image_update_buffer;
  345. rbu_data.image_update_buffer_size = size;
  346. rbu_data.bios_image_size =
  347. rbu_data.image_update_buffer_size;
  348. rbu_data.image_update_ordernum = ordernum;
  349. rbu_data.dma_alloc = dma_alloc;
  350. rc = 0;
  351. } else {
  352. pr_debug("Not enough memory for image update:"
  353. "size = %ld\n", size);
  354. rc = -ENOMEM;
  355. }
  356. return rc;
  357. }
  358. static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count)
  359. {
  360. int retval;
  361. size_t bytes_left;
  362. size_t data_length;
  363. char *ptempBuf = buffer;
  364. /* check to see if we have something to return */
  365. if (rbu_data.num_packets == 0) {
  366. pr_debug("read_packet_data: no packets written\n");
  367. retval = -ENOMEM;
  368. goto read_rbu_data_exit;
  369. }
  370. if (pos > rbu_data.imagesize) {
  371. retval = 0;
  372. printk(KERN_WARNING "dell_rbu:read_packet_data: "
  373. "data underrun\n");
  374. goto read_rbu_data_exit;
  375. }
  376. bytes_left = rbu_data.imagesize - pos;
  377. data_length = min(bytes_left, count);
  378. if ((retval = packet_read_list(ptempBuf, &data_length)) < 0)
  379. goto read_rbu_data_exit;
  380. if ((pos + count) > rbu_data.imagesize) {
  381. rbu_data.packet_read_count = 0;
  382. /* this was the last copy */
  383. retval = bytes_left;
  384. } else
  385. retval = count;
  386. read_rbu_data_exit:
  387. return retval;
  388. }
  389. static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
  390. {
  391. unsigned char *ptemp = NULL;
  392. size_t bytes_left = 0;
  393. size_t data_length = 0;
  394. ssize_t ret_count = 0;
  395. /* check to see if we have something to return */
  396. if ((rbu_data.image_update_buffer == NULL) ||
  397. (rbu_data.bios_image_size == 0)) {
  398. pr_debug("read_rbu_data_mono: image_update_buffer %p ,"
  399. "bios_image_size %lu\n",
  400. rbu_data.image_update_buffer,
  401. rbu_data.bios_image_size);
  402. ret_count = -ENOMEM;
  403. goto read_rbu_data_exit;
  404. }
  405. if (pos > rbu_data.bios_image_size) {
  406. ret_count = 0;
  407. goto read_rbu_data_exit;
  408. }
  409. bytes_left = rbu_data.bios_image_size - pos;
  410. data_length = min(bytes_left, count);
  411. ptemp = rbu_data.image_update_buffer;
  412. memcpy(buffer, (ptemp + pos), data_length);
  413. if ((pos + count) > rbu_data.bios_image_size)
  414. /* this was the last copy */
  415. ret_count = bytes_left;
  416. else
  417. ret_count = count;
  418. read_rbu_data_exit:
  419. return ret_count;
  420. }
  421. static ssize_t read_rbu_data(struct kobject *kobj, char *buffer,
  422. loff_t pos, size_t count)
  423. {
  424. ssize_t ret_count = 0;
  425. spin_lock(&rbu_data.lock);
  426. if (!strcmp(image_type, "mono"))
  427. ret_count = read_rbu_mono_data(buffer, pos, count);
  428. else if (!strcmp(image_type, "packet"))
  429. ret_count = read_packet_data(buffer, pos, count);
  430. else
  431. pr_debug("read_rbu_data: invalid image type specified\n");
  432. spin_unlock(&rbu_data.lock);
  433. return ret_count;
  434. }
  435. static void callbackfn_rbu(const struct firmware *fw, void *context)
  436. {
  437. int rc = 0;
  438. if (!fw || !fw->size) {
  439. rbu_data.entry_created = 0;
  440. return;
  441. }
  442. spin_lock(&rbu_data.lock);
  443. if (!strcmp(image_type, "mono")) {
  444. if (!img_update_realloc(fw->size))
  445. memcpy(rbu_data.image_update_buffer,
  446. fw->data, fw->size);
  447. } else if (!strcmp(image_type, "packet")) {
  448. /*
  449. * we need to free previous packets if a
  450. * new hunk of packets needs to be downloaded
  451. */
  452. packet_empty_list();
  453. if (packetize_data(fw->data, fw->size))
  454. /* Incase something goes wrong when we are
  455. * in middle of packetizing the data, we
  456. * need to free up whatever packets might
  457. * have been created before we quit.
  458. */
  459. packet_empty_list();
  460. } else
  461. pr_debug("invalid image type specified.\n");
  462. spin_unlock(&rbu_data.lock);
  463. rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG,
  464. "dell_rbu", &rbu_device->dev, &context, callbackfn_rbu);
  465. if (rc)
  466. printk(KERN_ERR
  467. "dell_rbu:%s request_firmware_nowait failed"
  468. " %d\n", __FUNCTION__, rc);
  469. else
  470. rbu_data.entry_created = 1;
  471. }
  472. static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer,
  473. loff_t pos, size_t count)
  474. {
  475. int size = 0;
  476. if (!pos)
  477. size = sprintf(buffer, "%s\n", image_type);
  478. return size;
  479. }
  480. static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer,
  481. loff_t pos, size_t count)
  482. {
  483. int rc = count;
  484. int req_firm_rc = 0;
  485. int i;
  486. spin_lock(&rbu_data.lock);
  487. /*
  488. * Find the first newline or space
  489. */
  490. for (i = 0; i < count; ++i)
  491. if (buffer[i] == '\n' || buffer[i] == ' ') {
  492. buffer[i] = '\0';
  493. break;
  494. }
  495. if (i == count)
  496. buffer[count] = '\0';
  497. if (strstr(buffer, "mono"))
  498. strcpy(image_type, "mono");
  499. else if (strstr(buffer, "packet"))
  500. strcpy(image_type, "packet");
  501. else if (strstr(buffer, "init")) {
  502. /*
  503. * If due to the user error the driver gets in a bad
  504. * state where even though it is loaded , the
  505. * /sys/class/firmware/dell_rbu entries are missing.
  506. * to cover this situation the user can recreate entries
  507. * by writing init to image_type.
  508. */
  509. if (!rbu_data.entry_created) {
  510. spin_unlock(&rbu_data.lock);
  511. req_firm_rc = request_firmware_nowait(THIS_MODULE,
  512. FW_ACTION_NOHOTPLUG, "dell_rbu",
  513. &rbu_device->dev, &context,
  514. callbackfn_rbu);
  515. if (req_firm_rc) {
  516. printk(KERN_ERR
  517. "dell_rbu:%s request_firmware_nowait"
  518. " failed %d\n", __FUNCTION__, rc);
  519. rc = -EIO;
  520. } else
  521. rbu_data.entry_created = 1;
  522. spin_lock(&rbu_data.lock);
  523. }
  524. } else {
  525. printk(KERN_WARNING "dell_rbu: image_type is invalid\n");
  526. spin_unlock(&rbu_data.lock);
  527. return -EINVAL;
  528. }
  529. /* we must free all previous allocations */
  530. packet_empty_list();
  531. img_update_free();
  532. spin_unlock(&rbu_data.lock);
  533. return rc;
  534. }
  535. static ssize_t read_rbu_packet_size(struct kobject *kobj, char *buffer,
  536. loff_t pos, size_t count)
  537. {
  538. int size = 0;
  539. if (!pos) {
  540. spin_lock(&rbu_data.lock);
  541. size = sprintf(buffer, "%lu\n", rbu_data.packetsize);
  542. spin_unlock(&rbu_data.lock);
  543. }
  544. return size;
  545. }
  546. static ssize_t write_rbu_packet_size(struct kobject *kobj, char *buffer,
  547. loff_t pos, size_t count)
  548. {
  549. unsigned long temp;
  550. spin_lock(&rbu_data.lock);
  551. packet_empty_list();
  552. sscanf(buffer, "%lu", &temp);
  553. if (temp < 0xffffffff)
  554. rbu_data.packetsize = temp;
  555. spin_unlock(&rbu_data.lock);
  556. return count;
  557. }
  558. static struct bin_attribute rbu_data_attr = {
  559. .attr = {.name = "data",.owner = THIS_MODULE,.mode = 0444},
  560. .read = read_rbu_data,
  561. };
  562. static struct bin_attribute rbu_image_type_attr = {
  563. .attr = {.name = "image_type",.owner = THIS_MODULE,.mode = 0644},
  564. .read = read_rbu_image_type,
  565. .write = write_rbu_image_type,
  566. };
  567. static struct bin_attribute rbu_packet_size_attr = {
  568. .attr = {.name = "packet_size",.owner = THIS_MODULE,.mode = 0644},
  569. .read = read_rbu_packet_size,
  570. .write = write_rbu_packet_size,
  571. };
  572. static int __init dcdrbu_init(void)
  573. {
  574. int rc = 0;
  575. spin_lock_init(&rbu_data.lock);
  576. init_packet_head();
  577. rbu_device =
  578. platform_device_register_simple("dell_rbu", -1, NULL, 0);
  579. if (!rbu_device) {
  580. printk(KERN_ERR
  581. "dell_rbu:%s:platform_device_register_simple "
  582. "failed\n", __FUNCTION__);
  583. return -EIO;
  584. }
  585. sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_data_attr);
  586. sysfs_create_bin_file(&rbu_device->dev.kobj, &rbu_image_type_attr);
  587. sysfs_create_bin_file(&rbu_device->dev.kobj,
  588. &rbu_packet_size_attr);
  589. rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG,
  590. "dell_rbu", &rbu_device->dev, &context, callbackfn_rbu);
  591. if (rc)
  592. printk(KERN_ERR "dell_rbu:%s:request_firmware_nowait"
  593. " failed %d\n", __FUNCTION__, rc);
  594. else
  595. rbu_data.entry_created = 1;
  596. return rc;
  597. }
  598. static __exit void dcdrbu_exit(void)
  599. {
  600. spin_lock(&rbu_data.lock);
  601. packet_empty_list();
  602. img_update_free();
  603. spin_unlock(&rbu_data.lock);
  604. platform_device_unregister(rbu_device);
  605. }
  606. module_exit(dcdrbu_exit);
  607. module_init(dcdrbu_init);