diff options
author | Len Brown <len.brown@intel.com> | 2008-11-11 21:13:55 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-11-11 21:13:55 -0500 |
commit | 50f19e37c38e82c4fd2aa50fedbfa3aac7903e5a (patch) | |
tree | e74830afdd360457b69a05e85cce7144dfa62059 /drivers/acpi | |
parent | 597e4fabb0b0c7fdfa7c2d551fd0a797aab7e53b (diff) | |
parent | 4feba70a2c1a1a0c96909f657f48b2e11e682370 (diff) |
Merge branch 'bugzilla-11539' into release
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/system.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 6d348dce0810..bfc216a11fdd 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -78,9 +78,15 @@ static ssize_t acpi_table_show(struct kobject *kobj, | |||
78 | container_of(bin_attr, struct acpi_table_attr, attr); | 78 | container_of(bin_attr, struct acpi_table_attr, attr); |
79 | struct acpi_table_header *table_header = NULL; | 79 | struct acpi_table_header *table_header = NULL; |
80 | acpi_status status; | 80 | acpi_status status; |
81 | char name[ACPI_NAME_SIZE]; | ||
82 | |||
83 | if (strncmp(table_attr->name, "NULL", 4)) | ||
84 | memcpy(name, table_attr->name, ACPI_NAME_SIZE); | ||
85 | else | ||
86 | memcpy(name, "\0\0\0\0", 4); | ||
81 | 87 | ||
82 | status = | 88 | status = |
83 | acpi_get_table(table_attr->name, table_attr->instance, | 89 | acpi_get_table(name, table_attr->instance, |
84 | &table_header); | 90 | &table_header); |
85 | if (ACPI_FAILURE(status)) | 91 | if (ACPI_FAILURE(status)) |
86 | return -ENODEV; | 92 | return -ENODEV; |
@@ -95,21 +101,24 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr, | |||
95 | struct acpi_table_header *header = NULL; | 101 | struct acpi_table_header *header = NULL; |
96 | struct acpi_table_attr *attr = NULL; | 102 | struct acpi_table_attr *attr = NULL; |
97 | 103 | ||
98 | memcpy(table_attr->name, table_header->signature, ACPI_NAME_SIZE); | 104 | if (table_header->signature[0] != '\0') |
105 | memcpy(table_attr->name, table_header->signature, | ||
106 | ACPI_NAME_SIZE); | ||
107 | else | ||
108 | memcpy(table_attr->name, "NULL", 4); | ||
99 | 109 | ||
100 | list_for_each_entry(attr, &acpi_table_attr_list, node) { | 110 | list_for_each_entry(attr, &acpi_table_attr_list, node) { |
101 | if (!memcmp(table_header->signature, attr->name, | 111 | if (!memcmp(table_attr->name, attr->name, ACPI_NAME_SIZE)) |
102 | ACPI_NAME_SIZE)) | ||
103 | if (table_attr->instance < attr->instance) | 112 | if (table_attr->instance < attr->instance) |
104 | table_attr->instance = attr->instance; | 113 | table_attr->instance = attr->instance; |
105 | } | 114 | } |
106 | table_attr->instance++; | 115 | table_attr->instance++; |
107 | 116 | ||
108 | if (table_attr->instance > 1 || (table_attr->instance == 1 && | 117 | if (table_attr->instance > 1 || (table_attr->instance == 1 && |
109 | !acpi_get_table(table_header-> | 118 | !acpi_get_table |
110 | signature, 2, | 119 | (table_header->signature, 2, &header))) |
111 | &header))) | 120 | sprintf(table_attr->name + ACPI_NAME_SIZE, "%d", |
112 | sprintf(table_attr->name + 4, "%d", table_attr->instance); | 121 | table_attr->instance); |
113 | 122 | ||
114 | table_attr->attr.size = 0; | 123 | table_attr->attr.size = 0; |
115 | table_attr->attr.read = acpi_table_show; | 124 | table_attr->attr.read = acpi_table_show; |