aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpi_pad.c13
-rw-r--r--drivers/acpi/ec.c3
-rw-r--r--drivers/acpi/processor_idle.c30
-rw-r--r--drivers/acpi/sleep.h2
-rw-r--r--drivers/acpi/video.c8
5 files changed, 30 insertions, 26 deletions
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index 62122134693b..f169e516a1af 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -43,6 +43,10 @@ static DEFINE_MUTEX(isolated_cpus_lock);
43#define CPUID5_ECX_EXTENSIONS_SUPPORTED (0x1) 43#define CPUID5_ECX_EXTENSIONS_SUPPORTED (0x1)
44#define CPUID5_ECX_INTERRUPT_BREAK (0x2) 44#define CPUID5_ECX_INTERRUPT_BREAK (0x2)
45static unsigned long power_saving_mwait_eax; 45static unsigned long power_saving_mwait_eax;
46
47static unsigned char tsc_detected_unstable;
48static unsigned char tsc_marked_unstable;
49
46static void power_saving_mwait_init(void) 50static void power_saving_mwait_init(void)
47{ 51{
48 unsigned int eax, ebx, ecx, edx; 52 unsigned int eax, ebx, ecx, edx;
@@ -87,8 +91,8 @@ static void power_saving_mwait_init(void)
87 91
88 /*FALL THROUGH*/ 92 /*FALL THROUGH*/
89 default: 93 default:
90 /* TSC could halt in idle, so notify users */ 94 /* TSC could halt in idle */
91 mark_tsc_unstable("TSC halts in idle"); 95 tsc_detected_unstable = 1;
92 } 96 }
93#endif 97#endif
94} 98}
@@ -178,6 +182,11 @@ static int power_saving_thread(void *data)
178 expire_time = jiffies + HZ * (100 - idle_pct) / 100; 182 expire_time = jiffies + HZ * (100 - idle_pct) / 100;
179 183
180 while (!need_resched()) { 184 while (!need_resched()) {
185 if (tsc_detected_unstable && !tsc_marked_unstable) {
186 /* TSC could halt in idle, so notify users */
187 mark_tsc_unstable("TSC halts in idle");
188 tsc_marked_unstable = 1;
189 }
181 local_irq_disable(); 190 local_irq_disable();
182 cpu = smp_processor_id(); 191 cpu = smp_processor_id();
183 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, 192 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER,
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index f2234db85da0..e61d4f8e62a5 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1027,10 +1027,9 @@ int __init acpi_ec_ecdt_probe(void)
1027 /* Don't trust ECDT, which comes from ASUSTek */ 1027 /* Don't trust ECDT, which comes from ASUSTek */
1028 if (!EC_FLAGS_VALIDATE_ECDT) 1028 if (!EC_FLAGS_VALIDATE_ECDT)
1029 goto install; 1029 goto install;
1030 saved_ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); 1030 saved_ec = kmemdup(boot_ec, sizeof(struct acpi_ec), GFP_KERNEL);
1031 if (!saved_ec) 1031 if (!saved_ec)
1032 return -ENOMEM; 1032 return -ENOMEM;
1033 memcpy(saved_ec, boot_ec, sizeof(struct acpi_ec));
1034 /* fall through */ 1033 /* fall through */
1035 } 1034 }
1036 1035
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 5939e7f7d8e9..43fe52f9834b 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -727,19 +727,9 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
727 break; 727 break;
728 } 728 }
729 729
730 if (pr->power.states[i].promotion.state) 730 seq_puts(seq, "promotion[--] ");
731 seq_printf(seq, "promotion[C%zd] ", 731
732 (pr->power.states[i].promotion.state - 732 seq_puts(seq, "demotion[--] ");
733 pr->power.states));
734 else
735 seq_puts(seq, "promotion[--] ");
736
737 if (pr->power.states[i].demotion.state)
738 seq_printf(seq, "demotion[C%zd] ",
739 (pr->power.states[i].demotion.state -
740 pr->power.states));
741 else
742 seq_puts(seq, "demotion[--] ");
743 733
744 seq_printf(seq, "latency[%03d] usage[%08d] duration[%020llu]\n", 734 seq_printf(seq, "latency[%03d] usage[%08d] duration[%020llu]\n",
745 pr->power.states[i].latency, 735 pr->power.states[i].latency,
@@ -869,6 +859,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
869 struct acpi_processor *pr; 859 struct acpi_processor *pr;
870 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 860 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
871 ktime_t kt1, kt2; 861 ktime_t kt1, kt2;
862 s64 idle_time_ns;
872 s64 idle_time; 863 s64 idle_time;
873 s64 sleep_ticks = 0; 864 s64 sleep_ticks = 0;
874 865
@@ -910,12 +901,14 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
910 sched_clock_idle_sleep_event(); 901 sched_clock_idle_sleep_event();
911 acpi_idle_do_entry(cx); 902 acpi_idle_do_entry(cx);
912 kt2 = ktime_get_real(); 903 kt2 = ktime_get_real();
913 idle_time = ktime_to_us(ktime_sub(kt2, kt1)); 904 idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
905 idle_time = idle_time_ns;
906 do_div(idle_time, NSEC_PER_USEC);
914 907
915 sleep_ticks = us_to_pm_timer_ticks(idle_time); 908 sleep_ticks = us_to_pm_timer_ticks(idle_time);
916 909
917 /* Tell the scheduler how much we idled: */ 910 /* Tell the scheduler how much we idled: */
918 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); 911 sched_clock_idle_wakeup_event(idle_time_ns);
919 912
920 local_irq_enable(); 913 local_irq_enable();
921 current_thread_info()->status |= TS_POLLING; 914 current_thread_info()->status |= TS_POLLING;
@@ -943,6 +936,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
943 struct acpi_processor *pr; 936 struct acpi_processor *pr;
944 struct acpi_processor_cx *cx = cpuidle_get_statedata(state); 937 struct acpi_processor_cx *cx = cpuidle_get_statedata(state);
945 ktime_t kt1, kt2; 938 ktime_t kt1, kt2;
939 s64 idle_time_ns;
946 s64 idle_time; 940 s64 idle_time;
947 s64 sleep_ticks = 0; 941 s64 sleep_ticks = 0;
948 942
@@ -1025,11 +1019,13 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1025 spin_unlock(&c3_lock); 1019 spin_unlock(&c3_lock);
1026 } 1020 }
1027 kt2 = ktime_get_real(); 1021 kt2 = ktime_get_real();
1028 idle_time = ktime_to_us(ktime_sub(kt2, kt1)); 1022 idle_time_ns = ktime_to_us(ktime_sub(kt2, kt1));
1023 idle_time = idle_time_ns;
1024 do_div(idle_time, NSEC_PER_USEC);
1029 1025
1030 sleep_ticks = us_to_pm_timer_ticks(idle_time); 1026 sleep_ticks = us_to_pm_timer_ticks(idle_time);
1031 /* Tell the scheduler how much we idled: */ 1027 /* Tell the scheduler how much we idled: */
1032 sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); 1028 sched_clock_idle_wakeup_event(idle_time_ns);
1033 1029
1034 local_irq_enable(); 1030 local_irq_enable();
1035 current_thread_info()->status |= TS_POLLING; 1031 current_thread_info()->status |= TS_POLLING;
diff --git a/drivers/acpi/sleep.h b/drivers/acpi/sleep.h
index 8a8f3b3382a6..25b8bd149284 100644
--- a/drivers/acpi/sleep.h
+++ b/drivers/acpi/sleep.h
@@ -1,6 +1,6 @@
1 1
2extern u8 sleep_states[]; 2extern u8 sleep_states[];
3extern int acpi_suspend (u32 state); 3extern int acpi_suspend(u32 state);
4 4
5extern void acpi_enable_wakeup_device_prep(u8 sleep_state); 5extern void acpi_enable_wakeup_device_prep(u8 sleep_state);
6extern void acpi_enable_wakeup_device(u8 sleep_state); 6extern void acpi_enable_wakeup_device(u8 sleep_state);
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 4b8bda1154db..9865d46f49a8 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -1003,11 +1003,11 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
1003 result = acpi_video_init_brightness(device); 1003 result = acpi_video_init_brightness(device);
1004 if (result) 1004 if (result)
1005 return; 1005 return;
1006 name = kzalloc(MAX_NAME_LEN, GFP_KERNEL); 1006 name = kasprintf(GFP_KERNEL, "acpi_video%d", count);
1007 if (!name) 1007 if (!name)
1008 return; 1008 return;
1009 count++;
1009 1010
1010 sprintf(name, "acpi_video%d", count++);
1011 memset(&props, 0, sizeof(struct backlight_properties)); 1011 memset(&props, 0, sizeof(struct backlight_properties));
1012 props.max_brightness = device->brightness->count - 3; 1012 props.max_brightness = device->brightness->count - 3;
1013 device->backlight = backlight_device_register(name, NULL, device, 1013 device->backlight = backlight_device_register(name, NULL, device,
@@ -1063,10 +1063,10 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
1063 if (device->cap._DCS && device->cap._DSS) { 1063 if (device->cap._DCS && device->cap._DSS) {
1064 static int count; 1064 static int count;
1065 char *name; 1065 char *name;
1066 name = kzalloc(MAX_NAME_LEN, GFP_KERNEL); 1066 name = kasprintf(GFP_KERNEL, "acpi_video%d", count);
1067 if (!name) 1067 if (!name)
1068 return; 1068 return;
1069 sprintf(name, "acpi_video%d", count++); 1069 count++;
1070 device->output_dev = video_output_register(name, 1070 device->output_dev = video_output_register(name,
1071 NULL, device, &acpi_output_properties); 1071 NULL, device, &acpi_output_properties);
1072 kfree(name); 1072 kfree(name);