Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de3afce5 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

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
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -170,6 +170,9 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
	acpi_status status;
	acpi_status status;
	int ret;
	int ret;


	if (pr->apic_id == -1)
		return -ENODEV;

	status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta);
	status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta);
	if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
	if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
		return -ENODEV;
		return -ENODEV;
@@ -260,10 +263,8 @@ static int acpi_processor_get_info(struct acpi_device *device)
	}
	}


	apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id);
	apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id);
	if (apic_id < 0) {
	if (apic_id < 0)
		acpi_handle_debug(pr->handle, "failed to get CPU APIC ID.\n");
		acpi_handle_debug(pr->handle, "failed to get CPU APIC ID.\n");
		return -ENODEV;
	}
	pr->apic_id = apic_id;
	pr->apic_id = apic_id;


	cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
	cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
+12 −9
Original line number Original line Diff line number Diff line
@@ -206,13 +206,13 @@ static void advance_transaction(struct acpi_ec *ec, u8 status)
	spin_unlock_irqrestore(&ec->lock, flags);
	spin_unlock_irqrestore(&ec->lock, flags);
}
}


static int acpi_ec_sync_query(struct acpi_ec *ec);
static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data);


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


EXPORT_SYMBOL(ec_get_handle);
EXPORT_SYMBOL(ec_get_handle);


static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 *data);

/*
/*
 * Clears stale _Q events that might have accumulated in the EC.
 * Process _Q events that might have accumulated in the EC.
 * Run with locked ec mutex.
 * Run with locked ec mutex.
 */
 */
static void acpi_ec_clear(struct acpi_ec *ec)
static void acpi_ec_clear(struct acpi_ec *ec)
@@ -455,7 +453,7 @@ static void acpi_ec_clear(struct acpi_ec *ec)
	u8 value = 0;
	u8 value = 0;


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


static int acpi_ec_sync_query(struct acpi_ec *ec)
static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data)
{
{
	u8 value = 0;
	u8 value = 0;
	int status;
	int status;
	struct acpi_ec_query_handler *handler, *copy;
	struct acpi_ec_query_handler *handler, *copy;
	if ((status = acpi_ec_query_unlocked(ec, &value)))

	status = acpi_ec_query_unlocked(ec, &value);
	if (data)
		*data = value;
	if (status)
		return status;
		return status;

	list_for_each_entry(handler, &ec->list, node) {
	list_for_each_entry(handler, &ec->list, node) {
		if (value == handler->query_bit) {
		if (value == handler->query_bit) {
			/* have custom handler for this bit */
			/* have custom handler for this bit */
@@ -612,7 +615,7 @@ static void acpi_ec_gpe_query(void *ec_cxt)
	if (!ec)
	if (!ec)
		return;
		return;
	mutex_lock(&ec->mutex);
	mutex_lock(&ec->mutex);
	acpi_ec_sync_query(ec);
	acpi_ec_sync_query(ec, NULL);
	mutex_unlock(&ec->mutex);
	mutex_unlock(&ec->mutex);
}
}