aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/acpi/boot.c2
-rw-r--r--drivers/acpi/acpi_lpss.c12
-rw-r--r--drivers/acpi/acpi_platform.c6
-rw-r--r--drivers/acpi/button.c9
-rw-r--r--drivers/acpi/ec.c49
-rw-r--r--drivers/acpi/osl.c4
-rw-r--r--drivers/acpi/sysfs.c9
-rw-r--r--drivers/acpi/thermal.c43
-rw-r--r--drivers/acpi/utils.c17
9 files changed, 85 insertions, 66 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 1f7c0746611f..6c0b43bd024b 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -695,7 +695,7 @@ static int __init acpi_parse_sbf(struct acpi_table_header *table)
695#ifdef CONFIG_HPET_TIMER 695#ifdef CONFIG_HPET_TIMER
696#include <asm/hpet.h> 696#include <asm/hpet.h>
697 697
698static struct __initdata resource *hpet_res; 698static struct resource *hpet_res __initdata;
699 699
700static int __init acpi_parse_hpet(struct acpi_table_header *table) 700static int __init acpi_parse_hpet(struct acpi_table_header *table)
701{ 701{
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index fb78bb9ad8f6..d3961014aad7 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -30,6 +30,7 @@ ACPI_MODULE_NAME("acpi_lpss");
30/* Offsets relative to LPSS_PRIVATE_OFFSET */ 30/* Offsets relative to LPSS_PRIVATE_OFFSET */
31#define LPSS_GENERAL 0x08 31#define LPSS_GENERAL 0x08
32#define LPSS_GENERAL_LTR_MODE_SW BIT(2) 32#define LPSS_GENERAL_LTR_MODE_SW BIT(2)
33#define LPSS_GENERAL_UART_RTS_OVRD BIT(3)
33#define LPSS_SW_LTR 0x10 34#define LPSS_SW_LTR 0x10
34#define LPSS_AUTO_LTR 0x14 35#define LPSS_AUTO_LTR 0x14
35#define LPSS_TX_INT 0x20 36#define LPSS_TX_INT 0x20
@@ -68,11 +69,16 @@ struct lpss_private_data {
68 69
69static void lpss_uart_setup(struct lpss_private_data *pdata) 70static void lpss_uart_setup(struct lpss_private_data *pdata)
70{ 71{
71 unsigned int tx_int_offset = pdata->dev_desc->prv_offset + LPSS_TX_INT; 72 unsigned int offset;
72 u32 reg; 73 u32 reg;
73 74
74 reg = readl(pdata->mmio_base + tx_int_offset); 75 offset = pdata->dev_desc->prv_offset + LPSS_TX_INT;
75 writel(reg | LPSS_TX_INT_MASK, pdata->mmio_base + tx_int_offset); 76 reg = readl(pdata->mmio_base + offset);
77 writel(reg | LPSS_TX_INT_MASK, pdata->mmio_base + offset);
78
79 offset = pdata->dev_desc->prv_offset + LPSS_GENERAL;
80 reg = readl(pdata->mmio_base + offset);
81 writel(reg | LPSS_GENERAL_UART_RTS_OVRD, pdata->mmio_base + offset);
76} 82}
77 83
78static struct lpss_device_desc lpt_dev_desc = { 84static struct lpss_device_desc lpt_dev_desc = {
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
index c20b02beec7c..8a4cfc7e71f0 100644
--- a/drivers/acpi/acpi_platform.c
+++ b/drivers/acpi/acpi_platform.c
@@ -31,6 +31,12 @@ static const struct acpi_device_id acpi_platform_device_ids[] = {
31 { "PNP0D40" }, 31 { "PNP0D40" },
32 { "ACPI0003" }, 32 { "ACPI0003" },
33 { "VPC2004" }, 33 { "VPC2004" },
34 { "BCM4752" },
35
36 /* Intel Smart Sound Technology */
37 { "INT33C8" },
38 { "80860F28" },
39
34 { } 40 { }
35}; 41};
36 42
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index a55773801c5f..c971929d75c2 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -383,18 +383,15 @@ static int acpi_button_add(struct acpi_device *device)
383 383
384 switch (button->type) { 384 switch (button->type) {
385 case ACPI_BUTTON_TYPE_POWER: 385 case ACPI_BUTTON_TYPE_POWER:
386 input->evbit[0] = BIT_MASK(EV_KEY); 386 input_set_capability(input, EV_KEY, KEY_POWER);
387 set_bit(KEY_POWER, input->keybit);
388 break; 387 break;
389 388
390 case ACPI_BUTTON_TYPE_SLEEP: 389 case ACPI_BUTTON_TYPE_SLEEP:
391 input->evbit[0] = BIT_MASK(EV_KEY); 390 input_set_capability(input, EV_KEY, KEY_SLEEP);
392 set_bit(KEY_SLEEP, input->keybit);
393 break; 391 break;
394 392
395 case ACPI_BUTTON_TYPE_LID: 393 case ACPI_BUTTON_TYPE_LID:
396 input->evbit[0] = BIT_MASK(EV_SW); 394 input_set_capability(input, EV_SW, SW_LID);
397 set_bit(SW_LID, input->swbit);
398 break; 395 break;
399 } 396 }
400 397
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index a06d98374705..d5309fd49458 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -28,6 +28,7 @@
28 28
29/* Uncomment next line to get verbose printout */ 29/* Uncomment next line to get verbose printout */
30/* #define DEBUG */ 30/* #define DEBUG */
31#define pr_fmt(fmt) "ACPI : EC: " fmt
31 32
32#include <linux/kernel.h> 33#include <linux/kernel.h>
33#include <linux/module.h> 34#include <linux/module.h>
@@ -49,9 +50,6 @@
49#define ACPI_EC_DEVICE_NAME "Embedded Controller" 50#define ACPI_EC_DEVICE_NAME "Embedded Controller"
50#define ACPI_EC_FILE_INFO "info" 51#define ACPI_EC_FILE_INFO "info"
51 52
52#undef PREFIX
53#define PREFIX "ACPI: EC: "
54
55/* EC status register */ 53/* EC status register */
56#define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ 54#define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */
57#define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ 55#define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */
@@ -131,26 +129,26 @@ static int EC_FLAGS_SKIP_DSDT_SCAN; /* Not all BIOS survive early DSDT scan */
131static inline u8 acpi_ec_read_status(struct acpi_ec *ec) 129static inline u8 acpi_ec_read_status(struct acpi_ec *ec)
132{ 130{
133 u8 x = inb(ec->command_addr); 131 u8 x = inb(ec->command_addr);
134 pr_debug(PREFIX "---> status = 0x%2.2x\n", x); 132 pr_debug("---> status = 0x%2.2x\n", x);
135 return x; 133 return x;
136} 134}
137 135
138static inline u8 acpi_ec_read_data(struct acpi_ec *ec) 136static inline u8 acpi_ec_read_data(struct acpi_ec *ec)
139{ 137{
140 u8 x = inb(ec->data_addr); 138 u8 x = inb(ec->data_addr);
141 pr_debug(PREFIX "---> data = 0x%2.2x\n", x); 139 pr_debug("---> data = 0x%2.2x\n", x);
142 return x; 140 return x;
143} 141}
144 142
145static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command) 143static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command)
146{ 144{
147 pr_debug(PREFIX "<--- command = 0x%2.2x\n", command); 145 pr_debug("<--- command = 0x%2.2x\n", command);
148 outb(command, ec->command_addr); 146 outb(command, ec->command_addr);
149} 147}
150 148
151static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) 149static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)
152{ 150{
153 pr_debug(PREFIX "<--- data = 0x%2.2x\n", data); 151 pr_debug("<--- data = 0x%2.2x\n", data);
154 outb(data, ec->data_addr); 152 outb(data, ec->data_addr);
155} 153}
156 154
@@ -241,7 +239,7 @@ static int ec_poll(struct acpi_ec *ec)
241 } 239 }
242 advance_transaction(ec, acpi_ec_read_status(ec)); 240 advance_transaction(ec, acpi_ec_read_status(ec));
243 } while (time_before(jiffies, delay)); 241 } while (time_before(jiffies, delay));
244 pr_debug(PREFIX "controller reset, restart transaction\n"); 242 pr_debug("controller reset, restart transaction\n");
245 spin_lock_irqsave(&ec->lock, flags); 243 spin_lock_irqsave(&ec->lock, flags);
246 start_transaction(ec); 244 start_transaction(ec);
247 spin_unlock_irqrestore(&ec->lock, flags); 245 spin_unlock_irqrestore(&ec->lock, flags);
@@ -309,12 +307,12 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
309 } 307 }
310 } 308 }
311 if (ec_wait_ibf0(ec)) { 309 if (ec_wait_ibf0(ec)) {
312 pr_err(PREFIX "input buffer is not empty, " 310 pr_err("input buffer is not empty, "
313 "aborting transaction\n"); 311 "aborting transaction\n");
314 status = -ETIME; 312 status = -ETIME;
315 goto end; 313 goto end;
316 } 314 }
317 pr_debug(PREFIX "transaction start (cmd=0x%02x, addr=0x%02x)\n", 315 pr_debug("transaction start (cmd=0x%02x, addr=0x%02x)\n",
318 t->command, t->wdata ? t->wdata[0] : 0); 316 t->command, t->wdata ? t->wdata[0] : 0);
319 /* disable GPE during transaction if storm is detected */ 317 /* disable GPE during transaction if storm is detected */
320 if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { 318 if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
@@ -331,12 +329,12 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
331 /* It is safe to enable the GPE outside of the transaction. */ 329 /* It is safe to enable the GPE outside of the transaction. */
332 acpi_enable_gpe(NULL, ec->gpe); 330 acpi_enable_gpe(NULL, ec->gpe);
333 } else if (t->irq_count > ec_storm_threshold) { 331 } else if (t->irq_count > ec_storm_threshold) {
334 pr_info(PREFIX "GPE storm detected(%d GPEs), " 332 pr_info("GPE storm detected(%d GPEs), "
335 "transactions will use polling mode\n", 333 "transactions will use polling mode\n",
336 t->irq_count); 334 t->irq_count);
337 set_bit(EC_FLAGS_GPE_STORM, &ec->flags); 335 set_bit(EC_FLAGS_GPE_STORM, &ec->flags);
338 } 336 }
339 pr_debug(PREFIX "transaction end\n"); 337 pr_debug("transaction end\n");
340end: 338end:
341 if (ec->global_lock) 339 if (ec->global_lock)
342 acpi_release_global_lock(glk); 340 acpi_release_global_lock(glk);
@@ -570,12 +568,12 @@ static void acpi_ec_run(void *cxt)
570 struct acpi_ec_query_handler *handler = cxt; 568 struct acpi_ec_query_handler *handler = cxt;
571 if (!handler) 569 if (!handler)
572 return; 570 return;
573 pr_debug(PREFIX "start query execution\n"); 571 pr_debug("start query execution\n");
574 if (handler->func) 572 if (handler->func)
575 handler->func(handler->data); 573 handler->func(handler->data);
576 else if (handler->handle) 574 else if (handler->handle)
577 acpi_evaluate_object(handler->handle, NULL, NULL, NULL); 575 acpi_evaluate_object(handler->handle, NULL, NULL, NULL);
578 pr_debug(PREFIX "stop query execution\n"); 576 pr_debug("stop query execution\n");
579 kfree(handler); 577 kfree(handler);
580} 578}
581 579
@@ -593,7 +591,8 @@ static int acpi_ec_sync_query(struct acpi_ec *ec)
593 if (!copy) 591 if (!copy)
594 return -ENOMEM; 592 return -ENOMEM;
595 memcpy(copy, handler, sizeof(*copy)); 593 memcpy(copy, handler, sizeof(*copy));
596 pr_debug(PREFIX "push query execution (0x%2x) on queue\n", value); 594 pr_debug("push query execution (0x%2x) on queue\n",
595 value);
597 return acpi_os_execute((copy->func) ? 596 return acpi_os_execute((copy->func) ?
598 OSL_NOTIFY_HANDLER : OSL_GPE_HANDLER, 597 OSL_NOTIFY_HANDLER : OSL_GPE_HANDLER,
599 acpi_ec_run, copy); 598 acpi_ec_run, copy);
@@ -616,7 +615,7 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state)
616{ 615{
617 if (state & ACPI_EC_FLAG_SCI) { 616 if (state & ACPI_EC_FLAG_SCI) {
618 if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) { 617 if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) {
619 pr_debug(PREFIX "push gpe query to the queue\n"); 618 pr_debug("push gpe query to the queue\n");
620 return acpi_os_execute(OSL_NOTIFY_HANDLER, 619 return acpi_os_execute(OSL_NOTIFY_HANDLER,
621 acpi_ec_gpe_query, ec); 620 acpi_ec_gpe_query, ec);
622 } 621 }
@@ -630,7 +629,7 @@ static u32 acpi_ec_gpe_handler(acpi_handle gpe_device,
630 struct acpi_ec *ec = data; 629 struct acpi_ec *ec = data;
631 u8 status = acpi_ec_read_status(ec); 630 u8 status = acpi_ec_read_status(ec);
632 631
633 pr_debug(PREFIX "~~~> interrupt, status:0x%02x\n", status); 632 pr_debug("~~~> interrupt, status:0x%02x\n", status);
634 633
635 advance_transaction(ec, status); 634 advance_transaction(ec, status);
636 if (ec_transaction_done(ec) && 635 if (ec_transaction_done(ec) &&
@@ -776,7 +775,7 @@ static int ec_install_handlers(struct acpi_ec *ec)
776 * The AE_NOT_FOUND error will be ignored and OS 775 * The AE_NOT_FOUND error will be ignored and OS
777 * continue to initialize EC. 776 * continue to initialize EC.
778 */ 777 */
779 printk(KERN_ERR "Fail in evaluating the _REG object" 778 pr_err("Fail in evaluating the _REG object"
780 " of EC device. Broken bios is suspected.\n"); 779 " of EC device. Broken bios is suspected.\n");
781 } else { 780 } else {
782 acpi_remove_gpe_handler(NULL, ec->gpe, 781 acpi_remove_gpe_handler(NULL, ec->gpe,
@@ -795,10 +794,10 @@ static void ec_remove_handlers(struct acpi_ec *ec)
795 acpi_disable_gpe(NULL, ec->gpe); 794 acpi_disable_gpe(NULL, ec->gpe);
796 if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, 795 if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
797 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) 796 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
798 pr_err(PREFIX "failed to remove space handler\n"); 797 pr_err("failed to remove space handler\n");
799 if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe, 798 if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe,
800 &acpi_ec_gpe_handler))) 799 &acpi_ec_gpe_handler)))
801 pr_err(PREFIX "failed to remove gpe handler\n"); 800 pr_err("failed to remove gpe handler\n");
802 clear_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags); 801 clear_bit(EC_FLAGS_HANDLERS_INSTALLED, &ec->flags);
803} 802}
804 803
@@ -840,7 +839,7 @@ static int acpi_ec_add(struct acpi_device *device)
840 ret = !!request_region(ec->command_addr, 1, "EC cmd"); 839 ret = !!request_region(ec->command_addr, 1, "EC cmd");
841 WARN(!ret, "Could not request EC cmd io port 0x%lx", ec->command_addr); 840 WARN(!ret, "Could not request EC cmd io port 0x%lx", ec->command_addr);
842 841
843 pr_info(PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", 842 pr_info("GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n",
844 ec->gpe, ec->command_addr, ec->data_addr); 843 ec->gpe, ec->command_addr, ec->data_addr);
845 844
846 ret = ec_install_handlers(ec); 845 ret = ec_install_handlers(ec);
@@ -931,7 +930,7 @@ static int ec_validate_ecdt(const struct dmi_system_id *id)
931/* MSI EC needs special treatment, enable it */ 930/* MSI EC needs special treatment, enable it */
932static int ec_flag_msi(const struct dmi_system_id *id) 931static int ec_flag_msi(const struct dmi_system_id *id)
933{ 932{
934 printk(KERN_DEBUG PREFIX "Detected MSI hardware, enabling workarounds.\n"); 933 pr_debug("Detected MSI hardware, enabling workarounds.\n");
935 EC_FLAGS_MSI = 1; 934 EC_FLAGS_MSI = 1;
936 EC_FLAGS_VALIDATE_ECDT = 1; 935 EC_FLAGS_VALIDATE_ECDT = 1;
937 return 0; 936 return 0;
@@ -1010,7 +1009,7 @@ int __init acpi_ec_ecdt_probe(void)
1010 status = acpi_get_table(ACPI_SIG_ECDT, 1, 1009 status = acpi_get_table(ACPI_SIG_ECDT, 1,
1011 (struct acpi_table_header **)&ecdt_ptr); 1010 (struct acpi_table_header **)&ecdt_ptr);
1012 if (ACPI_SUCCESS(status)) { 1011 if (ACPI_SUCCESS(status)) {
1013 pr_info(PREFIX "EC description table is found, configuring boot EC\n"); 1012 pr_info("EC description table is found, configuring boot EC\n");
1014 boot_ec->command_addr = ecdt_ptr->control.address; 1013 boot_ec->command_addr = ecdt_ptr->control.address;
1015 boot_ec->data_addr = ecdt_ptr->data.address; 1014 boot_ec->data_addr = ecdt_ptr->data.address;
1016 boot_ec->gpe = ecdt_ptr->gpe; 1015 boot_ec->gpe = ecdt_ptr->gpe;
@@ -1030,7 +1029,7 @@ int __init acpi_ec_ecdt_probe(void)
1030 1029
1031 /* This workaround is needed only on some broken machines, 1030 /* This workaround is needed only on some broken machines,
1032 * which require early EC, but fail to provide ECDT */ 1031 * which require early EC, but fail to provide ECDT */
1033 printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); 1032 pr_debug("Look up EC in DSDT\n");
1034 status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, 1033 status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
1035 boot_ec, NULL); 1034 boot_ec, NULL);
1036 /* Check that acpi_get_devices actually find something */ 1035 /* Check that acpi_get_devices actually find something */
@@ -1042,7 +1041,7 @@ int __init acpi_ec_ecdt_probe(void)
1042 saved_ec->data_addr != boot_ec->data_addr || 1041 saved_ec->data_addr != boot_ec->data_addr ||
1043 saved_ec->gpe != boot_ec->gpe || 1042 saved_ec->gpe != boot_ec->gpe ||
1044 saved_ec->handle != boot_ec->handle) 1043 saved_ec->handle != boot_ec->handle)
1045 pr_info(PREFIX "ASUSTek keeps feeding us with broken " 1044 pr_info("ASUSTek keeps feeding us with broken "
1046 "ECDT tables, which are very hard to workaround. " 1045 "ECDT tables, which are very hard to workaround. "
1047 "Trying to use DSDT EC info instead. Please send " 1046 "Trying to use DSDT EC info instead. Please send "
1048 "output of acpidump to linux-acpi@vger.kernel.org\n"); 1047 "output of acpidump to linux-acpi@vger.kernel.org\n");
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 88bb9d05b038..a0c09adf7e7d 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -840,7 +840,7 @@ acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
840 840
841void acpi_os_sleep(u64 ms) 841void acpi_os_sleep(u64 ms)
842{ 842{
843 schedule_timeout_interruptible(msecs_to_jiffies(ms)); 843 msleep(ms);
844} 844}
845 845
846void acpi_os_stall(u32 us) 846void acpi_os_stall(u32 us)
@@ -1355,7 +1355,7 @@ static int __init acpi_os_name_setup(char *str)
1355 if (!str || !*str) 1355 if (!str || !*str)
1356 return 0; 1356 return 0;
1357 1357
1358 for (; count-- && str && *str; str++) { 1358 for (; count-- && *str; str++) {
1359 if (isalnum(*str) || *str == ' ' || *str == ':') 1359 if (isalnum(*str) || *str == ' ' || *str == ':')
1360 *p++ = *str; 1360 *p++ = *str;
1361 else if (*str == '\'' || *str == '"') 1361 else if (*str == '\'' || *str == '"')
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index bb6045c5385b..db5293650f62 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -564,6 +564,7 @@ static ssize_t counter_set(struct kobject *kobj,
564 acpi_event_status status; 564 acpi_event_status status;
565 acpi_handle handle; 565 acpi_handle handle;
566 int result = 0; 566 int result = 0;
567 unsigned long tmp;
567 568
568 if (index == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) { 569 if (index == num_gpes + ACPI_NUM_FIXED_EVENTS + COUNT_SCI) {
569 int i; 570 int i;
@@ -596,8 +597,10 @@ static ssize_t counter_set(struct kobject *kobj,
596 else if (!strcmp(buf, "clear\n") && 597 else if (!strcmp(buf, "clear\n") &&
597 (status & ACPI_EVENT_FLAG_SET)) 598 (status & ACPI_EVENT_FLAG_SET))
598 result = acpi_clear_gpe(handle, index); 599 result = acpi_clear_gpe(handle, index);
600 else if (!kstrtoul(buf, 0, &tmp))
601 all_counters[index].count = tmp;
599 else 602 else
600 all_counters[index].count = strtoul(buf, NULL, 0); 603 result = -EINVAL;
601 } else if (index < num_gpes + ACPI_NUM_FIXED_EVENTS) { 604 } else if (index < num_gpes + ACPI_NUM_FIXED_EVENTS) {
602 int event = index - num_gpes; 605 int event = index - num_gpes;
603 if (!strcmp(buf, "disable\n") && 606 if (!strcmp(buf, "disable\n") &&
@@ -609,8 +612,10 @@ static ssize_t counter_set(struct kobject *kobj,
609 else if (!strcmp(buf, "clear\n") && 612 else if (!strcmp(buf, "clear\n") &&
610 (status & ACPI_EVENT_FLAG_SET)) 613 (status & ACPI_EVENT_FLAG_SET))
611 result = acpi_clear_event(event); 614 result = acpi_clear_event(event);
615 else if (!kstrtoul(buf, 0, &tmp))
616 all_counters[index].count = tmp;
612 else 617 else
613 all_counters[index].count = strtoul(buf, NULL, 0); 618 result = -EINVAL;
614 } else 619 } else
615 all_counters[index].count = strtoul(buf, NULL, 0); 620 all_counters[index].count = strtoul(buf, NULL, 0);
616 621
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 6a0329340b42..e600b5dbfcb6 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -299,8 +299,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
299 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 299 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
300 "No critical threshold\n")); 300 "No critical threshold\n"));
301 } else if (tmp <= 2732) { 301 } else if (tmp <= 2732) {
302 printk(KERN_WARNING FW_BUG "Invalid critical threshold " 302 pr_warn(FW_BUG "Invalid critical threshold (%llu)\n",
303 "(%llu)\n", tmp); 303 tmp);
304 tz->trips.critical.flags.valid = 0; 304 tz->trips.critical.flags.valid = 0;
305 } else { 305 } else {
306 tz->trips.critical.flags.valid = 1; 306 tz->trips.critical.flags.valid = 1;
@@ -317,8 +317,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
317 * Allow override critical threshold 317 * Allow override critical threshold
318 */ 318 */
319 if (crt_k > tz->trips.critical.temperature) 319 if (crt_k > tz->trips.critical.temperature)
320 printk(KERN_WARNING PREFIX 320 pr_warn(PREFIX "Critical threshold %d C\n",
321 "Critical threshold %d C\n", crt); 321 crt);
322 tz->trips.critical.temperature = crt_k; 322 tz->trips.critical.temperature = crt_k;
323 } 323 }
324 } 324 }
@@ -390,8 +390,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
390 status = acpi_evaluate_reference(tz->device->handle, "_PSL", 390 status = acpi_evaluate_reference(tz->device->handle, "_PSL",
391 NULL, &devices); 391 NULL, &devices);
392 if (ACPI_FAILURE(status)) { 392 if (ACPI_FAILURE(status)) {
393 printk(KERN_WARNING PREFIX 393 pr_warn(PREFIX "Invalid passive threshold\n");
394 "Invalid passive threshold\n");
395 tz->trips.passive.flags.valid = 0; 394 tz->trips.passive.flags.valid = 0;
396 } 395 }
397 else 396 else
@@ -453,8 +452,8 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
453 status = acpi_evaluate_reference(tz->device->handle, 452 status = acpi_evaluate_reference(tz->device->handle,
454 name, NULL, &devices); 453 name, NULL, &devices);
455 if (ACPI_FAILURE(status)) { 454 if (ACPI_FAILURE(status)) {
456 printk(KERN_WARNING PREFIX 455 pr_warn(PREFIX "Invalid active%d threshold\n",
457 "Invalid active%d threshold\n", i); 456 i);
458 tz->trips.active[i].flags.valid = 0; 457 tz->trips.active[i].flags.valid = 0;
459 } 458 }
460 else 459 else
@@ -505,7 +504,7 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
505 valid |= tz->trips.active[i].flags.valid; 504 valid |= tz->trips.active[i].flags.valid;
506 505
507 if (!valid) { 506 if (!valid) {
508 printk(KERN_WARNING FW_BUG "No valid trip found\n"); 507 pr_warn(FW_BUG "No valid trip found\n");
509 return -ENODEV; 508 return -ENODEV;
510 } 509 }
511 return 0; 510 return 0;
@@ -923,8 +922,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
923 acpi_bus_private_data_handler, 922 acpi_bus_private_data_handler,
924 tz->thermal_zone); 923 tz->thermal_zone);
925 if (ACPI_FAILURE(status)) { 924 if (ACPI_FAILURE(status)) {
926 printk(KERN_ERR PREFIX 925 pr_err(PREFIX "Error attaching device data\n");
927 "Error attaching device data\n");
928 return -ENODEV; 926 return -ENODEV;
929 } 927 }
930 928
@@ -1094,9 +1092,8 @@ static int acpi_thermal_add(struct acpi_device *device)
1094 if (result) 1092 if (result)
1095 goto free_memory; 1093 goto free_memory;
1096 1094
1097 printk(KERN_INFO PREFIX "%s [%s] (%ld C)\n", 1095 pr_info(PREFIX "%s [%s] (%ld C)\n", acpi_device_name(device),
1098 acpi_device_name(device), acpi_device_bid(device), 1096 acpi_device_bid(device), KELVIN_TO_CELSIUS(tz->temperature));
1099 KELVIN_TO_CELSIUS(tz->temperature));
1100 goto end; 1097 goto end;
1101 1098
1102free_memory: 1099free_memory:
@@ -1159,24 +1156,24 @@ static int acpi_thermal_resume(struct device *dev)
1159static int thermal_act(const struct dmi_system_id *d) { 1156static int thermal_act(const struct dmi_system_id *d) {
1160 1157
1161 if (act == 0) { 1158 if (act == 0) {
1162 printk(KERN_NOTICE "ACPI: %s detected: " 1159 pr_notice(PREFIX "%s detected: "
1163 "disabling all active thermal trip points\n", d->ident); 1160 "disabling all active thermal trip points\n", d->ident);
1164 act = -1; 1161 act = -1;
1165 } 1162 }
1166 return 0; 1163 return 0;
1167} 1164}
1168static int thermal_nocrt(const struct dmi_system_id *d) { 1165static int thermal_nocrt(const struct dmi_system_id *d) {
1169 1166
1170 printk(KERN_NOTICE "ACPI: %s detected: " 1167 pr_notice(PREFIX "%s detected: "
1171 "disabling all critical thermal trip point actions.\n", d->ident); 1168 "disabling all critical thermal trip point actions.\n", d->ident);
1172 nocrt = 1; 1169 nocrt = 1;
1173 return 0; 1170 return 0;
1174} 1171}
1175static int thermal_tzp(const struct dmi_system_id *d) { 1172static int thermal_tzp(const struct dmi_system_id *d) {
1176 1173
1177 if (tzp == 0) { 1174 if (tzp == 0) {
1178 printk(KERN_NOTICE "ACPI: %s detected: " 1175 pr_notice(PREFIX "%s detected: "
1179 "enabling thermal zone polling\n", d->ident); 1176 "enabling thermal zone polling\n", d->ident);
1180 tzp = 300; /* 300 dS = 30 Seconds */ 1177 tzp = 300; /* 300 dS = 30 Seconds */
1181 } 1178 }
1182 return 0; 1179 return 0;
@@ -1184,8 +1181,8 @@ static int thermal_tzp(const struct dmi_system_id *d) {
1184static int thermal_psv(const struct dmi_system_id *d) { 1181static int thermal_psv(const struct dmi_system_id *d) {
1185 1182
1186 if (psv == 0) { 1183 if (psv == 0) {
1187 printk(KERN_NOTICE "ACPI: %s detected: " 1184 pr_notice(PREFIX "%s detected: "
1188 "disabling all passive thermal trip points\n", d->ident); 1185 "disabling all passive thermal trip points\n", d->ident);
1189 psv = -1; 1186 psv = -1;
1190 } 1187 }
1191 return 0; 1188 return 0;
@@ -1238,7 +1235,7 @@ static int __init acpi_thermal_init(void)
1238 dmi_check_system(thermal_dmi_table); 1235 dmi_check_system(thermal_dmi_table);
1239 1236
1240 if (off) { 1237 if (off) {
1241 printk(KERN_NOTICE "ACPI: thermal control disabled\n"); 1238 pr_notice(PREFIX "thermal control disabled\n");
1242 return -ENODEV; 1239 return -ENODEV;
1243 } 1240 }
1244 1241
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 552248b0005b..fc2cd3284080 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -169,11 +169,20 @@ acpi_extract_package(union acpi_object *package,
169 /* 169 /*
170 * Validate output buffer. 170 * Validate output buffer.
171 */ 171 */
172 if (buffer->length < size_required) { 172 if (buffer->length == ACPI_ALLOCATE_BUFFER) {
173 buffer->pointer = ACPI_ALLOCATE(size_required);
174 if (!buffer->pointer)
175 return AE_NO_MEMORY;
173 buffer->length = size_required; 176 buffer->length = size_required;
174 return AE_BUFFER_OVERFLOW; 177 memset(buffer->pointer, 0, size_required);
175 } else if (buffer->length != size_required || !buffer->pointer) { 178 } else {
176 return AE_BAD_PARAMETER; 179 if (buffer->length < size_required) {
180 buffer->length = size_required;
181 return AE_BUFFER_OVERFLOW;
182 } else if (buffer->length != size_required ||
183 !buffer->pointer) {
184 return AE_BAD_PARAMETER;
185 }
177 } 186 }
178 187
179 head = buffer->pointer; 188 head = buffer->pointer;