diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2008-06-09 19:22:26 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-06-11 19:13:47 -0400 |
commit | 46a21e465e506bcd4dba759a39e7ef79978a705d (patch) | |
tree | aaaaf8b80209ee910d1bb8afd2dee16171e0cea4 /drivers/acpi | |
parent | 7efd52a407bed6a2b02015b8ebbff7beba155392 (diff) |
ACPI: use memory_read_from_buffer()
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/system.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 769f24855eb6..5bd2dec9a7ac 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -77,7 +77,6 @@ static ssize_t acpi_table_show(struct kobject *kobj, | |||
77 | container_of(bin_attr, struct acpi_table_attr, attr); | 77 | container_of(bin_attr, struct acpi_table_attr, attr); |
78 | struct acpi_table_header *table_header = NULL; | 78 | struct acpi_table_header *table_header = NULL; |
79 | acpi_status status; | 79 | acpi_status status; |
80 | ssize_t ret_count = count; | ||
81 | 80 | ||
82 | status = | 81 | status = |
83 | acpi_get_table(table_attr->name, table_attr->instance, | 82 | acpi_get_table(table_attr->name, table_attr->instance, |
@@ -85,18 +84,8 @@ static ssize_t acpi_table_show(struct kobject *kobj, | |||
85 | if (ACPI_FAILURE(status)) | 84 | if (ACPI_FAILURE(status)) |
86 | return -ENODEV; | 85 | return -ENODEV; |
87 | 86 | ||
88 | if (offset >= table_header->length) { | 87 | return memory_read_from_buffer(buf, count, &offset, |
89 | ret_count = 0; | 88 | table_header, table_header->length); |
90 | goto end; | ||
91 | } | ||
92 | |||
93 | if (offset + ret_count > table_header->length) | ||
94 | ret_count = table_header->length - offset; | ||
95 | |||
96 | memcpy(buf, ((char *)table_header) + offset, ret_count); | ||
97 | |||
98 | end: | ||
99 | return ret_count; | ||
100 | } | 89 | } |
101 | 90 | ||
102 | static void acpi_table_attr_init(struct acpi_table_attr *table_attr, | 91 | static void acpi_table_attr_init(struct acpi_table_attr *table_attr, |