aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/firmware/dell_rbu.c68
1 files changed, 30 insertions, 38 deletions
diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c
index 9c2c2b199454..b66782398258 100644
--- a/drivers/firmware/dell_rbu.c
+++ b/drivers/firmware/dell_rbu.c
@@ -85,8 +85,7 @@ static struct platform_device *rbu_device;
85static int context; 85static int context;
86static dma_addr_t dell_rbu_dmaaddr; 86static dma_addr_t dell_rbu_dmaaddr;
87 87
88static void 88static void init_packet_head(void)
89init_packet_head(void)
90{ 89{
91 INIT_LIST_HEAD(&packet_data_head.list); 90 INIT_LIST_HEAD(&packet_data_head.list);
92 rbu_data.packet_write_count = 0; 91 rbu_data.packet_write_count = 0;
@@ -95,8 +94,7 @@ init_packet_head(void)
95 rbu_data.packetsize = 0; 94 rbu_data.packetsize = 0;
96} 95}
97 96
98static int 97static int fill_last_packet(void *data, size_t length)
99fill_last_packet(void *data, size_t length)
100{ 98{
101 struct list_head *ptemp_list; 99 struct list_head *ptemp_list;
102 struct packet_data *packet = NULL; 100 struct packet_data *packet = NULL;
@@ -138,8 +136,7 @@ fill_last_packet(void *data, size_t length)
138 return 0; 136 return 0;
139} 137}
140 138
141static int 139static int create_packet(size_t length)
142create_packet(size_t length)
143{ 140{
144 struct packet_data *newpacket; 141 struct packet_data *newpacket;
145 int ordernum = 0; 142 int ordernum = 0;
@@ -198,8 +195,7 @@ create_packet(size_t length)
198 return 0; 195 return 0;
199} 196}
200 197
201static int 198static int packetize_data(void *data, size_t length)
202packetize_data(void *data, size_t length)
203{ 199{
204 int rc = 0; 200 int rc = 0;
205 201
@@ -213,8 +209,7 @@ packetize_data(void *data, size_t length)
213 return rc; 209 return rc;
214} 210}
215 211
216static int 212static int do_packet_read(char *data, struct list_head *ptemp_list,
217do_packet_read(char *data, struct list_head *ptemp_list,
218 int length, int bytes_read, int *list_read_count) 213 int length, int bytes_read, int *list_read_count)
219{ 214{
220 void *ptemp_buf; 215 void *ptemp_buf;
@@ -248,8 +243,7 @@ do_packet_read(char *data, struct list_head *ptemp_list,
248 return bytes_copied; 243 return bytes_copied;
249} 244}
250 245
251static int 246static int packet_read_list(char *data, size_t *pread_length)
252packet_read_list(char *data, size_t * pread_length)
253{ 247{
254 struct list_head *ptemp_list; 248 struct list_head *ptemp_list;
255 int temp_count = 0; 249 int temp_count = 0;
@@ -287,8 +281,7 @@ packet_read_list(char *data, size_t * pread_length)
287 return 0; 281 return 0;
288} 282}
289 283
290static void 284static void packet_empty_list(void)
291packet_empty_list(void)
292{ 285{
293 struct list_head *ptemp_list; 286 struct list_head *ptemp_list;
294 struct list_head *pnext_list; 287 struct list_head *pnext_list;
@@ -320,8 +313,7 @@ packet_empty_list(void)
320 * img_update_free: Frees the buffer allocated for storing BIOS image 313 * img_update_free: Frees the buffer allocated for storing BIOS image
321 * Always called with lock held and returned with lock held 314 * Always called with lock held and returned with lock held
322 */ 315 */
323static void 316static void img_update_free(void)
324img_update_free(void)
325{ 317{
326 if (!rbu_data.image_update_buffer) 318 if (!rbu_data.image_update_buffer)
327 return; 319 return;
@@ -358,8 +350,7 @@ img_update_free(void)
358 * already allocated size, then that memory is reused. This function is 350 * already allocated size, then that memory is reused. This function is
359 * called with lock held and returns with lock held. 351 * called with lock held and returns with lock held.
360 */ 352 */
361static int 353static int img_update_realloc(unsigned long size)
362img_update_realloc(unsigned long size)
363{ 354{
364 unsigned char *image_update_buffer = NULL; 355 unsigned char *image_update_buffer = NULL;
365 unsigned long rc; 356 unsigned long rc;
@@ -428,8 +419,7 @@ img_update_realloc(unsigned long size)
428 return rc; 419 return rc;
429} 420}
430 421
431static ssize_t 422static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count)
432read_packet_data(char *buffer, loff_t pos, size_t count)
433{ 423{
434 int retval; 424 int retval;
435 size_t bytes_left; 425 size_t bytes_left;
@@ -470,8 +460,7 @@ read_packet_data(char *buffer, loff_t pos, size_t count)
470 return retval; 460 return retval;
471} 461}
472 462
473static ssize_t 463static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
474read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
475{ 464{
476 unsigned char *ptemp = NULL; 465 unsigned char *ptemp = NULL;
477 size_t bytes_left = 0; 466 size_t bytes_left = 0;
@@ -509,8 +498,8 @@ read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
509 return ret_count; 498 return ret_count;
510} 499}
511 500
512static ssize_t 501static ssize_t read_rbu_data(struct kobject *kobj, char *buffer,
513read_rbu_data(struct kobject *kobj, char *buffer, loff_t pos, size_t count) 502 loff_t pos, size_t count)
514{ 503{
515 ssize_t ret_count = 0; 504 ssize_t ret_count = 0;
516 505
@@ -527,8 +516,7 @@ read_rbu_data(struct kobject *kobj, char *buffer, loff_t pos, size_t count)
527 return ret_count; 516 return ret_count;
528} 517}
529 518
530static void 519static void callbackfn_rbu(const struct firmware *fw, void *context)
531callbackfn_rbu(const struct firmware *fw, void *context)
532{ 520{
533 int rc = 0; 521 int rc = 0;
534 522
@@ -564,9 +552,8 @@ callbackfn_rbu(const struct firmware *fw, void *context)
564 rbu_data.entry_created = 1; 552 rbu_data.entry_created = 1;
565} 553}
566 554
567static ssize_t 555static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer,
568read_rbu_image_type(struct kobject *kobj, char *buffer, loff_t pos, 556 loff_t pos, size_t count)
569 size_t count)
570{ 557{
571 int size = 0; 558 int size = 0;
572 if (!pos) 559 if (!pos)
@@ -574,9 +561,8 @@ read_rbu_image_type(struct kobject *kobj, char *buffer, loff_t pos,
574 return size; 561 return size;
575} 562}
576 563
577static ssize_t 564static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer,
578write_rbu_image_type(struct kobject *kobj, char *buffer, loff_t pos, 565 loff_t pos, size_t count)
579 size_t count)
580{ 566{
581 int rc = count; 567 int rc = count;
582 int req_firm_rc = 0; 568 int req_firm_rc = 0;
@@ -636,18 +622,25 @@ write_rbu_image_type(struct kobject *kobj, char *buffer, loff_t pos,
636} 622}
637 623
638static struct bin_attribute rbu_data_attr = { 624static struct bin_attribute rbu_data_attr = {
639 .attr = {.name = "data",.owner = THIS_MODULE,.mode = 0444}, 625 .attr = {
626 .name = "data",
627 .owner = THIS_MODULE,
628 .mode = 0444,
629 },
640 .read = read_rbu_data, 630 .read = read_rbu_data,
641}; 631};
642 632
643static struct bin_attribute rbu_image_type_attr = { 633static struct bin_attribute rbu_image_type_attr = {
644 .attr = {.name = "image_type",.owner = THIS_MODULE,.mode = 0644}, 634 .attr = {
635 .name = "image_type",
636 .owner = THIS_MODULE,
637 .mode = 0644,
638 },
645 .read = read_rbu_image_type, 639 .read = read_rbu_image_type,
646 .write = write_rbu_image_type, 640 .write = write_rbu_image_type,
647}; 641};
648 642
649static int __init 643static int __init dcdrbu_init(void)
650dcdrbu_init(void)
651{ 644{
652 int rc = 0; 645 int rc = 0;
653 spin_lock_init(&rbu_data.lock); 646 spin_lock_init(&rbu_data.lock);
@@ -677,8 +670,7 @@ dcdrbu_init(void)
677 670
678} 671}
679 672
680static __exit void 673static __exit void dcdrbu_exit(void)
681dcdrbu_exit(void)
682{ 674{
683 spin_lock(&rbu_data.lock); 675 spin_lock(&rbu_data.lock);
684 packet_empty_list(); 676 packet_empty_list();