From a59d1637eb0e0a37ee0e5c92800c60abe3624e24 Mon Sep 17 00:00:00 2001 From: "Pallipadi, Venkatesh" Date: Thu, 19 Mar 2009 14:41:40 -0700 Subject: ACPI: cap off P-state transition latency from buggy BIOSes Some BIOSes report very high frequency transition latency which are plainly wrong on CPus that can change frequency using native MSR interface. One such system is IBM T42 (2327-8ZU) as reported by Owen Taylor and Rik van Riel. cpufreq_ondemand driver uses this transition latency to come up with a reasonable sampling interval to sample CPU usage and with such high latency value, ondemand sampling interval ends up being very high (0.5 sec, in this particular case), resulting in performance impact due to slow response to increasing frequency. Fix it by capping-off the transition latency to 20uS for native MSR based frequency transitions. mjg: We've confirmed that this also helps on the X31 Signed-off-by: Venkatesh Pallipadi Acked-by: Matthew Garrett Signed-off-by: Len Brown --- arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index 4b1c319d30c..89c676d6caf 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c @@ -680,6 +680,18 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) perf->states[i].transition_latency * 1000; } + /* Check for high latency (>20uS) from buggy BIOSes, like on T42 */ + if (perf->control_register.space_id == ACPI_ADR_SPACE_FIXED_HARDWARE && + policy->cpuinfo.transition_latency > 20 * 1000) { + static int print_once; + policy->cpuinfo.transition_latency = 20 * 1000; + if (!print_once) { + print_once = 1; + printk(KERN_INFO "Capping off P-state tranision latency" + " at 20 uS\n"); + } + } + data->max_freq = perf->states[0].core_frequency * 1000; /* table init */ for (i=0; istate_count; i++) { -- cgit v1.2.3 From 07de5bdb7bad607e29dc17c345717403a76a334c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Kosi=C5=84ski?= Date: Thu, 19 Mar 2009 23:22:31 +0100 Subject: tc1100-wmi: Fix state reporting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tc1100-wmi driver should print the current states of wireless LAN and jogdial brightness control when "cat /sys/devices/platform/tc1100-wmi/wireless" and "cat /sys/devices/platform/tc1100-wmi/jogdial" are executed, respectively. What actually happens is that both of those commands print 0 regardless of the hardware state. The cause is that wmi_query_block returns an ACPI_TYPE_INTEGER rather than ACPI_TYPE_BUFFER as the driver assumes. Additionally, the driver intends to return a jogdial state that is inverted with respect to the commands required to set it (e.g. it intends to return 1 after the jogdial file was written with 0). This patch fixes both of those issues - the commands to query the state now work, and should return the same state that was written. http://bugzilla.kernel.org/show_bug.cgi?id=12286 Signed-off-by: Krzysztof KosiƄski Acked-by: Carlos Corbacho Signed-off-by: Len Brown --- drivers/platform/x86/tc1100-wmi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/tc1100-wmi.c b/drivers/platform/x86/tc1100-wmi.c index b4a4aa9ee48..44166003d4e 100644 --- a/drivers/platform/x86/tc1100-wmi.c +++ b/drivers/platform/x86/tc1100-wmi.c @@ -94,9 +94,8 @@ static int get_state(u32 *out, u8 instance) return -ENODEV; obj = (union acpi_object *) result.pointer; - if (obj && obj->type == ACPI_TYPE_BUFFER && - obj->buffer.length == sizeof(u32)) { - tmp = *((u32 *) obj->buffer.pointer); + if (obj && obj->type == ACPI_TYPE_INTEGER) { + tmp = obj->integer.value; } else { tmp = 0; } @@ -109,7 +108,7 @@ static int get_state(u32 *out, u8 instance) *out = (tmp == 3) ? 1 : 0; return 0; case TC1100_INSTANCE_JOGDIAL: - *out = (tmp == 1) ? 1 : 0; + *out = (tmp == 1) ? 0 : 1; return 0; default: return -ENODEV; -- cgit v1.2.3 From 2a9ef8e1a856be8e526bb9b10fb98c5012f6e3f8 Mon Sep 17 00:00:00 2001 From: Zhao Yakui Date: Wed, 18 Mar 2009 16:36:25 +0800 Subject: ACPI: suspend: Add the Pansonic CF51 box to the dmi check table The Pansonic CF51-2L requires "acpi_sleep=old_ordering", so invoke it automatically via DMI. http://bugzilla.kernel.org/show_bug.cgi?id=12561 Signed-off-by: Zhao Yakui Signed-off-by: Len Brown --- drivers/acpi/sleep.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 00456fccfa3..31ff2a9a03d 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -394,6 +394,15 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Satellite L300"), }, }, + { + .callback = init_old_suspend_ordering, + .ident = "Panasonic CF51-2L", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, + "Matsushita Electric Industrial Co.,Ltd."), + DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"), + }, + }, {}, }; #endif /* CONFIG_SUSPEND */ -- cgit v1.2.3 From 53af9cfb37af5e03ee2b24c5d5c4963c34e5b765 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Sun, 15 Mar 2009 23:36:38 -0400 Subject: ACPI: get_throttling_state() cannot be larger than state_count Reported-by: Roel Kluin Acked-by: Zhao Yakui Signed-off-by: Len Brown --- drivers/acpi/processor_throttling.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index d27838171f4..5f099012f47 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c @@ -783,11 +783,9 @@ static int acpi_get_throttling_state(struct acpi_processor *pr, (struct acpi_processor_tx_tss *)&(pr->throttling. states_tss[i]); if (tx->control == value) - break; + return i; } - if (i > pr->throttling.state_count) - i = -1; - return i; + return -1; } static int acpi_get_throttling_value(struct acpi_processor *pr, -- cgit v1.2.3 From 5b4c0b6fffb91b07a6f85dabbdfbd5abab61d9db Mon Sep 17 00:00:00 2001 From: Zhang Rui Date: Wed, 1 Apr 2009 01:49:42 -0400 Subject: ACPI: update comment update ACPI Development Discussion List Signed-off-by: Zhang Rui Signed-off-by: Len Brown --- arch/x86/kernel/acpi/boot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 7678f10c456..2481ec3e83b 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -1493,7 +1493,7 @@ static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d) /* * If your system is blacklisted here, but you find that acpi=force - * works for you, please contact acpi-devel@sourceforge.net + * works for you, please contact linux-acpi@vger.kernel.org */ static struct dmi_system_id __initdata acpi_dmi_table[] = { /* -- cgit v1.2.3 From f240729832dff3785104d950dad2d3ced4387f6d Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 2 Apr 2009 08:29:56 +0300 Subject: dock: fix dereference after kfree() dock_remove() calls kfree() on dock_station so we should use list_for_each_entry_safe() to avoid dereferencing freed memory. Found by smatch (http://repo.or.cz/w/smatch.git/). Compile tested. Signed-off-by: Dan Carpenter Signed-off-by: Len Brown --- drivers/acpi/dock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 35094f230b1..8f62fa01a9c 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c @@ -1146,9 +1146,10 @@ static int __init dock_init(void) static void __exit dock_exit(void) { struct dock_station *dock_station; + struct dock_station *tmp; unregister_acpi_bus_notifier(&dock_acpi_notifier); - list_for_each_entry(dock_station, &dock_stations, sibiling) + list_for_each_entry_safe(dock_station, tmp, &dock_stations, sibiling) dock_remove(dock_station); } -- cgit v1.2.3 From 609d4bc949a9175a6c8ba9dc1b6fdb4d9dab0427 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Thu, 12 Mar 2009 11:58:25 +0000 Subject: ACPI: constify tables in pci_irq.c Signed-off-by: Jan Beulich Signed-off-by: Len Brown --- drivers/acpi/pci_irq.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 891bdf6679f..f93667ee43d 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -86,7 +86,7 @@ static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(struct pci_dev *dev, } /* http://bugzilla.kernel.org/show_bug.cgi?id=4773 */ -static struct dmi_system_id medion_md9580[] = { +static const struct dmi_system_id medion_md9580[] = { { .ident = "Medion MD9580-F laptop", .matches = { @@ -98,7 +98,7 @@ static struct dmi_system_id medion_md9580[] = { }; /* http://bugzilla.kernel.org/show_bug.cgi?id=5044 */ -static struct dmi_system_id dell_optiplex[] = { +static const struct dmi_system_id dell_optiplex[] = { { .ident = "Dell Optiplex GX1", .matches = { @@ -110,7 +110,7 @@ static struct dmi_system_id dell_optiplex[] = { }; /* http://bugzilla.kernel.org/show_bug.cgi?id=10138 */ -static struct dmi_system_id hp_t5710[] = { +static const struct dmi_system_id hp_t5710[] = { { .ident = "HP t5710", .matches = { @@ -123,13 +123,13 @@ static struct dmi_system_id hp_t5710[] = { }; struct prt_quirk { - struct dmi_system_id *system; + const struct dmi_system_id *system; unsigned int segment; unsigned int bus; unsigned int device; unsigned char pin; - char *source; /* according to BIOS */ - char *actual_source; + const char *source; /* according to BIOS */ + const char *actual_source; }; #define PCI_INTX_PIN(c) (c - 'A' + 1) @@ -139,7 +139,7 @@ struct prt_quirk { * interrupt at the listed segment/bus/device/pin is connected to the first * link device, but it is actually connected to the second. */ -static struct prt_quirk prt_quirks[] = { +static const struct prt_quirk prt_quirks[] = { { medion_md9580, 0, 0, 9, PCI_INTX_PIN('A'), "\\_SB_.PCI0.ISA_.LNKA", "\\_SB_.PCI0.ISA_.LNKB"}, @@ -155,7 +155,7 @@ static void do_prt_fixups(struct acpi_prt_entry *entry, struct acpi_pci_routing_table *prt) { int i; - struct prt_quirk *quirk; + const struct prt_quirk *quirk; for (i = 0; i < ARRAY_SIZE(prt_quirks); i++) { quirk = &prt_quirks[i]; -- cgit v1.2.3 From c542aadeb4700bc316834d862d52ba3d2664f13a Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 14 Jan 2009 13:59:50 +0800 Subject: panasonic-laptop: Fix autoloading This patch adds MODULE_DEVICE_TABLE() to panasonic-laptop.c in order to ensure automatic loading of the module on systems with the respective "MAT*" ACPI devices. Signed-off-by: Martin Lucina Signed-off-by: Harald Welte Signed-off-by: Len Brown --- drivers/platform/x86/panasonic-laptop.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c index c47a44dcb70..ecaca412a2a 100644 --- a/drivers/platform/x86/panasonic-laptop.c +++ b/drivers/platform/x86/panasonic-laptop.c @@ -184,6 +184,7 @@ static const struct acpi_device_id pcc_device_ids[] = { { "MAT0019", 0}, { "", 0}, }; +MODULE_DEVICE_TABLE(acpi, pcc_device_ids); static struct acpi_driver acpi_pcc_driver = { .name = ACPI_PCC_DRIVER_NAME, -- cgit v1.2.3 From ba256b41bd58f0821c9c0e203982fb260f09bdeb Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 14 Jan 2009 14:01:17 +0800 Subject: panasonic-laptop: use snprintf with PAGE_SIZE in sysfs attributes Instead of just sprintf() into the page-sized buffer provided by the sysfs/device_attribute API, we use snprintf with PAGE_SIZE as an additional safeguard. Signed-off-by: Martin Lucina Signed-off-by: Harald Welte Signed-off-by: Len Brown --- drivers/platform/x86/panasonic-laptop.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c index ecaca412a2a..a5ce4bc202e 100644 --- a/drivers/platform/x86/panasonic-laptop.c +++ b/drivers/platform/x86/panasonic-laptop.c @@ -367,7 +367,7 @@ static ssize_t show_numbatt(struct device *dev, struct device_attribute *attr, if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) return -EIO; - return sprintf(buf, "%u\n", pcc->sinf[SINF_NUM_BATTERIES]); + return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_NUM_BATTERIES]); } static ssize_t show_lcdtype(struct device *dev, struct device_attribute *attr, @@ -379,7 +379,7 @@ static ssize_t show_lcdtype(struct device *dev, struct device_attribute *attr, if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) return -EIO; - return sprintf(buf, "%u\n", pcc->sinf[SINF_LCD_TYPE]); + return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_LCD_TYPE]); } static ssize_t show_mute(struct device *dev, struct device_attribute *attr, @@ -391,7 +391,7 @@ static ssize_t show_mute(struct device *dev, struct device_attribute *attr, if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) return -EIO; - return sprintf(buf, "%u\n", pcc->sinf[SINF_MUTE]); + return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_MUTE]); } static ssize_t show_sticky(struct device *dev, struct device_attribute *attr, @@ -403,7 +403,7 @@ static ssize_t show_sticky(struct device *dev, struct device_attribute *attr, if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) return -EIO; - return sprintf(buf, "%u\n", pcc->sinf[SINF_STICKY_KEY]); + return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_STICKY_KEY]); } static ssize_t set_sticky(struct device *dev, struct device_attribute *attr, -- cgit v1.2.3 From 15065531c1c5902775ae3ade24eb37d0e688353b Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Mon, 30 Mar 2009 12:02:35 +0200 Subject: toshiba-acpi: remove MAINTAINERS entry "I'm not much opposed to marking this driver orphaned. I haven't used a Toshiba laptop in four years or so, and disagree with the recent additions of bluetooth and wireless control to the driver. --John" Signed-off-by: Johannes Berg Acked-by: John Belmonte Signed-off-by: Len Brown --- MAINTAINERS | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 5d460c9d1c2..c01fdfcb127 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4286,10 +4286,7 @@ W: http://sourceforge.net/projects/tlan/ S: Maintained TOSHIBA ACPI EXTRAS DRIVER -P: John Belmonte -M: toshiba_acpi@memebeam.org -W: http://memebeam.org/toys/ToshibaAcpiDriver -S: Maintained +S: Orphan TOSHIBA SMM DRIVER P: Jonathan Buzzard -- cgit v1.2.3