diff options
-rw-r--r-- | drivers/firmware/dell_rbu.c | 68 |
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; | |||
85 | static int context; | 85 | static int context; |
86 | static dma_addr_t dell_rbu_dmaaddr; | 86 | static dma_addr_t dell_rbu_dmaaddr; |
87 | 87 | ||
88 | static void | 88 | static void init_packet_head(void) |
89 | init_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 | ||
98 | static int | 97 | static int fill_last_packet(void *data, size_t length) |
99 | fill_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 | ||
141 | static int | 139 | static int create_packet(size_t length) |
142 | create_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 | ||
201 | static int | 198 | static int packetize_data(void *data, size_t length) |
202 | packetize_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 | ||
216 | static int | 212 | static int do_packet_read(char *data, struct list_head *ptemp_list, |
217 | do_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 | ||
251 | static int | 246 | static int packet_read_list(char *data, size_t *pread_length) |
252 | packet_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 | ||
290 | static void | 284 | static void packet_empty_list(void) |
291 | packet_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 | */ |
323 | static void | 316 | static void img_update_free(void) |
324 | img_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 | */ |
361 | static int | 353 | static int img_update_realloc(unsigned long size) |
362 | img_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 | ||
431 | static ssize_t | 422 | static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count) |
432 | read_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 | ||
473 | static ssize_t | 463 | static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count) |
474 | read_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 | ||
512 | static ssize_t | 501 | static ssize_t read_rbu_data(struct kobject *kobj, char *buffer, |
513 | read_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 | ||
530 | static void | 519 | static void callbackfn_rbu(const struct firmware *fw, void *context) |
531 | callbackfn_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 | ||
567 | static ssize_t | 555 | static ssize_t read_rbu_image_type(struct kobject *kobj, char *buffer, |
568 | read_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 | ||
577 | static ssize_t | 564 | static ssize_t write_rbu_image_type(struct kobject *kobj, char *buffer, |
578 | write_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 | ||
638 | static struct bin_attribute rbu_data_attr = { | 624 | static 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 | ||
643 | static struct bin_attribute rbu_image_type_attr = { | 633 | static 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 | ||
649 | static int __init | 643 | static int __init dcdrbu_init(void) |
650 | dcdrbu_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 | ||
680 | static __exit void | 673 | static __exit void dcdrbu_exit(void) |
681 | dcdrbu_exit(void) | ||
682 | { | 674 | { |
683 | spin_lock(&rbu_data.lock); | 675 | spin_lock(&rbu_data.lock); |
684 | packet_empty_list(); | 676 | packet_empty_list(); |