Skip to content

Commit de3afce

Browse files
committed
Merge branches 'acpi-ec' and 'acpi-processor'
* acpi-ec: ACPI / EC: Process rather than discard events in acpi_ec_clear * acpi-processor: ACPI / processor: Fix failure of loading acpi-cpufreq driver
3 parents 25d6db9 + 3eba563 + 4985c32 commit de3afce

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

drivers/acpi/acpi_processor.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
170170
acpi_status status;
171171
int ret;
172172

173+
if (pr->apic_id == -1)
174+
return -ENODEV;
175+
173176
status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta);
174177
if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
175178
return -ENODEV;
@@ -260,10 +263,8 @@ static int acpi_processor_get_info(struct acpi_device *device)
260263
}
261264

262265
apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id);
263-
if (apic_id < 0) {
266+
if (apic_id < 0)
264267
acpi_handle_debug(pr->handle, "failed to get CPU APIC ID.\n");
265-
return -ENODEV;
266-
}
267268
pr->apic_id = apic_id;
268269

269270
cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);

drivers/acpi/ec.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,13 @@ static void advance_transaction(struct acpi_ec *ec, u8 status)
206206
spin_unlock_irqrestore(&ec->lock, flags);
207207
}
208208

209-
static int acpi_ec_sync_query(struct acpi_ec *ec);
209+
static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data);
210210

211211
static int ec_check_sci_sync(struct acpi_ec *ec, u8 state)
212212
{
213213
if (state & ACPI_EC_FLAG_SCI) {
214214
if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags))
215-
return acpi_ec_sync_query(ec);
215+
return acpi_ec_sync_query(ec, NULL);
216216
}
217217
return 0;
218218
}
@@ -443,10 +443,8 @@ acpi_handle ec_get_handle(void)
443443

444444
EXPORT_SYMBOL(ec_get_handle);
445445

446-
static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 *data);
447-
448446
/*
449-
* Clears stale _Q events that might have accumulated in the EC.
447+
* Process _Q events that might have accumulated in the EC.
450448
* Run with locked ec mutex.
451449
*/
452450
static void acpi_ec_clear(struct acpi_ec *ec)
@@ -455,7 +453,7 @@ static void acpi_ec_clear(struct acpi_ec *ec)
455453
u8 value = 0;
456454

457455
for (i = 0; i < ACPI_EC_CLEAR_MAX; i++) {
458-
status = acpi_ec_query_unlocked(ec, &value);
456+
status = acpi_ec_sync_query(ec, &value);
459457
if (status || !value)
460458
break;
461459
}
@@ -582,13 +580,18 @@ static void acpi_ec_run(void *cxt)
582580
kfree(handler);
583581
}
584582

585-
static int acpi_ec_sync_query(struct acpi_ec *ec)
583+
static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data)
586584
{
587585
u8 value = 0;
588586
int status;
589587
struct acpi_ec_query_handler *handler, *copy;
590-
if ((status = acpi_ec_query_unlocked(ec, &value)))
588+
589+
status = acpi_ec_query_unlocked(ec, &value);
590+
if (data)
591+
*data = value;
592+
if (status)
591593
return status;
594+
592595
list_for_each_entry(handler, &ec->list, node) {
593596
if (value == handler->query_bit) {
594597
/* have custom handler for this bit */
@@ -612,7 +615,7 @@ static void acpi_ec_gpe_query(void *ec_cxt)
612615
if (!ec)
613616
return;
614617
mutex_lock(&ec->mutex);
615-
acpi_ec_sync_query(ec);
618+
acpi_ec_sync_query(ec, NULL);
616619
mutex_unlock(&ec->mutex);
617620
}
618621

0 commit comments

Comments
 (0)