aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2010-06-30 23:01:12 -0400
committerLen Brown <len.brown@intel.com>2010-07-06 22:34:27 -0400
commit3bd741bd0dfcc1845ae6892baa5192c91addc84c (patch)
tree3effbfaefa7dfee2c7d7223772847236ea53f718
parent3784730b02b9f147a55b0e4623fcad671273e6e6 (diff)
ACPICA: Use low-level GPE enable during GPE block initialization
The GPE block initialization code in acpi_ev_initialize_gpe_block() uses acpi_set_gpe() to make sure that the GPEs with nonzero runtime counter will remain enabled, but since it already has a struct acpi_gpe_event_info object for each GPE, it might use the low-level GPE enabling function, acpi_clear_and_enable_gpe(), for this purpose. To make that happen, move acpi_clear_and_enable_gpe() to drivers/acpi/acpica/evgpe.c and rename it to acpi_ev_enable_gpe(), modify the two existing users of it accordingly and modify acpi_ev_initialize_gpe_block() to use it instead of acpi_set_gpe() and to check its return value. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Len Brown <len.brown@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/acpica/acevents.h2
-rw-r--r--drivers/acpi/acpica/evgpe.c40
-rw-r--r--drivers/acpi/acpica/evgpeblk.c7
-rw-r--r--drivers/acpi/acpica/evxfevnt.c42
4 files changed, 47 insertions, 44 deletions
diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h
index a561944fbaf9..e0e6affb0d80 100644
--- a/drivers/acpi/acpica/acevents.h
+++ b/drivers/acpi/acpica/acevents.h
@@ -80,6 +80,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list);
80acpi_status 80acpi_status
81acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info); 81acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info);
82 82
83acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
84
83struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, 85struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
84 u32 gpe_number); 86 u32 gpe_number);
85 87
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c
index 9413ac61e440..56de460570d6 100644
--- a/drivers/acpi/acpica/evgpe.c
+++ b/drivers/acpi/acpica/evgpe.c
@@ -94,6 +94,46 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info)
94 return_ACPI_STATUS(AE_OK); 94 return_ACPI_STATUS(AE_OK);
95} 95}
96 96
97/*******************************************************************************
98 *
99 * FUNCTION: acpi_ev_enable_gpe
100 *
101 * PARAMETERS: gpe_event_info - GPE to enable
102 *
103 * RETURN: Status
104 *
105 * DESCRIPTION: Clear the given GPE from stale events and enable it.
106 *
107 ******************************************************************************/
108acpi_status
109acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
110{
111 acpi_status status;
112
113 ACPI_FUNCTION_TRACE(ev_enable_gpe);
114
115 /*
116 * We will only allow a GPE to be enabled if it has either an
117 * associated method (_Lxx/_Exx) or a handler. Otherwise, the
118 * GPE will be immediately disabled by acpi_ev_gpe_dispatch the
119 * first time it fires.
120 */
121 if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)) {
122 return_ACPI_STATUS(AE_NO_HANDLER);
123 }
124
125 /* Clear the GPE (of stale events) */
126 status = acpi_hw_clear_gpe(gpe_event_info);
127 if (ACPI_FAILURE(status)) {
128 return_ACPI_STATUS(status);
129 }
130
131 /* Enable the requested GPE */
132 status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
133
134 return_ACPI_STATUS(status);
135}
136
97 137
98/******************************************************************************* 138/*******************************************************************************
99 * 139 *
diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c
index 77e8630043f8..0c6f3f878eb5 100644
--- a/drivers/acpi/acpica/evgpeblk.c
+++ b/drivers/acpi/acpica/evgpeblk.c
@@ -508,10 +508,8 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
508 * increment its reference counter. 508 * increment its reference counter.
509 */ 509 */
510 if (gpe_event_info->runtime_count) { 510 if (gpe_event_info->runtime_count) {
511 acpi_set_gpe(gpe_device, gpe_number, 511 status = acpi_ev_enable_gpe(gpe_event_info);
512 ACPI_GPE_ENABLE); 512 goto enabled;
513 gpe_enabled_count++;
514 continue;
515 } 513 }
516 514
517 if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) { 515 if (gpe_event_info->flags & ACPI_GPE_CAN_WAKE) {
@@ -530,6 +528,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
530 /* Enable this GPE */ 528 /* Enable this GPE */
531 529
532 status = acpi_enable_gpe(gpe_device, gpe_number); 530 status = acpi_enable_gpe(gpe_device, gpe_number);
531 enabled:
533 if (ACPI_FAILURE(status)) { 532 if (ACPI_FAILURE(status)) {
534 ACPI_EXCEPTION((AE_INFO, status, 533 ACPI_EXCEPTION((AE_INFO, status,
535 "Could not enable GPE 0x%02X", 534 "Could not enable GPE 0x%02X",
diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c
index 467fde961aef..b094cc0183d7 100644
--- a/drivers/acpi/acpica/evxfevnt.c
+++ b/drivers/acpi/acpica/evxfevnt.c
@@ -210,44 +210,6 @@ ACPI_EXPORT_SYMBOL(acpi_enable_event)
210 210
211/******************************************************************************* 211/*******************************************************************************
212 * 212 *
213 * FUNCTION: acpi_clear_and_enable_gpe
214 *
215 * PARAMETERS: gpe_event_info - GPE to enable
216 *
217 * RETURN: Status
218 *
219 * DESCRIPTION: Clear the given GPE from stale events and enable it.
220 *
221 ******************************************************************************/
222static acpi_status
223acpi_clear_and_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
224{
225 acpi_status status;
226
227 /*
228 * We will only allow a GPE to be enabled if it has either an
229 * associated method (_Lxx/_Exx) or a handler. Otherwise, the
230 * GPE will be immediately disabled by acpi_ev_gpe_dispatch the
231 * first time it fires.
232 */
233 if (!(gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK)) {
234 return_ACPI_STATUS(AE_NO_HANDLER);
235 }
236
237 /* Clear the GPE (of stale events) */
238 status = acpi_hw_clear_gpe(gpe_event_info);
239 if (ACPI_FAILURE(status)) {
240 return_ACPI_STATUS(status);
241 }
242
243 /* Enable the requested GPE */
244 status = acpi_hw_low_set_gpe(gpe_event_info, ACPI_GPE_ENABLE);
245
246 return_ACPI_STATUS(status);
247}
248
249/*******************************************************************************
250 *
251 * FUNCTION: acpi_set_gpe 213 * FUNCTION: acpi_set_gpe
252 * 214 *
253 * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1 215 * PARAMETERS: gpe_device - Parent GPE Device. NULL for GPE0/GPE1
@@ -287,7 +249,7 @@ acpi_status acpi_set_gpe(acpi_handle gpe_device, u32 gpe_number, u8 action)
287 249
288 switch (action) { 250 switch (action) {
289 case ACPI_GPE_ENABLE: 251 case ACPI_GPE_ENABLE:
290 status = acpi_clear_and_enable_gpe(gpe_event_info); 252 status = acpi_ev_enable_gpe(gpe_event_info);
291 break; 253 break;
292 254
293 case ACPI_GPE_DISABLE: 255 case ACPI_GPE_DISABLE:
@@ -414,7 +376,7 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)
414 if (gpe_event_info->runtime_count == 1) { 376 if (gpe_event_info->runtime_count == 1) {
415 status = acpi_ev_update_gpe_enable_mask(gpe_event_info); 377 status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
416 if (ACPI_SUCCESS(status)) { 378 if (ACPI_SUCCESS(status)) {
417 status = acpi_clear_and_enable_gpe(gpe_event_info); 379 status = acpi_ev_enable_gpe(gpe_event_info);
418 } 380 }
419 if (ACPI_FAILURE(status)) { 381 if (ACPI_FAILURE(status)) {
420 gpe_event_info->runtime_count--; 382 gpe_event_info->runtime_count--;