aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-04-03 14:33:42 -0700
committerDavid S. Miller <davem@davemloft.net>2008-04-03 14:33:42 -0700
commit3bb5da3837cc1aa17736b05139c9a22c3794851a (patch)
treec92d5684a866542b1cb20641607ac1643ce03a47 /drivers/acpi
parent7feb49c82a74bc7c091b8ab2a3f96baa33d08ece (diff)
parent9597362d354f8655ece324b01d0c640a0e99c077 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/asus_acpi.c2
-rw-r--r--drivers/acpi/battery.c11
-rw-r--r--drivers/acpi/dock.c1
-rw-r--r--drivers/acpi/ec.c11
-rw-r--r--drivers/acpi/pci_irq.c4
-rw-r--r--drivers/acpi/processor_idle.c19
-rw-r--r--drivers/acpi/sbshc.c1
-rw-r--r--drivers/acpi/scan.c18
-rw-r--r--drivers/acpi/sleep/main.c71
-rw-r--r--drivers/acpi/video.c60
10 files changed, 50 insertions, 148 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index d25ef961415..44ad90c03c2 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -610,7 +610,7 @@ write_led(const char __user * buffer, unsigned long count,
(led_out) ? (hotk->status | ledmask) : (hotk->status & ~ledmask);
if (invert) /* invert target value */
- led_out = !led_out & 0x1;
+ led_out = !led_out;
if (!write_acpi_int(hotk->handle, ledname, led_out, NULL))
printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n",
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index f6215e80980..d5729d5dc19 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -293,13 +293,12 @@ static int extract_package(struct acpi_battery *battery,
strncpy(ptr, (u8 *)&element->integer.value,
sizeof(acpi_integer));
ptr[sizeof(acpi_integer)] = 0;
- } else return -EFAULT;
+ } else
+ *ptr = 0; /* don't have value */
} else {
- if (element->type == ACPI_TYPE_INTEGER) {
- int *x = (int *)((u8 *)battery +
- offsets[i].offset);
- *x = element->integer.value;
- } else return -EFAULT;
+ int *x = (int *)((u8 *)battery + offsets[i].offset);
+ *x = (element->type == ACPI_TYPE_INTEGER) ?
+ element->integer.value : -1;
}
}
return 0;
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 307cef65c24..fa44fb96fc3 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -710,6 +710,7 @@ static ssize_t write_undock(struct device *dev, struct device_attribute *attr,
if (!count)
return -EINVAL;
+ begin_undock(dock_station);
ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST);
return ret ? ret: count;
}
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index e7e197e3a4f..7222a18a031 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -129,7 +129,6 @@ static struct acpi_ec {
struct mutex lock;
wait_queue_head_t wait;
struct list_head list;
- atomic_t irq_count;
u8 handlers_installed;
} *boot_ec, *first_ec;
@@ -182,8 +181,6 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
{
int ret = 0;
- atomic_set(&ec->irq_count, 0);
-
if (unlikely(event == ACPI_EC_EVENT_OBF_1 &&
test_bit(EC_FLAGS_NO_OBF1_GPE, &ec->flags)))
force_poll = 1;
@@ -230,7 +227,6 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
while (time_before(jiffies, delay)) {
if (acpi_ec_check_status(ec, event))
goto end;
- msleep(5);
}
}
pr_err(PREFIX "acpi_ec_wait timeout,"
@@ -533,13 +529,6 @@ static u32 acpi_ec_gpe_handler(void *data)
struct acpi_ec *ec = data;
pr_debug(PREFIX "~~~> interrupt\n");
- atomic_inc(&ec->irq_count);
- if (atomic_read(&ec->irq_count) > 5) {
- pr_err(PREFIX "GPE storm detected, disabling EC GPE\n");
- acpi_disable_gpe(NULL, ec->gpe, ACPI_ISR);
- clear_bit(EC_FLAGS_GPE_MODE, &ec->flags);
- return ACPI_INTERRUPT_HANDLED;
- }
clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))
wake_up(&ec->wait);
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c
index 7af414a3c63..89022a74fae 100644
--- a/drivers/acpi/pci_irq.c
+++ b/drivers/acpi/pci_irq.c
@@ -131,8 +131,8 @@ struct prt_quirk {
*/
static struct prt_quirk prt_quirks[] = {
{ medion_md9580, 0, 0, 9, 'A',
- "\\_SB_.PCI0.ISA.LNKA",
- "\\_SB_.PCI0.ISA.LNKB"},
+ "\\_SB_.PCI0.ISA_.LNKA",
+ "\\_SB_.PCI0.ISA_.LNKB"},
{ dell_optiplex, 0, 0, 0xd, 'A',
"\\_SB_.LNKB",
"\\_SB_.LNKA"},
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 6f3b217699e..788da9781f8 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -216,8 +216,10 @@ static void acpi_safe_halt(void)
* test NEED_RESCHED:
*/
smp_mb();
- if (!need_resched())
+ if (!need_resched()) {
safe_halt();
+ local_irq_disable();
+ }
current_thread_info()->status |= TS_POLLING;
}
@@ -421,7 +423,9 @@ static void acpi_processor_idle(void)
else
acpi_safe_halt();
- local_irq_enable();
+ if (irqs_disabled())
+ local_irq_enable();
+
return;
}
@@ -530,7 +534,9 @@ static void acpi_processor_idle(void)
* skew otherwise.
*/
sleep_ticks = 0xFFFFFFFF;
- local_irq_enable();
+ if (irqs_disabled())
+ local_irq_enable();
+
break;
case ACPI_STATE_C2:
@@ -1481,7 +1487,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
return 0;
}
- acpi_unlazy_tlb(smp_processor_id());
/*
* Must be done before busmaster disable as we might need to
* access HPET !
@@ -1571,6 +1576,8 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
return 0;
}
+ acpi_unlazy_tlb(smp_processor_id());
+
/* Tell the scheduler that we are going deep-idle: */
sched_clock_idle_sleep_event();
/*
@@ -1686,7 +1693,9 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
switch (cx->type) {
case ACPI_STATE_C1:
state->flags |= CPUIDLE_FLAG_SHALLOW;
- state->flags |= CPUIDLE_FLAG_TIME_VALID;
+ if (cx->entry_method == ACPI_CSTATE_FFH)
+ state->flags |= CPUIDLE_FLAG_TIME_VALID;
+
state->enter = acpi_idle_enter_c1;
dev->safe_state = state;
break;
diff --git a/drivers/acpi/sbshc.c b/drivers/acpi/sbshc.c
index a2cf3008ce6..bcf2c70fca8 100644
--- a/drivers/acpi/sbshc.c
+++ b/drivers/acpi/sbshc.c
@@ -130,7 +130,6 @@ static int acpi_smbus_transaction(struct acpi_smb_hc *hc, u8 protocol,
goto end;
}
smb_hc_write(hc, ACPI_SMB_COMMAND, command);
- smb_hc_write(hc, ACPI_SMB_COMMAND, command);
if (!(protocol & 0x01)) {
smb_hc_write(hc, ACPI_SMB_BLOCK_COUNT, length);
for (i = 0; i < length; ++i)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 57570ac4780..e6ce262b5d4 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -39,20 +39,26 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias,
int size)
{
int len;
+ int count;
- if (!acpi_dev->flags.hardware_id)
+ if (!acpi_dev->flags.hardware_id && !acpi_dev->flags.compatible_ids)
return -ENODEV;
- len = snprintf(modalias, size, "acpi:%s:",
- acpi_dev->pnp.hardware_id);
- if (len < 0 || len >= size)
- return -EINVAL;
+ len = snprintf(modalias, size, "acpi:");
size -= len;
+ if (acpi_dev->flags.hardware_id) {
+ count = snprintf(&modalias[len], size, "%s:",
+ acpi_dev->pnp.hardware_id);
+ if (count < 0 || count >= size)
+ return -EINVAL;
+ len += count;
+ size -= count;
+ }
+
if (acpi_dev->flags.compatible_ids) {
struct acpi_compatible_id_list *cid_list;
int i;
- int count;
cid_list = acpi_dev->pnp.cid_list;
for (i = 0; i < cid_list->count; i++) {
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index d2f71a54726..71183eea790 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -26,21 +26,6 @@ u8 sleep_states[ACPI_S_STATE_COUNT];
#ifdef CONFIG_PM_SLEEP
static u32 acpi_target_sleep_state = ACPI_STATE_S0;
-static bool acpi_sleep_finish_wake_up;
-
-/*
- * ACPI 2.0 and later want us to execute _PTS after suspending devices, so we
- * allow the user to request that behavior by using the 'acpi_new_pts_ordering'
- * kernel command line option that causes the following variable to be set.
- */
-static bool new_pts_ordering;
-
-static int __init acpi_new_pts_ordering(char *str)
-{
- new_pts_ordering = true;
- return 1;
-}
-__setup("acpi_new_pts_ordering", acpi_new_pts_ordering);
#endif
static int acpi_sleep_prepare(u32 acpi_state)
@@ -91,14 +76,6 @@ static int acpi_pm_begin(suspend_state_t pm_state)
if (sleep_states[acpi_state]) {
acpi_target_sleep_state = acpi_state;
- if (new_pts_ordering)
- return 0;
-
- error = acpi_sleep_prepare(acpi_state);
- if (error)
- acpi_target_sleep_state = ACPI_STATE_S0;
- else
- acpi_sleep_finish_wake_up = true;
} else {
printk(KERN_ERR "ACPI does not support this state: %d\n",
pm_state);
@@ -116,14 +93,11 @@ static int acpi_pm_begin(suspend_state_t pm_state)
static int acpi_pm_prepare(void)
{
- if (new_pts_ordering) {
- int error = acpi_sleep_prepare(acpi_target_sleep_state);
+ int error = acpi_sleep_prepare(acpi_target_sleep_state);
- if (error) {
- acpi_target_sleep_state = ACPI_STATE_S0;
- return error;
- }
- acpi_sleep_finish_wake_up = true;
+ if (error) {
+ acpi_target_sleep_state = ACPI_STATE_S0;
+ return error;
}
return ACPI_SUCCESS(acpi_hw_disable_all_gpes()) ? 0 : -EFAULT;
@@ -212,7 +186,6 @@ static void acpi_pm_finish(void)
acpi_set_firmware_waking_vector((acpi_physical_address) 0);
acpi_target_sleep_state = ACPI_STATE_S0;
- acpi_sleep_finish_wake_up = false;
#ifdef CONFIG_X86
if (init_8259A_after_S1) {
@@ -229,11 +202,10 @@ static void acpi_pm_finish(void)
static void acpi_pm_end(void)
{
/*
- * This is necessary in case acpi_pm_finish() is not called directly
- * during a failing transition to a sleep state.
+ * This is necessary in case acpi_pm_finish() is not called during a
+ * failing transition to a sleep state.
*/
- if (acpi_sleep_finish_wake_up)
- acpi_pm_finish();
+ acpi_target_sleep_state = ACPI_STATE_S0;
}
static int acpi_pm_state_valid(suspend_state_t pm_state)
@@ -285,31 +257,18 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
#ifdef CONFIG_HIBERNATION
static int acpi_hibernation_begin(void)
{
- int error;
-
acpi_target_sleep_state = ACPI_STATE_S4;
- if (new_pts_ordering)
- return 0;
- error = acpi_sleep_prepare(ACPI_STATE_S4);
- if (error)
- acpi_target_sleep_state = ACPI_STATE_S0;
- else
- acpi_sleep_finish_wake_up = true;
-
- return error;
+ return 0;
}
static int acpi_hibernation_prepare(void)
{
- if (new_pts_ordering) {
- int error = acpi_sleep_prepare(ACPI_STATE_S4);
+ int error = acpi_sleep_prepare(ACPI_STATE_S4);
- if (error) {
- acpi_target_sleep_state = ACPI_STATE_S0;
- return error;
- }
- acpi_sleep_finish_wake_up = true;
+ if (error) {
+ acpi_target_sleep_state = ACPI_STATE_S0;
+ return error;
}
return ACPI_SUCCESS(acpi_hw_disable_all_gpes()) ? 0 : -EFAULT;
@@ -353,17 +312,15 @@ static void acpi_hibernation_finish(void)
acpi_set_firmware_waking_vector((acpi_physical_address) 0);
acpi_target_sleep_state = ACPI_STATE_S0;
- acpi_sleep_finish_wake_up = false;
}
static void acpi_hibernation_end(void)
{
/*
* This is necessary in case acpi_hibernation_finish() is not called
- * directly during a failing transition to the sleep state.
+ * during a failing transition to the sleep state.
*/
- if (acpi_sleep_finish_wake_up)
- acpi_hibernation_finish();
+ acpi_target_sleep_state = ACPI_STATE_S0;
}
static int acpi_hibernation_pre_restore(void)
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 1bc0c74f275..12fb44f1676 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -807,40 +807,11 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
static int acpi_video_bus_check(struct acpi_video_bus *video)
{
acpi_status status = -ENOENT;
- long device_id;
- struct device *dev;
- struct acpi_device *device;
+
if (!video)
return -EINVAL;
- device = video->device;
-
- status =
- acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
-
- if (!ACPI_SUCCESS(status))
- return -ENODEV;
-
- /* We need to attempt to determine whether the _ADR refers to a
- PCI device or not. There's no terribly good way to do this,
- so the best we can hope for is to assume that there'll never
- be a video device in the host bridge */
- if (device_id >= 0x10000) {
- /* It looks like a PCI device. Does it exist? */
- dev = acpi_get_physical_device(device->handle);
- } else {
- /* It doesn't look like a PCI device. Does its parent
- exist? */
- acpi_handle phandle;
- if (acpi_get_parent(device->handle, &phandle))
- return -ENODEV;
- dev = acpi_get_physical_device(phandle);
- }
- if (!dev)
- return -ENODEV;
- put_device(dev);
-
/* Since there is no HID, CID and so on for VGA driver, we have
* to check well known required nodes.
*/
@@ -1366,37 +1337,8 @@ acpi_video_bus_write_DOS(struct file *file,
static int acpi_video_bus_add_fs(struct acpi_device *device)
{
- long device_id;
- int status;
struct proc_dir_entry *entry = NULL;
struct acpi_video_bus *video;
- struct device *dev;
-
- status =
- acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
-
- if (!ACPI_SUCCESS(status))
- return -ENODEV;
-
- /* We need to attempt to determine whether the _ADR refers to a
- PCI device or not. There's no terribly good way to do this,
- so the best we can hope for is to assume that there'll never
- be a video device in the host bridge */
- if (device_id >= 0x10000) {
- /* It looks like a PCI device. Does it exist? */
- dev = acpi_get_physical_device(device->handle);
- } else {
- /* It doesn't look like a PCI device. Does its parent
- exist? */
- acpi_handle phandle;
- if (acpi_get_parent(device->handle, &phandle))
- return -ENODEV;
- dev = acpi_get_physical_device(phandle);
- }
- if (!dev)
- return -ENODEV;
- put_device(dev);
-
video = acpi_driver_data(device);