diff options
Diffstat (limited to 'drivers/acpi/system.c')
-rw-r--r-- | drivers/acpi/system.c | 63 |
1 files changed, 2 insertions, 61 deletions
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index 6e4107f82403..391d0358a592 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -192,65 +192,6 @@ static struct attribute_group interrupt_stats_attr_group = { | |||
192 | }; | 192 | }; |
193 | static struct kobj_attribute *counter_attrs; | 193 | static struct kobj_attribute *counter_attrs; |
194 | 194 | ||
195 | static int count_num_gpes(void) | ||
196 | { | ||
197 | int count = 0; | ||
198 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | ||
199 | struct acpi_gpe_block_info *gpe_block; | ||
200 | acpi_cpu_flags flags; | ||
201 | |||
202 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | ||
203 | |||
204 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; | ||
205 | while (gpe_xrupt_info) { | ||
206 | gpe_block = gpe_xrupt_info->gpe_block_list_head; | ||
207 | while (gpe_block) { | ||
208 | count += gpe_block->register_count * | ||
209 | ACPI_GPE_REGISTER_WIDTH; | ||
210 | gpe_block = gpe_block->next; | ||
211 | } | ||
212 | gpe_xrupt_info = gpe_xrupt_info->next; | ||
213 | } | ||
214 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
215 | |||
216 | return count; | ||
217 | } | ||
218 | |||
219 | static int get_gpe_device(int index, acpi_handle *handle) | ||
220 | { | ||
221 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | ||
222 | struct acpi_gpe_block_info *gpe_block; | ||
223 | acpi_cpu_flags flags; | ||
224 | struct acpi_namespace_node *node; | ||
225 | |||
226 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | ||
227 | |||
228 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; | ||
229 | while (gpe_xrupt_info) { | ||
230 | gpe_block = gpe_xrupt_info->gpe_block_list_head; | ||
231 | node = gpe_block->node; | ||
232 | while (gpe_block) { | ||
233 | index -= gpe_block->register_count * | ||
234 | ACPI_GPE_REGISTER_WIDTH; | ||
235 | if (index < 0) { | ||
236 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
237 | /* return NULL if it's FADT GPE */ | ||
238 | if (node->type != ACPI_TYPE_DEVICE) | ||
239 | *handle = NULL; | ||
240 | else | ||
241 | *handle = node; | ||
242 | return 0; | ||
243 | } | ||
244 | node = gpe_block->node; | ||
245 | gpe_block = gpe_block->next; | ||
246 | } | ||
247 | gpe_xrupt_info = gpe_xrupt_info->next; | ||
248 | } | ||
249 | acpi_os_release_lock(acpi_gbl_gpe_lock, flags); | ||
250 | |||
251 | return -ENODEV; | ||
252 | } | ||
253 | |||
254 | static void delete_gpe_attr_array(void) | 195 | static void delete_gpe_attr_array(void) |
255 | { | 196 | { |
256 | struct event_counter *tmp = all_counters; | 197 | struct event_counter *tmp = all_counters; |
@@ -309,7 +250,7 @@ static int get_status(u32 index, acpi_event_status *status, acpi_handle *handle) | |||
309 | goto end; | 250 | goto end; |
310 | 251 | ||
311 | if (index < num_gpes) { | 252 | if (index < num_gpes) { |
312 | result = get_gpe_device(index, handle); | 253 | result = acpi_get_gpe_device(index, handle); |
313 | if (result) { | 254 | if (result) { |
314 | ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, | 255 | ACPI_EXCEPTION((AE_INFO, AE_NOT_FOUND, |
315 | "Invalid GPE 0x%x\n", index)); | 256 | "Invalid GPE 0x%x\n", index)); |
@@ -436,7 +377,7 @@ void acpi_irq_stats_init(void) | |||
436 | if (all_counters) | 377 | if (all_counters) |
437 | return; | 378 | return; |
438 | 379 | ||
439 | num_gpes = count_num_gpes(); | 380 | num_gpes = acpi_current_gpe_count; |
440 | num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA; | 381 | num_counters = num_gpes + ACPI_NUM_FIXED_EVENTS + NUM_COUNTERS_EXTRA; |
441 | 382 | ||
442 | all_attrs = kzalloc(sizeof(struct attribute *) * (num_counters + 1), | 383 | all_attrs = kzalloc(sizeof(struct attribute *) * (num_counters + 1), |