aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds2013-01-07 18:17:18 -0600
committerLinus Torvalds2013-01-07 18:17:18 -0600
commit2a893f91f57314c593f36cee689ad6e353af9daf (patch)
tree6c8287371612ddc9070991cd5c6b6c011c7d5dc1
parent127aa93066261c2b8f03cb38e7165de8cd71736e (diff)
parentf67ffa95836b31be5d8fe336aee3bfc6412c5696 (diff)
downloadkernel-omap-2a893f91f57314c593f36cee689ad6e353af9daf.tar.gz
kernel-omap-2a893f91f57314c593f36cee689ad6e353af9daf.tar.xz
kernel-omap-2a893f91f57314c593f36cee689ad6e353af9daf.zip
Merge tag 'pm+acpi-for-3.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI and power management fixes from Rafael Wysocki: - Removal of some ACPICA code that the kernel will never use from Lv Zheng. - APEI fix from Adrian Huang. - Removal of unnecessary ACPI memory hotplug driver code from Liu Jinsong. - Minor ACPI power management fixes. - ACPI debug code fix from Joe Perches. - ACPI fix to make system bus device nodes get the right names. - PNP resources handling fixes from Witold Szczeponik. - cpuidle fix for a recent regression stalling boot on systems with great numbers of CPUs from Daniel Lezcano. - cpuidle fixes from Sivaram Nair. - intel_idle debug message fix from Youquan Song. - cpufreq build regression fix from Larry Finger. - cpufreq fix for an obscure initialization race related to statistics from Konstantin Khlebnikov. - cpufreq change disabling the Longhaul driver by default from RafaƂ Bilski. - PM core fix preventing device suspend errors from happening during system suspend due to obscure race conditions. - PM QoS local variable name cleanup. * tag 'pm+acpi-for-3.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: PM: Move disabling/enabling runtime PM to late suspend/early resume PM / QoS: Rename local variable in dev_pm_qos_add_ancestor_request() ACPI / scan: Do not use dummy HID for system bus ACPI nodes cpufreq / governor: Fix problem with cpufreq_ondemand or cpufreq_conservative cpufreq / Longhaul: Disable driver by default cpufreq / stats: fix race between stats allocation and first usage cpuidle: fix lock contention in the idle path intel_idle: pr_debug information need separated cpuidle / coupled: fix ready counter decrement cpuidle: Fix finding state with min power_usage PNP: Handle IORESOURCE_BITS in resource allocation PNP: Simplify setting of resources ACPI / power: Remove useless message from device registering routine ACPI / glue: Update DBG macro to include KERN_DEBUG ACPI / PM: Do not apply ACPI_SUCCESS() to acpi_bus_get_device() result ACPI / memhotplug: remove redundant logic of acpi memory hotadd ACPI / APEI: Fix the returned value in erst_dbg_read ACPICA: Remove useless mini-C library.
-rw-r--r--Documentation/power/runtime_pm.txt9
-rw-r--r--drivers/acpi/acpi_memhotplug.c18
-rw-r--r--drivers/acpi/acpica/Makefile2
-rw-r--r--drivers/acpi/acpica/utclib.c749
-rw-r--r--drivers/acpi/apei/erst-dbg.c11
-rw-r--r--drivers/acpi/device_pm.c3
-rw-r--r--drivers/acpi/glue.c9
-rw-r--r--drivers/acpi/power.c11
-rw-r--r--drivers/acpi/scan.c2
-rw-r--r--drivers/base/power/main.c9
-rw-r--r--drivers/base/power/qos.c10
-rw-r--r--drivers/cpufreq/Kconfig5
-rw-r--r--drivers/cpufreq/Makefile5
-rw-r--r--drivers/cpufreq/cpufreq_stats.c11
-rw-r--r--drivers/cpufreq/longhaul.c10
-rw-r--r--drivers/cpuidle/coupled.c2
-rw-r--r--drivers/cpuidle/cpuidle.c2
-rw-r--r--drivers/cpuidle/driver.c8
-rw-r--r--drivers/cpuidle/governors/menu.c2
-rw-r--r--drivers/idle/intel_idle.c2
-rw-r--r--drivers/pnp/interface.c105
-rw-r--r--drivers/pnp/manager.c25
22 files changed, 154 insertions, 856 deletions
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt
index 4abe83e1045a..03591a750f99 100644
--- a/Documentation/power/runtime_pm.txt
+++ b/Documentation/power/runtime_pm.txt
@@ -642,12 +642,13 @@ out the following operations:
642 * During system suspend it calls pm_runtime_get_noresume() and 642 * During system suspend it calls pm_runtime_get_noresume() and
643 pm_runtime_barrier() for every device right before executing the 643 pm_runtime_barrier() for every device right before executing the
644 subsystem-level .suspend() callback for it. In addition to that it calls 644 subsystem-level .suspend() callback for it. In addition to that it calls
645 pm_runtime_disable() for every device right after executing the 645 __pm_runtime_disable() with 'false' as the second argument for every device
646 subsystem-level .suspend() callback for it. 646 right before executing the subsystem-level .suspend_late() callback for it.
647 647
648 * During system resume it calls pm_runtime_enable() and pm_runtime_put_sync() 648 * During system resume it calls pm_runtime_enable() and pm_runtime_put_sync()
649 for every device right before and right after executing the subsystem-level 649 for every device right after executing the subsystem-level .resume_early()
650 .resume() callback for it, respectively. 650 callback and right after executing the subsystem-level .resume() callback
651 for it, respectively.
651 652
6527. Generic subsystem callbacks 6537. Generic subsystem callbacks
653 654
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index eb30e5ab4cab..b679bf8478f7 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -226,16 +226,6 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
226 struct acpi_memory_info *info; 226 struct acpi_memory_info *info;
227 int node; 227 int node;
228 228
229
230 /* Get the range from the _CRS */
231 result = acpi_memory_get_device_resources(mem_device);
232 if (result) {
233 dev_err(&mem_device->device->dev,
234 "get_device_resources failed\n");
235 mem_device->state = MEMORY_INVALID_STATE;
236 return result;
237 }
238
239 node = acpi_get_node(mem_device->device->handle); 229 node = acpi_get_node(mem_device->device->handle);
240 /* 230 /*
241 * Tell the VM there is more memory here... 231 * Tell the VM there is more memory here...
@@ -342,14 +332,6 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
342 break; 332 break;
343 } 333 }
344 334
345 if (acpi_memory_check_device(mem_device))
346 break;
347
348 if (acpi_memory_enable_device(mem_device)) {
349 acpi_handle_err(handle,"Cannot enable memory device\n");
350 break;
351 }
352
353 ost_code = ACPI_OST_SC_SUCCESS; 335 ost_code = ACPI_OST_SC_SUCCESS;
354 break; 336 break;
355 337
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile
index c8bc24bd1f72..bc7a03ded064 100644
--- a/drivers/acpi/acpica/Makefile
+++ b/drivers/acpi/acpica/Makefile
@@ -162,5 +162,5 @@ acpi-y += \
162 utxferror.o \ 162 utxferror.o \
163 utxfmutex.o 163 utxfmutex.o
164 164
165acpi-$(ACPI_FUTURE_USAGE) += uttrack.o utcache.o utclib.o 165acpi-$(ACPI_FUTURE_USAGE) += uttrack.o utcache.o
166 166
diff --git a/drivers/acpi/acpica/utclib.c b/drivers/acpi/acpica/utclib.c
deleted file mode 100644
index 19ea4755aa73..000000000000
--- a/drivers/acpi/acpica/utclib.c
+++ /dev/null
@@ -1,749 +0,0 @@
1/******************************************************************************
2 *
3 * Module Name: cmclib - Local implementation of C library functions
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#include <acpi/acpi.h>
45#include "accommon.h"
46
47/*
48 * These implementations of standard C Library routines can optionally be
49 * used if a C library is not available. In general, they are less efficient
50 * than an inline or assembly implementation
51 */
52
53#define _COMPONENT ACPI_UTILITIES
54ACPI_MODULE_NAME("cmclib")
55
56#ifndef ACPI_USE_SYSTEM_CLIBRARY
57#define NEGATIVE 1
58#define POSITIVE 0
59/*******************************************************************************
60 *
61 * FUNCTION: acpi_ut_memcmp (memcmp)
62 *
63 * PARAMETERS: buffer1 - First Buffer
64 * buffer2 - Second Buffer
65 * count - Maximum # of bytes to compare
66 *
67 * RETURN: Index where Buffers mismatched, or 0 if Buffers matched
68 *
69 * DESCRIPTION: Compare two Buffers, with a maximum length
70 *
71 ******************************************************************************/
72int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count)
73{
74
75 return ((count == ACPI_SIZE_MAX) ? 0 : ((unsigned char)*buffer1 -
76 (unsigned char)*buffer2));
77}
78
79/*******************************************************************************
80 *
81 * FUNCTION: acpi_ut_memcpy (memcpy)
82 *
83 * PARAMETERS: dest - Target of the copy
84 * src - Source buffer to copy
85 * count - Number of bytes to copy
86 *
87 * RETURN: Dest
88 *
89 * DESCRIPTION: Copy arbitrary bytes of memory
90 *
91 ******************************************************************************/
92
93void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count)
94{
95 char *new = (char *)dest;
96 char *old = (char *)src;
97
98 while (count) {
99 *new = *old;
100 new++;
101 old++;
102 count--;
103 }
104
105 return (dest);
106}
107
108/*******************************************************************************
109 *
110 * FUNCTION: acpi_ut_memset (memset)
111 *
112 * PARAMETERS: dest - Buffer to set
113 * value - Value to set each byte of memory
114 * count - Number of bytes to set
115 *
116 * RETURN: Dest
117 *
118 * DESCRIPTION: Initialize a buffer to a known value.
119 *
120 ******************************************************************************/
121
122void *acpi_ut_memset(void *dest, u8 value, acpi_size count)
123{
124 char *new = (char *)dest;
125
126 while (count) {
127 *new = (char)value;
128 new++;
129 count--;
130 }
131
132 return (dest);
133}
134
135/*******************************************************************************
136 *
137 * FUNCTION: acpi_ut_strlen (strlen)
138 *
139 * PARAMETERS: string - Null terminated string
140 *
141 * RETURN: Length
142 *
143 * DESCRIPTION: Returns the length of the input string
144 *
145 ******************************************************************************/
146
147acpi_size acpi_ut_strlen(const char *string)
148{
149 u32 length = 0;
150
151 /* Count the string until a null is encountered */
152
153 while (*string) {
154 length++;
155 string++;
156 }
157
158 return (length);
159}
160
161/*******************************************************************************
162 *
163 * FUNCTION: acpi_ut_strcpy (strcpy)
164 *
165 * PARAMETERS: dst_string - Target of the copy
166 * src_string - The source string to copy
167 *
168 * RETURN: dst_string
169 *
170 * DESCRIPTION: Copy a null terminated string
171 *
172 ******************************************************************************/
173
174char *acpi_ut_strcpy(char *dst_string, const char *src_string)
175{
176 char *string = dst_string;
177
178 /* Move bytes brute force */
179
180 while (*src_string) {
181 *string = *src_string;
182
183 string++;
184 src_string++;
185 }
186
187 /* Null terminate */
188
189 *string = 0;
190 return (dst_string);
191}
192
193/*******************************************************************************
194 *
195 * FUNCTION: acpi_ut_strncpy (strncpy)
196 *
197 * PARAMETERS: dst_string - Target of the copy
198 * src_string - The source string to copy
199 * count - Maximum # of bytes to copy
200 *
201 * RETURN: dst_string
202 *
203 * DESCRIPTION: Copy a null terminated string, with a maximum length
204 *
205 ******************************************************************************/
206
207char *acpi_ut_strncpy(char *dst_string, const char *src_string, acpi_size count)
208{
209 char *string = dst_string;
210
211 /* Copy the string */
212
213 for (string = dst_string;
214 count && (count--, (*string++ = *src_string++));) {;
215 }
216
217 /* Pad with nulls if necessary */
218
219 while (count--) {
220 *string = 0;
221 string++;
222 }
223
224 /* Return original pointer */
225
226 return (dst_string);
227}
228
229/*******************************************************************************
230 *
231 * FUNCTION: acpi_ut_strcmp (strcmp)
232 *
233 * PARAMETERS: string1 - First string
234 * string2 - Second string
235 *
236 * RETURN: Index where strings mismatched, or 0 if strings matched
237 *
238 * DESCRIPTION: Compare two null terminated strings
239 *
240 ******************************************************************************/
241
242int acpi_ut_strcmp(const char *string1, const char *string2)
243{
244
245 for (; (*string1 == *string2); string2++) {
246 if (!*string1++) {
247 return (0);
248 }
249 }
250
251 return ((unsigned char)*string1 - (unsigned char)*string2);
252}
253
254#ifdef ACPI_FUTURE_IMPLEMENTATION
255/* Not used at this time */
256/*******************************************************************************
257 *
258 * FUNCTION: acpi_ut_strchr (strchr)
259 *
260 * PARAMETERS: string - Search string
261 * ch - character to search for
262 *
263 * RETURN: Ptr to char or NULL if not found
264 *
265 * DESCRIPTION: Search a string for a character
266 *
267 ******************************************************************************/
268
269char *acpi_ut_strchr(const char *string, int ch)
270{
271
272 for (; (*string); string++) {
273 if ((*string) == (char)ch) {
274 return ((char *)string);
275 }
276 }
277
278 return (NULL);
279}
280#endif
281
282/*******************************************************************************
283 *
284 * FUNCTION: acpi_ut_strncmp (strncmp)
285 *
286 * PARAMETERS: string1 - First string
287 * string2 - Second string
288 * count - Maximum # of bytes to compare
289 *
290 * RETURN: Index where strings mismatched, or 0 if strings matched
291 *
292 * DESCRIPTION: Compare two null terminated strings, with a maximum length
293 *
294 ******************************************************************************/
295
296int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count)
297{
298
299 for (; count-- && (*string1 == *string2); string2++) {
300 if (!*string1++) {
301 return (0);
302 }
303 }
304
305 return ((count == ACPI_SIZE_MAX) ? 0 : ((unsigned char)*string1 -
306 (unsigned char)*string2));
307}
308
309/*******************************************************************************
310 *
311 * FUNCTION: acpi_ut_strcat (Strcat)
312 *
313 * PARAMETERS: dst_string - Target of the copy
314 * src_string - The source string to copy
315 *
316 * RETURN: dst_string
317 *
318 * DESCRIPTION: Append a null terminated string to a null terminated string
319 *
320 ******************************************************************************/
321
322char *acpi_ut_strcat(char *dst_string, const char *src_string)
323{
324 char *string;
325
326 /* Find end of the destination string */
327
328 for (string = dst_string; *string++;) {;
329 }
330
331 /* Concatenate the string */
332
333 for (--string; (*string++ = *src_string++);) {;
334 }
335
336 return (dst_string);
337}
338
339/*******************************************************************************
340 *
341 * FUNCTION: acpi_ut_strncat (strncat)
342 *
343 * PARAMETERS: dst_string - Target of the copy
344 * src_string - The source string to copy
345 * count - Maximum # of bytes to copy
346 *
347 * RETURN: dst_string
348 *
349 * DESCRIPTION: Append a null terminated string to a null terminated string,
350 * with a maximum count.
351 *
352 ******************************************************************************/
353
354char *acpi_ut_strncat(char *dst_string, const char *src_string, acpi_size count)
355{
356 char *string;
357
358 if (count) {
359
360 /* Find end of the destination string */
361
362 for (string = dst_string; *string++;) {;
363 }
364
365 /* Concatenate the string */
366
367 for (--string; (*string++ = *src_string++) && --count;) {;
368 }
369
370 /* Null terminate if necessary */
371
372 if (!count) {
373 *string = 0;
374 }
375 }
376
377 return (dst_string);
378}
379
380/*******************************************************************************
381 *
382 * FUNCTION: acpi_ut_strstr (strstr)
383 *
384 * PARAMETERS: string1 - Target string
385 * string2 - Substring to search for
386 *
387 * RETURN: Where substring match starts, Null if no match found
388 *
389 * DESCRIPTION: Checks if String2 occurs in String1. This is not really a
390 * full implementation of strstr, only sufficient for command
391 * matching
392 *
393 ******************************************************************************/
394
395char *acpi_ut_strstr(char *string1, char *string2)
396{
397 char *string;
398
399 if (acpi_ut_strlen(string2) > acpi_ut_strlen(string1)) {
400 return (NULL);
401 }
402
403 /* Walk entire string, comparing the letters */
404
405 for (string = string1; *string2;) {
406 if (*string2 != *string) {
407 return (NULL);
408 }
409
410 string2++;
411 string++;
412 }
413
414 return (string1);
415}
416
417/*******************************************************************************
418 *
419 * FUNCTION: acpi_ut_strtoul (strtoul)
420 *
421 * PARAMETERS: string - Null terminated string
422 * terminater - Where a pointer to the terminating byte is
423 * returned
424 * base - Radix of the string
425 *
426 * RETURN: Converted value
427 *
428 * DESCRIPTION: Convert a string into a 32-bit unsigned value.
429 * Note: use acpi_ut_strtoul64 for 64-bit integers.
430 *
431 ******************************************************************************/
432
433u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base)
434{
435 u32 converted = 0;
436 u32 index;
437 u32 sign;
438 const char *string_start;
439 u32 return_value = 0;
440 acpi_status status = AE_OK;
441
442 /*
443 * Save the value of the pointer to the buffer's first
444 * character, save the current errno value, and then
445 * skip over any white space in the buffer:
446 */
447 string_start = string;
448 while (ACPI_IS_SPACE(*string) || *string == '\t') {
449 ++string;
450 }
451
452 /*
453 * The buffer may contain an optional plus or minus sign.
454 * If it does, then skip over it but remember what is was:
455 */
456 if (*string == '-') {
457 sign = NEGATIVE;
458 ++string;
459 } else if (*string == '+') {
460 ++string;
461 sign = POSITIVE;
462 } else {
463 sign = POSITIVE;
464 }
465
466 /*
467 * If the input parameter Base is zero, then we need to
468 * determine if it is octal, decimal, or hexadecimal:
469 */
470 if (base == 0) {
471 if (*string == '0') {
472 if (acpi_ut_to_lower(*(++string)) == 'x') {
473 base = 16;
474 ++string;
475 } else {
476 base = 8;
477 }
478 } else {
479 base = 10;
480 }
481 } else if (base < 2 || base > 36) {
482 /*
483 * The specified Base parameter is not in the domain of
484 * this function:
485 */
486 goto done;
487 }
488
489 /*
490 * For octal and hexadecimal bases, skip over the leading
491 * 0 or 0x, if they are present.
492 */
493 if (base == 8 && *string == '0') {
494 string++;
495 }
496
497 if (base == 16 &&
498 *string == '0' && acpi_ut_to_lower(*(++string)) == 'x') {
499 string++;
500 }
501
502 /*
503 * Main loop: convert the string to an unsigned long:
504 */
505 while (*string) {
506 if (ACPI_IS_DIGIT(*string)) {
507 index = (u32)((u8)*string - '0');
508 } else {
509 index = (u32)acpi_ut_to_upper(*string);
510 if (ACPI_IS_UPPER(index)) {
511 index = index - 'A' + 10;
512 } else {
513 goto done;
514 }
515 }
516
517 if (index >= base) {
518 goto done;
519 }
520
521 /*
522 * Check to see if value is out of range:
523 */
524
525 if (return_value > ((ACPI_UINT32_MAX - (u32)index) / (u32)base)) {
526 status = AE_ERROR;
527 return_value = 0; /* reset */
528 } else {
529 return_value *= base;
530 return_value += index;
531 converted = 1;
532 }
533
534 ++string;
535 }
536
537 done:
538 /*
539 * If appropriate, update the caller's pointer to the next
540 * unconverted character in the buffer.
541 */
542 if (terminator) {
543 if (converted == 0 && return_value == 0 && string != NULL) {
544 *terminator = (char *)string_start;
545 } else {
546 *terminator = (char *)string;
547 }
548 }
549
550 if (status == AE_ERROR) {
551 return_value = ACPI_UINT32_MAX;
552 }
553
554 /*
555 * If a minus sign was present, then "the conversion is negated":
556 */
557 if (sign == NEGATIVE) {
558 return_value = (ACPI_UINT32_MAX - return_value) + 1;
559 }
560
561 return (return_value);
562}
563
564/*******************************************************************************
565 *
566 * FUNCTION: acpi_ut_to_upper (TOUPPER)
567 *
568 * PARAMETERS: c - Character to convert
569 *
570 * RETURN: Converted character as an int
571 *
572 * DESCRIPTION: Convert character to uppercase
573 *
574 ******************************************************************************/
575
576int acpi_ut_to_upper(int c)
577{
578
579 return (ACPI_IS_LOWER(c) ? ((c) - 0x20) : (c));
580}
581
582/*******************************************************************************
583 *
584 * FUNCTION: acpi_ut_to_lower (TOLOWER)
585 *
586 * PARAMETERS: c - Character to convert
587 *
588 * RETURN: Converted character as an int
589 *
590 * DESCRIPTION: Convert character to lowercase
591 *
592 ******************************************************************************/
593
594int acpi_ut_to_lower(int c)
595{
596
597 return (ACPI_IS_UPPER(c) ? ((c) + 0x20) : (c));
598}
599
600/*******************************************************************************
601 *
602 * FUNCTION: is* functions
603 *
604 * DESCRIPTION: is* functions use the ctype table below
605 *
606 ******************************************************************************/
607
608const u8 _acpi_ctype[257] = {
609 _ACPI_CN, /* 0x00 0 NUL */
610 _ACPI_CN, /* 0x01 1 SOH */
611 _ACPI_CN, /* 0x02 2 STX */
612 _ACPI_CN, /* 0x03 3 ETX */
613 _ACPI_CN, /* 0x04 4 EOT */
614 _ACPI_CN, /* 0x05 5 ENQ */
615 _ACPI_CN, /* 0x06 6 ACK */
616 _ACPI_CN, /* 0x07 7 BEL */
617 _ACPI_CN, /* 0x08 8 BS */
618 _ACPI_CN | _ACPI_SP, /* 0x09 9 TAB */
619 _ACPI_CN | _ACPI_SP, /* 0x0A 10 LF */
620 _ACPI_CN | _ACPI_SP, /* 0x0B 11 VT */
621 _ACPI_CN | _ACPI_SP, /* 0x0C 12 FF */
622 _ACPI_CN | _ACPI_SP, /* 0x0D 13 CR */
623 _ACPI_CN, /* 0x0E 14 SO */
624 _ACPI_CN, /* 0x0F 15 SI */
625 _ACPI_CN, /* 0x10 16 DLE */
626 _ACPI_CN, /* 0x11 17 DC1 */
627 _ACPI_CN, /* 0x12 18 DC2 */
628 _ACPI_CN, /* 0x13 19 DC3 */
629 _ACPI_CN, /* 0x14 20 DC4 */
630 _ACPI_CN, /* 0x15 21 NAK */
631 _ACPI_CN, /* 0x16 22 SYN */
632 _ACPI_CN, /* 0x17 23 ETB */
633 _ACPI_CN, /* 0x18 24 CAN */
634 _ACPI_CN, /* 0x19 25 EM */
635 _ACPI_CN, /* 0x1A 26 SUB */
636 _ACPI_CN, /* 0x1B 27 ESC */
637 _ACPI_CN, /* 0x1C 28 FS */
638 _ACPI_CN, /* 0x1D 29 GS */
639 _ACPI_CN, /* 0x1E 30 RS */
640 _ACPI_CN, /* 0x1F 31 US */
641 _ACPI_XS | _ACPI_SP, /* 0x20 32 ' ' */
642 _ACPI_PU, /* 0x21 33 '!' */
643 _ACPI_PU, /* 0x22 34 '"' */
644 _ACPI_PU, /* 0x23 35 '#' */
645 _ACPI_PU, /* 0x24 36 '$' */
646 _ACPI_PU, /* 0x25 37 '%' */
647 _ACPI_PU, /* 0x26 38 '&' */
648 _ACPI_PU, /* 0x27 39 ''' */
649 _ACPI_PU, /* 0x28 40 '(' */
650 _ACPI_PU, /* 0x29 41 ')' */
651 _ACPI_PU, /* 0x2A 42 '*' */
652 _ACPI_PU, /* 0x2B 43 '+' */
653 _ACPI_PU, /* 0x2C 44 ',' */
654 _ACPI_PU, /* 0x2D 45 '-' */
655 _ACPI_PU, /* 0x2E 46 '.' */
656 _ACPI_PU, /* 0x2F 47 '/' */
657 _ACPI_XD | _ACPI_DI, /* 0x30 48 '0' */
658 _ACPI_XD | _ACPI_DI, /* 0x31 49 '1' */
659 _ACPI_XD | _ACPI_DI, /* 0x32 50 '2' */
660 _ACPI_XD | _ACPI_DI, /* 0x33 51 '3' */
661 _ACPI_XD | _ACPI_DI, /* 0x34 52 '4' */
662 _ACPI_XD | _ACPI_DI, /* 0x35 53 '5' */
663 _ACPI_XD | _ACPI_DI, /* 0x36 54 '6' */
664 _ACPI_XD | _ACPI_DI, /* 0x37 55 '7' */
665 _ACPI_XD | _ACPI_DI, /* 0x38 56 '8' */
666 _ACPI_XD | _ACPI_DI, /* 0x39 57 '9' */
667 _ACPI_PU, /* 0x3A 58 ':' */
668 _ACPI_PU, /* 0x3B 59 ';' */
669 _ACPI_PU, /* 0x3C 60 '<' */
670 _ACPI_PU, /* 0x3D 61 '=' */
671 _ACPI_PU, /* 0x3E 62 '>' */
672 _ACPI_PU, /* 0x3F 63 '?' */
673 _ACPI_PU, /* 0x40 64 '@' */
674 _ACPI_XD | _ACPI_UP, /* 0x41 65 'A' */
675 _ACPI_XD | _ACPI_UP, /* 0x42 66 'B' */
676 _ACPI_XD | _ACPI_UP, /* 0x43 67 'C' */
677 _ACPI_XD | _ACPI_UP, /* 0x44 68 'D' */
678 _ACPI_XD | _ACPI_UP, /* 0x45 69 'E' */
679 _ACPI_XD | _ACPI_UP, /* 0x46 70 'F' */
680 _ACPI_UP, /* 0x47 71 'G' */
681 _ACPI_UP, /* 0x48 72 'H' */
682 _ACPI_UP, /* 0x49 73 'I' */
683 _ACPI_UP, /* 0x4A 74 'J' */
684 _ACPI_UP, /* 0x4B 75 'K' */
685 _ACPI_UP, /* 0x4C 76 'L' */
686 _ACPI_UP, /* 0x4D 77 'M' */
687 _ACPI_UP, /* 0x4E 78 'N' */
688 _ACPI_UP, /* 0x4F 79 'O' */
689 _ACPI_UP, /* 0x50 80 'P' */
690 _ACPI_UP, /* 0x51 81 'Q' */
691 _ACPI_UP, /* 0x52 82 'R' */
692 _ACPI_UP, /* 0x53 83 'S' */
693 _ACPI_UP, /* 0x54 84 'T' */
694 _ACPI_UP, /* 0x55 85 'U' */
695 _ACPI_UP, /* 0x56 86 'V' */
696 _ACPI_UP, /* 0x57 87 'W' */
697 _ACPI_UP, /* 0x58 88 'X' */
698 _ACPI_UP, /* 0x59 89 'Y' */
699 _ACPI_UP, /* 0x5A 90 'Z' */
700 _ACPI_PU, /* 0x5B 91 '[' */
701 _ACPI_PU, /* 0x5C 92 '\' */
702 _ACPI_PU, /* 0x5D 93 ']' */
703 _ACPI_PU, /* 0x5E 94 '^' */
704 _ACPI_PU, /* 0x5F 95 '_' */
705 _ACPI_PU, /* 0x60 96 '`' */
706 _ACPI_XD | _ACPI_LO, /* 0x61 97 'a' */
707 _ACPI_XD | _ACPI_LO, /* 0x62 98 'b' */
708 _ACPI_XD | _ACPI_LO, /* 0x63 99 'c' */
709 _ACPI_XD | _ACPI_LO, /* 0x64 100 'd' */
710 _ACPI_XD | _ACPI_LO, /* 0x65 101 'e' */
711 _ACPI_XD | _ACPI_LO, /* 0x66 102 'f' */
712 _ACPI_LO, /* 0x67 103 'g' */
713 _ACPI_LO, /* 0x68 104 'h' */
714 _ACPI_LO, /* 0x69 105 'i' */
715 _ACPI_LO, /* 0x6A 106 'j' */
716 _ACPI_LO, /* 0x6B 107 'k' */
717 _ACPI_LO, /* 0x6C 108 'l' */
718 _ACPI_LO, /* 0x6D 109 'm' */
719 _ACPI_LO, /* 0x6E 110 'n' */
720 _ACPI_LO, /* 0x6F 111 'o' */
721 _ACPI_LO, /* 0x70 112 'p' */
722 _ACPI_LO, /* 0x71 113 'q' */
723 _ACPI_LO, /* 0x72 114 'r' */
724 _ACPI_LO, /* 0x73 115 's' */
725 _ACPI_LO, /* 0x74 116 't' */
726 _ACPI_LO, /* 0x75 117 'u' */
727 _ACPI_LO, /* 0x76 118 'v' */
728 _ACPI_LO, /* 0x77 119 'w' */
729 _ACPI_LO, /* 0x78 120 'x' */
730 _ACPI_LO, /* 0x79 121 'y' */
731 _ACPI_LO, /* 0x7A 122 'z' */
732 _ACPI_PU, /* 0x7B 123 '{' */
733 _ACPI_PU, /* 0x7C 124 '|' */
734 _ACPI_PU, /* 0x7D 125 '}' */
735 _ACPI_PU, /* 0x7E 126 '~' */
736 _ACPI_CN, /* 0x7F 127 DEL */
737
738 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 to 0x8F */
739 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 to 0x9F */
740 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 to 0xAF */
741 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 to 0xBF */
742 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 to 0xCF */
743 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 to 0xDF */
744 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 to 0xEF */
745 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xF0 to 0xFF */
746 0 /* 0x100 */
747};
748
749#endif /* ACPI_USE_SYSTEM_CLIBRARY */
diff --git a/drivers/acpi/apei/erst-dbg.c b/drivers/acpi/apei/erst-dbg.c
index 903549df809b..04ab5c9d3ced 100644
--- a/drivers/acpi/apei/erst-dbg.c
+++ b/drivers/acpi/apei/erst-dbg.c
@@ -111,8 +111,17 @@ retry_next:
111 if (rc) 111 if (rc)
112 goto out; 112 goto out;
113 /* no more record */ 113 /* no more record */
114 if (id == APEI_ERST_INVALID_RECORD_ID) 114 if (id == APEI_ERST_INVALID_RECORD_ID) {
115 /*
116 * If the persistent store is empty initially, the function
117 * 'erst_read' below will return "-ENOENT" value. This causes
118 * 'retry_next' label is entered again. The returned value
119 * should be zero indicating the read operation is EOF.
120 */
121 len = 0;
122
115 goto out; 123 goto out;
124 }
116retry: 125retry:
117 rc = len = erst_read(id, erst_dbg_buf, erst_dbg_buf_len); 126 rc = len = erst_read(id, erst_dbg_buf, erst_dbg_buf_len);
118 /* The record may be cleared by others, try read next record */ 127 /* The record may be cleared by others, try read next record */
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index f09dc987cf17..c6ff606c6d5b 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -358,8 +358,7 @@ static struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
358 acpi_handle handle = DEVICE_ACPI_HANDLE(dev); 358 acpi_handle handle = DEVICE_ACPI_HANDLE(dev);
359 struct acpi_device *adev; 359 struct acpi_device *adev;
360 360
361 return handle && ACPI_SUCCESS(acpi_bus_get_device(handle, &adev)) ? 361 return handle && !acpi_bus_get_device(handle, &adev) ? adev : NULL;
362 adev : NULL;
363} 362}
364 363
365/** 364/**
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 01551840d236..95af6f674a6c 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -18,9 +18,14 @@
18 18
19#define ACPI_GLUE_DEBUG 0 19#define ACPI_GLUE_DEBUG 0
20#if ACPI_GLUE_DEBUG 20#if ACPI_GLUE_DEBUG
21#define DBG(x...) printk(PREFIX x) 21#define DBG(fmt, ...) \
22 printk(KERN_DEBUG PREFIX fmt, ##__VA_ARGS__)
22#else 23#else
23#define DBG(x...) do { } while(0) 24#define DBG(fmt, ...) \
25do { \
26 if (0) \
27 printk(KERN_DEBUG PREFIX fmt, ##__VA_ARGS__); \
28} while (0)
24#endif 29#endif
25static LIST_HEAD(bus_type_list); 30static LIST_HEAD(bus_type_list);
26static DECLARE_RWSEM(bus_type_sem); 31static DECLARE_RWSEM(bus_type_sem);
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 7db61b8fa11f..6e7b9d523812 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -445,11 +445,8 @@ int acpi_power_resource_register_device(struct device *dev, acpi_handle handle)
445 return -ENODEV; 445 return -ENODEV;
446 446
447 ret = acpi_bus_get_device(handle, &acpi_dev); 447 ret = acpi_bus_get_device(handle, &acpi_dev);
448 if (ret) 448 if (ret || !acpi_dev->power.flags.power_resources)
449 goto no_power_resource; 449 return -ENODEV;
450
451 if (!acpi_dev->power.flags.power_resources)
452 goto no_power_resource;
453 450
454 powered_device = kzalloc(sizeof(*powered_device), GFP_KERNEL); 451 powered_device = kzalloc(sizeof(*powered_device), GFP_KERNEL);
455 if (!powered_device) 452 if (!powered_device)
@@ -471,10 +468,6 @@ int acpi_power_resource_register_device(struct device *dev, acpi_handle handle)
471 } 468 }
472 469
473 return ret; 470 return ret;
474
475no_power_resource:
476 printk(KERN_DEBUG PREFIX "Invalid Power Resource to register!\n");
477 return -ENODEV;
478} 471}
479EXPORT_SYMBOL_GPL(acpi_power_resource_register_device); 472EXPORT_SYMBOL_GPL(acpi_power_resource_register_device);
480 473
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 53502d1bbf26..c88be6c37c30 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1346,7 +1346,7 @@ static void acpi_device_set_id(struct acpi_device *device)
1346 acpi_add_id(device, ACPI_DOCK_HID); 1346 acpi_add_id(device, ACPI_DOCK_HID);
1347 else if (!acpi_ibm_smbus_match(device)) 1347 else if (!acpi_ibm_smbus_match(device))
1348 acpi_add_id(device, ACPI_SMBUS_IBM_HID); 1348 acpi_add_id(device, ACPI_SMBUS_IBM_HID);
1349 else if (!acpi_device_hid(device) && 1349 else if (list_empty(&device->pnp.ids) &&
1350 ACPI_IS_ROOT_DEVICE(device->parent)) { 1350 ACPI_IS_ROOT_DEVICE(device->parent)) {
1351 acpi_add_id(device, ACPI_BUS_HID); /* \_SB, LNXSYBUS */ 1351 acpi_add_id(device, ACPI_BUS_HID); /* \_SB, LNXSYBUS */
1352 strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); 1352 strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME);
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index a3c1404c7933..2b7f77d3fcb0 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -513,6 +513,8 @@ static int device_resume_early(struct device *dev, pm_message_t state)
513 513
514 Out: 514 Out:
515 TRACE_RESUME(error); 515 TRACE_RESUME(error);
516
517 pm_runtime_enable(dev);
516 return error; 518 return error;
517} 519}
518 520
@@ -589,8 +591,6 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
589 if (!dev->power.is_suspended) 591 if (!dev->power.is_suspended)
590 goto Unlock; 592 goto Unlock;
591 593
592 pm_runtime_enable(dev);
593
594 if (dev->pm_domain) { 594 if (dev->pm_domain) {
595 info = "power domain "; 595 info = "power domain ";
596 callback = pm_op(&dev->pm_domain->ops, state); 596 callback = pm_op(&dev->pm_domain->ops, state);
@@ -930,6 +930,8 @@ static int device_suspend_late(struct device *dev, pm_message_t state)
930 pm_callback_t callback = NULL; 930 pm_callback_t callback = NULL;
931 char *info = NULL; 931 char *info = NULL;
932 932
933 __pm_runtime_disable(dev, false);
934
933 if (dev->power.syscore) 935 if (dev->power.syscore)
934 return 0; 936 return 0;
935 937
@@ -1133,11 +1135,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
1133 1135
1134 Complete: 1136 Complete:
1135 complete_all(&dev->power.completion); 1137 complete_all(&dev->power.completion);
1136
1137 if (error) 1138 if (error)
1138 async_error = error; 1139 async_error = error;
1139 else if (dev->power.is_suspended)
1140 __pm_runtime_disable(dev, false);
1141 1140
1142 return error; 1141 return error;
1143} 1142}
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c
index ff46387f5308..d21349544ce5 100644
--- a/drivers/base/power/qos.c
+++ b/drivers/base/power/qos.c
@@ -542,19 +542,19 @@ int dev_pm_qos_add_ancestor_request(struct device *dev,
542 struct dev_pm_qos_request *req, s32 value) 542 struct dev_pm_qos_request *req, s32 value)
543{ 543{
544 struct device *ancestor = dev->parent; 544 struct device *ancestor = dev->parent;
545 int error = -ENODEV; 545 int ret = -ENODEV;
546 546
547 while (ancestor && !ancestor->power.ignore_children) 547 while (ancestor && !ancestor->power.ignore_children)
548 ancestor = ancestor->parent; 548 ancestor = ancestor->parent;
549 549
550 if (ancestor) 550 if (ancestor)
551 error = dev_pm_qos_add_request(ancestor, req, 551 ret = dev_pm_qos_add_request(ancestor, req,
552 DEV_PM_QOS_LATENCY, value); 552 DEV_PM_QOS_LATENCY, value);
553 553
554 if (error < 0) 554 if (ret < 0)
555 req->dev = NULL; 555 req->dev = NULL;
556 556
557 return error; 557 return ret;
558} 558}
559EXPORT_SYMBOL_GPL(dev_pm_qos_add_ancestor_request); 559EXPORT_SYMBOL_GPL(dev_pm_qos_add_ancestor_request);
560 560
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index ea512f47b789..e0a899f25e37 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -20,6 +20,9 @@ if CPU_FREQ
20config CPU_FREQ_TABLE 20config CPU_FREQ_TABLE
21 tristate 21 tristate
22 22
23config CPU_FREQ_GOV_COMMON
24 bool
25
23config CPU_FREQ_STAT 26config CPU_FREQ_STAT
24 tristate "CPU frequency translation statistics" 27 tristate "CPU frequency translation statistics"
25 select CPU_FREQ_TABLE 28 select CPU_FREQ_TABLE
@@ -141,6 +144,7 @@ config CPU_FREQ_GOV_USERSPACE
141config CPU_FREQ_GOV_ONDEMAND 144config CPU_FREQ_GOV_ONDEMAND
142 tristate "'ondemand' cpufreq policy governor" 145 tristate "'ondemand' cpufreq policy governor"
143 select CPU_FREQ_TABLE 146 select CPU_FREQ_TABLE
147 select CPU_FREQ_GOV_COMMON
144 help 148 help
145 'ondemand' - This driver adds a dynamic cpufreq policy governor. 149 'ondemand' - This driver adds a dynamic cpufreq policy governor.
146 The governor does a periodic polling and 150 The governor does a periodic polling and
@@ -159,6 +163,7 @@ config CPU_FREQ_GOV_ONDEMAND
159config CPU_FREQ_GOV_CONSERVATIVE 163config CPU_FREQ_GOV_CONSERVATIVE
160 tristate "'conservative' cpufreq governor" 164 tristate "'conservative' cpufreq governor"
161 depends on CPU_FREQ 165 depends on CPU_FREQ
166 select CPU_FREQ_GOV_COMMON
162 help 167 help
163 'conservative' - this driver is rather similar to the 'ondemand' 168 'conservative' - this driver is rather similar to the 'ondemand'
164 governor both in its source code and its purpose, the difference is 169 governor both in its source code and its purpose, the difference is
diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile
index 1f254ec087c1..fadc4d496e2f 100644
--- a/drivers/cpufreq/Makefile
+++ b/drivers/cpufreq/Makefile
@@ -7,8 +7,9 @@ obj-$(CONFIG_CPU_FREQ_STAT) += cpufreq_stats.o
7obj-$(CONFIG_CPU_FREQ_GOV_PERFORMANCE) += cpufreq_performance.o 7obj-$(CONFIG_CPU_FREQ_GOV_PERFORMANCE) += cpufreq_performance.o
8obj-$(CONFIG_CPU_FREQ_GOV_POWERSAVE) += cpufreq_powersave.o 8obj-$(CONFIG_CPU_FREQ_GOV_POWERSAVE) += cpufreq_powersave.o
9obj-$(CONFIG_CPU_FREQ_GOV_USERSPACE) += cpufreq_userspace.o 9obj-$(CONFIG_CPU_FREQ_GOV_USERSPACE) += cpufreq_userspace.o
10obj-$(CONFIG_CPU_FREQ_GOV_ONDEMAND) += cpufreq_ondemand.o cpufreq_governor.o 10obj-$(CONFIG_CPU_FREQ_GOV_ONDEMAND) += cpufreq_ondemand.o
11obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE) += cpufreq_conservative.o cpufreq_governor.o 11obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE) += cpufreq_conservative.o
12obj-$(CONFIG_CPU_FREQ_GOV_COMMON) += cpufreq_governor.o
12 13
13# CPUfreq cross-arch helpers 14# CPUfreq cross-arch helpers
14obj-$(CONFIG_CPU_FREQ_TABLE) += freq_table.o 15obj-$(CONFIG_CPU_FREQ_TABLE) += freq_table.o
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index e40e50809644..9d7732b81044 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -364,18 +364,21 @@ static int __init cpufreq_stats_init(void)
364 if (ret) 364 if (ret)
365 return ret; 365 return ret;
366 366
367 register_hotcpu_notifier(&cpufreq_stat_cpu_notifier);
368 for_each_online_cpu(cpu)
369 cpufreq_update_policy(cpu);
370
367 ret = cpufreq_register_notifier(&notifier_trans_block, 371 ret = cpufreq_register_notifier(&notifier_trans_block,
368 CPUFREQ_TRANSITION_NOTIFIER); 372 CPUFREQ_TRANSITION_NOTIFIER);
369 if (ret) { 373 if (ret) {
370 cpufreq_unregister_notifier(&notifier_policy_block, 374 cpufreq_unregister_notifier(&notifier_policy_block,
371 CPUFREQ_POLICY_NOTIFIER); 375 CPUFREQ_POLICY_NOTIFIER);
376 unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier);
377 for_each_online_cpu(cpu)
378 cpufreq_stats_free_table(cpu);
372 return ret; 379 return ret;
373 } 380 }
374 381
375 register_hotcpu_notifier(&cpufreq_stat_cpu_notifier);
376 for_each_online_cpu(cpu) {
377 cpufreq_update_policy(cpu);
378 }
379 return 0; 382 return 0;
380} 383}
381static void __exit cpufreq_stats_exit(void) 384static void __exit cpufreq_stats_exit(void)
diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c
index f1fa500ac105..1180d536d1eb 100644
--- a/drivers/cpufreq/longhaul.c
+++ b/drivers/cpufreq/longhaul.c
@@ -77,7 +77,7 @@ static unsigned int longhaul_index;
77static int scale_voltage; 77static int scale_voltage;
78static int disable_acpi_c3; 78static int disable_acpi_c3;
79static int revid_errata; 79static int revid_errata;
80 80static int enable;
81 81
82/* Clock ratios multiplied by 10 */ 82/* Clock ratios multiplied by 10 */
83static int mults[32]; 83static int mults[32];
@@ -965,6 +965,10 @@ static int __init longhaul_init(void)
965 if (!x86_match_cpu(longhaul_id)) 965 if (!x86_match_cpu(longhaul_id))
966 return -ENODEV; 966 return -ENODEV;
967 967
968 if (!enable) {
969 printk(KERN_ERR PFX "Option \"enable\" not set. Aborting.\n");
970 return -ENODEV;
971 }
968#ifdef CONFIG_SMP 972#ifdef CONFIG_SMP
969 if (num_online_cpus() > 1) { 973 if (num_online_cpus() > 1) {
970 printk(KERN_ERR PFX "More than 1 CPU detected, " 974 printk(KERN_ERR PFX "More than 1 CPU detected, "
@@ -1021,6 +1025,10 @@ MODULE_PARM_DESC(scale_voltage, "Scale voltage of processor");
1021 * such. */ 1025 * such. */
1022module_param(revid_errata, int, 0644); 1026module_param(revid_errata, int, 0644);
1023MODULE_PARM_DESC(revid_errata, "Ignore CPU Revision ID"); 1027MODULE_PARM_DESC(revid_errata, "Ignore CPU Revision ID");
1028/* By default driver is disabled to prevent incompatible
1029 * system freeze. */
1030module_param(enable, int, 0644);
1031MODULE_PARM_DESC(enable, "Enable driver");
1024 1032
1025MODULE_AUTHOR("Dave Jones <davej@redhat.com>"); 1033MODULE_AUTHOR("Dave Jones <davej@redhat.com>");
1026MODULE_DESCRIPTION("Longhaul driver for VIA Cyrix processors."); 1034MODULE_DESCRIPTION("Longhaul driver for VIA Cyrix processors.");
diff --git a/drivers/cpuidle/coupled.c b/drivers/cpuidle/coupled.c
index 3265844839bf..2a297f86dbad 100644
--- a/drivers/cpuidle/coupled.c
+++ b/drivers/cpuidle/coupled.c
@@ -209,7 +209,7 @@ inline int cpuidle_coupled_set_not_ready(struct cpuidle_coupled *coupled)
209 int all; 209 int all;
210 int ret; 210 int ret;
211 211
212 all = coupled->online_count || (coupled->online_count << WAITING_BITS); 212 all = coupled->online_count | (coupled->online_count << WAITING_BITS);
213 ret = atomic_add_unless(&coupled->ready_waiting_counts, 213 ret = atomic_add_unless(&coupled->ready_waiting_counts,
214 -MAX_WAITING_CPUS, all); 214 -MAX_WAITING_CPUS, all);
215 215
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 8df53dd8dbe1..fb4a7dd57f94 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -70,7 +70,7 @@ int cpuidle_play_dead(void)
70 struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices); 70 struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices);
71 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); 71 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
72 int i, dead_state = -1; 72 int i, dead_state = -1;
73 int power_usage = -1; 73 int power_usage = INT_MAX;
74 74
75 if (!drv) 75 if (!drv)
76 return -ENODEV; 76 return -ENODEV;
diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
index 3af841fb397a..c2b281afe0ed 100644
--- a/drivers/cpuidle/driver.c
+++ b/drivers/cpuidle/driver.c
@@ -235,16 +235,10 @@ EXPORT_SYMBOL_GPL(cpuidle_get_driver);
235 */ 235 */
236struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev) 236struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev)
237{ 237{
238 struct cpuidle_driver *drv;
239
240 if (!dev) 238 if (!dev)
241 return NULL; 239 return NULL;
242 240
243 spin_lock(&cpuidle_driver_lock); 241 return __cpuidle_get_cpu_driver(dev->cpu);
244 drv = __cpuidle_get_cpu_driver(dev->cpu);
245 spin_unlock(&cpuidle_driver_lock);
246
247 return drv;
248} 242}
249EXPORT_SYMBOL_GPL(cpuidle_get_cpu_driver); 243EXPORT_SYMBOL_GPL(cpuidle_get_cpu_driver);
250 244
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index bd40b943b6db..20ea33afdda1 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -312,7 +312,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
312{ 312{
313 struct menu_device *data = &__get_cpu_var(menu_devices); 313 struct menu_device *data = &__get_cpu_var(menu_devices);
314 int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); 314 int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
315 int power_usage = -1; 315 int power_usage = INT_MAX;
316 int i; 316 int i;
317 int multiplier; 317 int multiplier;
318 struct timespec t; 318 struct timespec t;
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index c49c04d9c2b0..4ba384f1ab54 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -506,7 +506,7 @@ static int intel_idle_cpuidle_driver_init(void)
506 if (*cpuidle_state_table[cstate].name == '\0') 506 if (*cpuidle_state_table[cstate].name == '\0')
507 pr_debug(PREFIX "unaware of model 0x%x" 507 pr_debug(PREFIX "unaware of model 0x%x"
508 " MWAIT %d please" 508 " MWAIT %d please"
509 " contact lenb@kernel.org", 509 " contact lenb@kernel.org\n",
510 boot_cpu_data.x86_model, cstate); 510 boot_cpu_data.x86_model, cstate);
511 continue; 511 continue;
512 } 512 }
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index cfaf5b73540b..0c201317284b 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -298,6 +298,39 @@ static ssize_t pnp_show_current_resources(struct device *dmdev,
298 return ret; 298 return ret;
299} 299}
300 300
301static char *pnp_get_resource_value(char *buf,
302 unsigned long type,
303 resource_size_t *start,
304 resource_size_t *end,
305 unsigned long *flags)
306{
307 if (start)
308 *start = 0;
309 if (end)
310 *end = 0;
311 if (flags)
312 *flags = 0;
313
314 /* TBD: allow for disabled resources */
315
316 buf = skip_spaces(buf);
317 if (start) {
318 *start = simple_strtoull(buf, &buf, 0);
319 if (end) {
320 buf = skip_spaces(buf);
321 if (*buf == '-') {
322 buf = skip_spaces(buf + 1);
323 *end = simple_strtoull(buf, &buf, 0);
324 } else
325 *end = *start;
326 }
327 }
328
329 /* TBD: allow for additional flags, e.g., IORESOURCE_WINDOW */
330
331 return buf;
332}
333
301static ssize_t pnp_set_current_resources(struct device *dmdev, 334static ssize_t pnp_set_current_resources(struct device *dmdev,
302 struct device_attribute *attr, 335 struct device_attribute *attr,
303 const char *ubuf, size_t count) 336 const char *ubuf, size_t count)
@@ -305,7 +338,6 @@ static ssize_t pnp_set_current_resources(struct device *dmdev,
305 struct pnp_dev *dev = to_pnp_dev(dmdev); 338 struct pnp_dev *dev = to_pnp_dev(dmdev);
306 char *buf = (void *)ubuf; 339 char *buf = (void *)ubuf;
307 int retval = 0; 340 int retval = 0;
308 resource_size_t start, end;
309 341
310 if (dev->status & PNP_ATTACHED) { 342 if (dev->status & PNP_ATTACHED) {
311 retval = -EBUSY; 343 retval = -EBUSY;
@@ -349,6 +381,10 @@ static ssize_t pnp_set_current_resources(struct device *dmdev,
349 goto done; 381 goto done;
350 } 382 }
351 if (!strnicmp(buf, "set", 3)) { 383 if (!strnicmp(buf, "set", 3)) {
384 resource_size_t start;
385 resource_size_t end;
386 unsigned long flags;
387
352 if (dev->active) 388 if (dev->active)
353 goto done; 389 goto done;
354 buf += 3; 390 buf += 3;
@@ -357,42 +393,37 @@ static ssize_t pnp_set_current_resources(struct device *dmdev,
357 while (1) { 393 while (1) {
358 buf = skip_spaces(buf); 394 buf = skip_spaces(buf);
359 if (!strnicmp(buf, "io", 2)) { 395 if (!strnicmp(buf, "io", 2)) {
360 buf = skip_spaces(buf + 2); 396 buf = pnp_get_resource_value(buf + 2,
361 start = simple_strtoul(buf, &buf, 0); 397 IORESOURCE_IO,
362 buf = skip_spaces(buf); 398 &start, &end,
363 if (*buf == '-') { 399 &flags);
364 buf = skip_spaces(buf + 1); 400 pnp_add_io_resource(dev, start, end, flags);
365 end = simple_strtoul(buf, &buf, 0); 401 } else if (!strnicmp(buf, "mem", 3)) {
366 } else 402 buf = pnp_get_resource_value(buf + 3,
367 end = start; 403 IORESOURCE_MEM,
368 pnp_add_io_resource(dev, start, end, 0); 404 &start, &end,
369 continue; 405 &flags);
370 } 406 pnp_add_mem_resource(dev, start, end, flags);
371 if (!strnicmp(buf, "mem", 3)) { 407 } else if (!strnicmp(buf, "irq", 3)) {
372 buf = skip_spaces(buf + 3); 408 buf = pnp_get_resource_value(buf + 3,
373 start = simple_strtoul(buf, &buf, 0); 409 IORESOURCE_IRQ,
374 buf = skip_spaces(buf); 410 &start, NULL,
375 if (*buf == '-') { 411 &flags);
376 buf = skip_spaces(buf + 1); 412 pnp_add_irq_resource(dev, start, flags);
377 end = simple_strtoul(buf, &buf, 0); 413 } else if (!strnicmp(buf, "dma", 3)) {
378 } else 414 buf = pnp_get_resource_value(buf + 3,
379 end = start; 415 IORESOURCE_DMA,
380 pnp_add_mem_resource(dev, start, end, 0); 416 &start, NULL,
381 continue; 417 &flags);
382 } 418 pnp_add_dma_resource(dev, start, flags);
383 if (!strnicmp(buf, "irq", 3)) { 419 } else if (!strnicmp(buf, "bus", 3)) {
384 buf = skip_spaces(buf + 3); 420 buf = pnp_get_resource_value(buf + 3,
385 start = simple_strtoul(buf, &buf, 0); 421 IORESOURCE_BUS,
386 pnp_add_irq_resource(dev, start, 0); 422 &start, &end,
387 continue; 423 NULL);
388 } 424 pnp_add_bus_resource(dev, start, end);
389 if (!strnicmp(buf, "dma", 3)) { 425 } else
390 buf = skip_spaces(buf + 3); 426 break;
391 start = simple_strtoul(buf, &buf, 0);
392 pnp_add_dma_resource(dev, start, 0);
393 continue;
394 }
395 break;
396 } 427 }
397 mutex_unlock(&pnp_res_mutex); 428 mutex_unlock(&pnp_res_mutex);
398 goto done; 429 goto done;
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index ed9ce507149a..95cebf0185de 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -18,11 +18,27 @@
18 18
19DEFINE_MUTEX(pnp_res_mutex); 19DEFINE_MUTEX(pnp_res_mutex);
20 20
21static struct resource *pnp_find_resource(struct pnp_dev *dev,
22 unsigned char rule,
23 unsigned long type,
24 unsigned int bar)
25{
26 struct resource *res = pnp_get_resource(dev, type, bar);
27
28 /* when the resource already exists, set its resource bits from rule */
29 if (res) {
30 res->flags &= ~IORESOURCE_BITS;
31 res->flags |= rule & IORESOURCE_BITS;
32 }
33
34 return res;
35}
36
21static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx) 37static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
22{ 38{
23 struct resource *res, local_res; 39 struct resource *res, local_res;
24 40
25 res = pnp_get_resource(dev, IORESOURCE_IO, idx); 41 res = pnp_find_resource(dev, rule->flags, IORESOURCE_IO, idx);
26 if (res) { 42 if (res) {
27 pnp_dbg(&dev->dev, " io %d already set to %#llx-%#llx " 43 pnp_dbg(&dev->dev, " io %d already set to %#llx-%#llx "
28 "flags %#lx\n", idx, (unsigned long long) res->start, 44 "flags %#lx\n", idx, (unsigned long long) res->start,
@@ -65,7 +81,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
65{ 81{
66 struct resource *res, local_res; 82 struct resource *res, local_res;
67 83
68 res = pnp_get_resource(dev, IORESOURCE_MEM, idx); 84 res = pnp_find_resource(dev, rule->flags, IORESOURCE_MEM, idx);
69 if (res) { 85 if (res) {
70 pnp_dbg(&dev->dev, " mem %d already set to %#llx-%#llx " 86 pnp_dbg(&dev->dev, " mem %d already set to %#llx-%#llx "
71 "flags %#lx\n", idx, (unsigned long long) res->start, 87 "flags %#lx\n", idx, (unsigned long long) res->start,
@@ -78,6 +94,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
78 res->start = 0; 94 res->start = 0;
79 res->end = 0; 95 res->end = 0;
80 96
97 /* ??? rule->flags restricted to 8 bits, all tests bogus ??? */
81 if (!(rule->flags & IORESOURCE_MEM_WRITEABLE)) 98 if (!(rule->flags & IORESOURCE_MEM_WRITEABLE))
82 res->flags |= IORESOURCE_READONLY; 99 res->flags |= IORESOURCE_READONLY;
83 if (rule->flags & IORESOURCE_MEM_CACHEABLE) 100 if (rule->flags & IORESOURCE_MEM_CACHEABLE)
@@ -123,7 +140,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
123 5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2 140 5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2
124 }; 141 };
125 142
126 res = pnp_get_resource(dev, IORESOURCE_IRQ, idx); 143 res = pnp_find_resource(dev, rule->flags, IORESOURCE_IRQ, idx);
127 if (res) { 144 if (res) {
128 pnp_dbg(&dev->dev, " irq %d already set to %d flags %#lx\n", 145 pnp_dbg(&dev->dev, " irq %d already set to %d flags %#lx\n",
129 idx, (int) res->start, res->flags); 146 idx, (int) res->start, res->flags);
@@ -182,7 +199,7 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
182 1, 3, 5, 6, 7, 0, 2, 4 199 1, 3, 5, 6, 7, 0, 2, 4
183 }; 200 };
184 201
185 res = pnp_get_resource(dev, IORESOURCE_DMA, idx); 202 res = pnp_find_resource(dev, rule->flags, IORESOURCE_DMA, idx);
186 if (res) { 203 if (res) {
187 pnp_dbg(&dev->dev, " dma %d already set to %d flags %#lx\n", 204 pnp_dbg(&dev->dev, " dma %d already set to %d flags %#lx\n",
188 idx, (int) res->start, res->flags); 205 idx, (int) res->start, res->flags);