aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/evxfevnt.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-15 20:37:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-15 20:37:07 -0400
commit2245ba2a3a975656bb303dfaa115accaa4667083 (patch)
treecbeb348c43d58461d851907373c34a7b9a985e41 /drivers/acpi/acpica/evxfevnt.c
parente2e96c663639a3361bb1a84e666887d308c6c87e (diff)
parent95ee46aa8698f2000647dfb362400fadbb5807cf (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: gcc-4.6: ACPI: fix unused but set variables in ACPI ACPI thermal: make procfs I/F depend on CONFIG_ACPI_PROCFS ACPI video: make procfs I/F depend on CONFIG_ACPI_PROCFS ACPI processor: remove deprecated ACPI procfs I/F ACPI power_resource: remove unused procfs I/F ACPI: remove deprecated ACPI procfs I/F ACPI: introduce drivers/acpi/sysfs.c ACPI: introduce module parameter acpi.aml_debug_output ACPI: introduce drivers/acpi/debugfs.c ACPI, APEI, ERST debug support ACPI, APEI, Manage GHES as platform devices ACPI, APEI, Rename CPER and GHES severity constants ACPI, APEI, Fix a typo of error path of apei_resources_request ACPI / ACPICA: Fix reference counting problems with GPE handlers ACPI: Add the check of ADR flag in course of finding ACPI handle for PCI device ACPI / Sleep: Drop acpi_suspend_finish() ACPI / Sleep: Consolidate suspend and hibernation routines ACPI / Wakeup: Simplify enabling of wakeup devices ACPI / Sleep: Rework enabling wakeup devices ACPI / Sleep: Free NVS copy if suspending of devices fails Fixed up totally buggered "ACPI: fix unused but set variables in ACPI" patch that doesn't even compile in the merge. Thanks to Sedat Dilek <sedat.dilek@googlemail.com> for noticing the breakage before I even pulled. And a big "Grrr.." at Len for not even bothering to compile the tree before asking me to pull.
Diffstat (limited to 'drivers/acpi/acpica/evxfevnt.c')
-rw-r--r--drivers/acpi/acpica/evxfevnt.c62
1 files changed, 9 insertions, 53 deletions
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index 0ec900da5794..304825528d48 100644
--- a/drivers/acpi/acpica/evxfevnt.c
+++ b/drivers/acpi/acpica/evxfevnt.c
@@ -294,7 +294,7 @@ ACPI_EXPORT_SYMBOL(acpi_gpe_wakeup)
294 ******************************************************************************/ 294 ******************************************************************************/
295acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number) 295acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)
296{ 296{
297 acpi_status status = AE_OK; 297 acpi_status status = AE_BAD_PARAMETER;
298 struct acpi_gpe_event_info *gpe_event_info; 298 struct acpi_gpe_event_info *gpe_event_info;
299 acpi_cpu_flags flags; 299 acpi_cpu_flags flags;
300 300
@@ -305,28 +305,10 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)
305 /* Ensure that we have a valid GPE number */ 305 /* Ensure that we have a valid GPE number */
306 306
307 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); 307 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
308 if (!gpe_event_info) { 308 if (gpe_event_info) {
309 status = AE_BAD_PARAMETER; 309 status = acpi_raw_enable_gpe(gpe_event_info);
310 goto unlock_and_exit;
311 } 310 }
312 311
313 if (gpe_event_info->runtime_count == ACPI_UINT8_MAX) {
314 status = AE_LIMIT; /* Too many references */
315 goto unlock_and_exit;
316 }
317
318 gpe_event_info->runtime_count++;
319 if (gpe_event_info->runtime_count == 1) {
320 status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
321 if (ACPI_SUCCESS(status)) {
322 status = acpi_ev_enable_gpe(gpe_event_info);
323 }
324 if (ACPI_FAILURE(status)) {
325 gpe_event_info->runtime_count--;
326 }
327 }
328
329unlock_and_exit:
330 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 312 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
331 return_ACPI_STATUS(status); 313 return_ACPI_STATUS(status);
332} 314}
@@ -348,7 +330,7 @@ ACPI_EXPORT_SYMBOL(acpi_enable_gpe)
348 ******************************************************************************/ 330 ******************************************************************************/
349acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number) 331acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
350{ 332{
351 acpi_status status = AE_OK; 333 acpi_status status = AE_BAD_PARAMETER;
352 struct acpi_gpe_event_info *gpe_event_info; 334 struct acpi_gpe_event_info *gpe_event_info;
353 acpi_cpu_flags flags; 335 acpi_cpu_flags flags;
354 336
@@ -359,32 +341,10 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
359 /* Ensure that we have a valid GPE number */ 341 /* Ensure that we have a valid GPE number */
360 342
361 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number); 343 gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
362 if (!gpe_event_info) { 344 if (gpe_event_info) {
363 status = AE_BAD_PARAMETER; 345 status = acpi_raw_disable_gpe(gpe_event_info) ;
364 goto unlock_and_exit;
365 }
366
367 /* Hardware-disable a runtime GPE on removal of the last reference */
368
369 if (!gpe_event_info->runtime_count) {
370 status = AE_LIMIT; /* There are no references to remove */
371 goto unlock_and_exit;
372 } 346 }
373 347
374 gpe_event_info->runtime_count--;
375 if (!gpe_event_info->runtime_count) {
376 status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
377 if (ACPI_SUCCESS(status)) {
378 status =
379 acpi_hw_low_set_gpe(gpe_event_info,
380 ACPI_GPE_DISABLE);
381 }
382 if (ACPI_FAILURE(status)) {
383 gpe_event_info->runtime_count++;
384 }
385 }
386
387unlock_and_exit:
388 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 348 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
389 return_ACPI_STATUS(status); 349 return_ACPI_STATUS(status);
390} 350}
@@ -411,7 +371,6 @@ acpi_status acpi_gpe_can_wake(acpi_handle gpe_device, u32 gpe_number)
411 acpi_status status = AE_OK; 371 acpi_status status = AE_OK;
412 struct acpi_gpe_event_info *gpe_event_info; 372 struct acpi_gpe_event_info *gpe_event_info;
413 acpi_cpu_flags flags; 373 acpi_cpu_flags flags;
414 u8 disable = 0;
415 374
416 ACPI_FUNCTION_TRACE(acpi_gpe_can_wake); 375 ACPI_FUNCTION_TRACE(acpi_gpe_can_wake);
417 376
@@ -430,15 +389,12 @@ acpi_status acpi_gpe_can_wake(acpi_handle gpe_device, u32 gpe_number)
430 } 389 }
431 390
432 gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; 391 gpe_event_info->flags |= ACPI_GPE_CAN_WAKE;
433 disable = (gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD) 392 if (gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD) {
434 && gpe_event_info->runtime_count; 393 (void)acpi_raw_disable_gpe(gpe_event_info);
394 }
435 395
436unlock_and_exit: 396unlock_and_exit:
437 acpi_os_release_lock(acpi_gbl_gpe_lock, flags); 397 acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
438
439 if (disable)
440 status = acpi_disable_gpe(gpe_device, gpe_number);
441
442 return_ACPI_STATUS(status); 398 return_ACPI_STATUS(status);
443} 399}
444ACPI_EXPORT_SYMBOL(acpi_gpe_can_wake) 400ACPI_EXPORT_SYMBOL(acpi_gpe_can_wake)