diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 16c4ede..b0161fa 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -92,13 +92,13 @@ static struct acpi_driver acpi_ec_driver /* If we find an EC via the ECDT, we need to keep a ptr to its context */ static struct acpi_ec { + struct mutex lock; acpi_handle handle; unsigned long uid; unsigned long gpe; unsigned long command_addr; unsigned long data_addr; unsigned long global_lock; - struct mutex lock; atomic_t query_pending; wait_queue_head_t wait; } *ec_ecdt; @@ -618,14 +618,12 @@ static int acpi_ec_add(struct acpi_devic ec->handle = device->handle; ec->uid = -1; - mutex_init(&ec->lock); atomic_set(&ec->query_pending, 0); if (acpi_ec_mode == EC_INTR) { init_waitqueue_head(&ec->wait); } strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); strcpy(acpi_device_class(device), ACPI_EC_CLASS); - acpi_driver_data(device) = ec; /* Use the global lock for all EC transactions? */ acpi_evaluate_integer(ec->handle, "_GLK", NULL, &ec->global_lock); @@ -661,6 +659,9 @@ static int acpi_ec_add(struct acpi_devic acpi_device_name(device), acpi_device_bid(device), (u32) ec->gpe)); + mutex_init(&ec->lock); + acpi_driver_data(device) = ec; + if (!first_ec) first_ec = device;