]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/power.c
Merge git://git.infradead.org/mtd-2.6
[linux-2.6-omap-h63xx.git] / drivers / acpi / power.c
index e7bab75075a90dce99ad98e085f264f96d56cc68..a1718e56103b33b5da9909b23727c4474611f90f 100644 (file)
@@ -54,6 +54,14 @@ ACPI_MODULE_NAME("power");
 #define ACPI_POWER_RESOURCE_STATE_OFF  0x00
 #define ACPI_POWER_RESOURCE_STATE_ON   0x01
 #define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF
+
+#ifdef MODULE_PARAM_PREFIX
+#undef MODULE_PARAM_PREFIX
+#endif
+#define MODULE_PARAM_PREFIX "acpi."
+int acpi_power_nocheck;
+module_param_named(power_nocheck, acpi_power_nocheck, bool, 000);
+
 static int acpi_power_add(struct acpi_device *device);
 static int acpi_power_remove(struct acpi_device *device, int type);
 static int acpi_power_resume(struct acpi_device *device);
@@ -131,7 +139,7 @@ acpi_power_get_context(acpi_handle handle,
 static int acpi_power_get_state(acpi_handle handle, int *state)
 {
        acpi_status status = AE_OK;
-       unsigned long sta = 0;
+       unsigned long long sta = 0;
 
 
        if (!handle || !state)
@@ -228,12 +236,18 @@ static int acpi_power_on(acpi_handle handle, struct acpi_device *dev)
        if (ACPI_FAILURE(status))
                return -ENODEV;
 
-       result = acpi_power_get_state(resource->device->handle, &state);
-       if (result)
-               return result;
-       if (state != ACPI_POWER_RESOURCE_STATE_ON)
-               return -ENOEXEC;
-
+       if (!acpi_power_nocheck) {
+               /*
+                * If acpi_power_nocheck is set, it is unnecessary to check
+                * the power state after power transition.
+                */
+               result = acpi_power_get_state(resource->device->handle,
+                               &state);
+               if (result)
+                       return result;
+               if (state != ACPI_POWER_RESOURCE_STATE_ON)
+                       return -ENOEXEC;
+       }
        /* Update the power resource's _device_ power state */
        resource->device->power.state = ACPI_STATE_D0;
 
@@ -279,11 +293,17 @@ static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev)
        if (ACPI_FAILURE(status))
                return -ENODEV;
 
-       result = acpi_power_get_state(handle, &state);
-       if (result)
-               return result;
-       if (state != ACPI_POWER_RESOURCE_STATE_OFF)
-               return -ENOEXEC;
+       if (!acpi_power_nocheck) {
+               /*
+                * If acpi_power_nocheck is set, it is unnecessary to check
+                * the power state after power transition.
+                */
+               result = acpi_power_get_state(handle, &state);
+               if (result)
+                       return result;
+               if (state != ACPI_POWER_RESOURCE_STATE_OFF)
+                       return -ENOEXEC;
+       }
 
        /* Update the power resource's _device_ power state */
        resource->device->power.state = ACPI_STATE_D3;
@@ -659,7 +679,7 @@ static int acpi_power_add(struct acpi_device *device)
        strcpy(resource->name, device->pnp.bus_id);
        strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
        strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
-       acpi_driver_data(device) = resource;
+       device->driver_data = resource;
 
        /* Evalute the object to get the system level and resource order. */
        status = acpi_evaluate_object(device->handle, NULL, NULL, &buffer);
@@ -735,7 +755,7 @@ static int acpi_power_resume(struct acpi_device *device)
        if (!device || !acpi_driver_data(device))
                return -EINVAL;
 
-       resource = (struct acpi_power_resource *)acpi_driver_data(device);
+       resource = acpi_driver_data(device);
 
        result = acpi_power_get_state(device->handle, &state);
        if (result)