diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2008-07-25 04:48:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:44 -0400 |
commit | 25377479de7539fdc871a0f0ecaa39da42353bbc (patch) | |
tree | 646e6e55935b26fcb3f5d489b9f08ab021c9ddb3 /drivers | |
parent | d991696263a704be7f41ac186f1a0ed17963c260 (diff) |
dell_rbu: use memory_read_from_buffer()
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Abhay Salunke <Abhay_Salunke@dell.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Matt Domsch <Matt_Domsch@dell.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/firmware/dell_rbu.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c index 7430e218cda6..13946ebd77d6 100644 --- a/drivers/firmware/dell_rbu.c +++ b/drivers/firmware/dell_rbu.c | |||
@@ -507,11 +507,6 @@ static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count) | |||
507 | 507 | ||
508 | static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count) | 508 | static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count) |
509 | { | 509 | { |
510 | unsigned char *ptemp = NULL; | ||
511 | size_t bytes_left = 0; | ||
512 | size_t data_length = 0; | ||
513 | ssize_t ret_count = 0; | ||
514 | |||
515 | /* check to see if we have something to return */ | 510 | /* check to see if we have something to return */ |
516 | if ((rbu_data.image_update_buffer == NULL) || | 511 | if ((rbu_data.image_update_buffer == NULL) || |
517 | (rbu_data.bios_image_size == 0)) { | 512 | (rbu_data.bios_image_size == 0)) { |
@@ -519,28 +514,11 @@ static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count) | |||
519 | "bios_image_size %lu\n", | 514 | "bios_image_size %lu\n", |
520 | rbu_data.image_update_buffer, | 515 | rbu_data.image_update_buffer, |
521 | rbu_data.bios_image_size); | 516 | rbu_data.bios_image_size); |
522 | ret_count = -ENOMEM; | 517 | return -ENOMEM; |
523 | goto read_rbu_data_exit; | ||
524 | } | ||
525 | |||
526 | if (pos > rbu_data.bios_image_size) { | ||
527 | ret_count = 0; | ||
528 | goto read_rbu_data_exit; | ||
529 | } | 518 | } |
530 | 519 | ||
531 | bytes_left = rbu_data.bios_image_size - pos; | 520 | return memory_read_from_buffer(buffer, count, &pos, |
532 | data_length = min(bytes_left, count); | 521 | rbu_data.image_update_buffer, rbu_data.bios_image_size); |
533 | |||
534 | ptemp = rbu_data.image_update_buffer; | ||
535 | memcpy(buffer, (ptemp + pos), data_length); | ||
536 | |||
537 | if ((pos + count) > rbu_data.bios_image_size) | ||
538 | /* this was the last copy */ | ||
539 | ret_count = bytes_left; | ||
540 | else | ||
541 | ret_count = count; | ||
542 | read_rbu_data_exit: | ||
543 | return ret_count; | ||
544 | } | 522 | } |
545 | 523 | ||
546 | static ssize_t read_rbu_data(struct kobject *kobj, | 524 | static ssize_t read_rbu_data(struct kobject *kobj, |