projects
/
profile
/
ivi
/
kernel-adaptation-intel-automotive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fuse: add list of writable files to fuse_inode
[profile/ivi/kernel-adaptation-intel-automotive.git]
/
drivers
/
acpi
/
power.c
diff --git
a/drivers/acpi/power.c
b/drivers/acpi/power.c
index
e768eb3
..
57b9a29
100644
(file)
--- a/
drivers/acpi/power.c
+++ b/
drivers/acpi/power.c
@@
-45,10
+45,9
@@
#include <acpi/acpi_drivers.h>
#define _COMPONENT ACPI_POWER_COMPONENT
#include <acpi/acpi_drivers.h>
#define _COMPONENT ACPI_POWER_COMPONENT
-ACPI_MODULE_NAME("
acpi_power")
+ACPI_MODULE_NAME("
power");
#define ACPI_POWER_COMPONENT 0x00800000
#define ACPI_POWER_CLASS "power_resource"
#define ACPI_POWER_COMPONENT 0x00800000
#define ACPI_POWER_CLASS "power_resource"
-#define ACPI_POWER_DRIVER_NAME "ACPI Power Resource Driver"
#define ACPI_POWER_DEVICE_NAME "Power Resource"
#define ACPI_POWER_FILE_INFO "info"
#define ACPI_POWER_FILE_STATUS "state"
#define ACPI_POWER_DEVICE_NAME "Power Resource"
#define ACPI_POWER_FILE_INFO "info"
#define ACPI_POWER_FILE_STATUS "state"
@@
-60,10
+59,16
@@
static int acpi_power_remove(struct acpi_device *device, int type);
static int acpi_power_resume(struct acpi_device *device);
static int acpi_power_open_fs(struct inode *inode, struct file *file);
static int acpi_power_resume(struct acpi_device *device);
static int acpi_power_open_fs(struct inode *inode, struct file *file);
+static struct acpi_device_id power_device_ids[] = {
+ {ACPI_POWER_HID, 0},
+ {"", 0},
+};
+MODULE_DEVICE_TABLE(acpi, power_device_ids);
+
static struct acpi_driver acpi_power_driver = {
static struct acpi_driver acpi_power_driver = {
- .name =
ACPI_POWER_DRIVER_NAME
,
+ .name =
"power"
,
.class = ACPI_POWER_CLASS,
.class = ACPI_POWER_CLASS,
- .ids =
ACPI_POWER_HID
,
+ .ids =
power_device_ids
,
.ops = {
.add = acpi_power_add,
.remove = acpi_power_remove,
.ops = {
.add = acpi_power_add,
.remove = acpi_power_remove,
@@
-437,8
+442,6
@@
int acpi_power_transition(struct acpi_device *device, int state)
cl = &device->power.states[device->power.state].resources;
tl = &device->power.states[state].resources;
cl = &device->power.states[device->power.state].resources;
tl = &device->power.states[state].resources;
- device->power.state = ACPI_STATE_UNKNOWN;
-
if (!cl->count && !tl->count) {
result = -ENODEV;
goto end;
if (!cl->count && !tl->count) {
result = -ENODEV;
goto end;
@@
-456,6
+459,10
@@
int acpi_power_transition(struct acpi_device *device, int state)
goto end;
}
goto end;
}
+ if (device->power.state == state) {
+ goto end;
+ }
+
/*
* Then we dereference all power resources used in the current list.
*/
/*
* Then we dereference all power resources used in the current list.
*/
@@
-465,12
+472,15
@@
int acpi_power_transition(struct acpi_device *device, int state)
goto end;
}
goto end;
}
- /* We shouldn't change the state till all above operations succeed */
- device->power.state = state;
- end:
- if (result)
+ end:
+ if (result) {
+ device->power.state = ACPI_STATE_UNKNOWN;
printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n",
device->pnp.bus_id, state);
printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n",
device->pnp.bus_id, state);
+ } else {
+ /* We shouldn't change the state till all above operations succeed */
+ device->power.state = state;
+ }
return result;
}
return result;
}
@@
-684,13
+694,6
@@
static int acpi_power_resume(struct acpi_device *device)
return result;
mutex_lock(&resource->resource_lock);
return result;
mutex_lock(&resource->resource_lock);
- if ((resource->state == ACPI_POWER_RESOURCE_STATE_ON) &&
- list_empty(&resource->reference)) {
- mutex_unlock(&resource->resource_lock);
- result = acpi_power_off_device(device->handle, NULL);
- return result;
- }
-
if ((resource->state == ACPI_POWER_RESOURCE_STATE_OFF) &&
!list_empty(&resource->reference)) {
ref = container_of(resource->reference.next, struct acpi_power_reference, node);
if ((resource->state == ACPI_POWER_RESOURCE_STATE_OFF) &&
!list_empty(&resource->reference)) {
ref = container_of(resource->reference.next, struct acpi_power_reference, node);