Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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.

+154 -856
+5 -4
Documentation/power/runtime_pm.txt
··· 642 642 * During system suspend it calls pm_runtime_get_noresume() and 643 643 pm_runtime_barrier() for every device right before executing the 644 644 subsystem-level .suspend() callback for it. In addition to that it calls 645 - pm_runtime_disable() for every device right after executing the 646 - subsystem-level .suspend() callback for it. 645 + __pm_runtime_disable() with 'false' as the second argument for every device 646 + right before executing the subsystem-level .suspend_late() callback for it. 647 647 648 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 650 - .resume() callback for it, respectively. 649 + for every device right after executing the subsystem-level .resume_early() 650 + callback and right after executing the subsystem-level .resume() callback 651 + for it, respectively. 651 652 652 653 7. Generic subsystem callbacks 653 654
-18
drivers/acpi/acpi_memhotplug.c
··· 226 226 struct acpi_memory_info *info; 227 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 229 node = acpi_get_node(mem_device->device->handle); 240 230 /* 241 231 * Tell the VM there is more memory here... ··· 329 339 "\nReceived DEVICE CHECK notification for device\n")); 330 340 if (acpi_memory_get_device(handle, &mem_device)) { 331 341 acpi_handle_err(handle, "Cannot find driver data\n"); 332 - break; 333 - } 334 - 335 - if (acpi_memory_check_device(mem_device)) 336 - break; 337 - 338 - if (acpi_memory_enable_device(mem_device)) { 339 - acpi_handle_err(handle,"Cannot enable memory device\n"); 340 342 break; 341 343 } 342 344
+1 -1
drivers/acpi/acpica/Makefile
··· 162 162 utxferror.o \ 163 163 utxfmutex.o 164 164 165 - acpi-$(ACPI_FUTURE_USAGE) += uttrack.o utcache.o utclib.o 165 + acpi-$(ACPI_FUTURE_USAGE) += uttrack.o utcache.o 166 166
-749
drivers/acpi/acpica/utclib.c
··· 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 54 - ACPI_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 - ******************************************************************************/ 72 - int 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 - 93 - void *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 - 122 - void *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 - 147 - acpi_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 - 174 - char *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 - 207 - char *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 - 242 - int 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 - 269 - char *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 - 296 - int 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 - 322 - char *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 - 354 - char *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 - 395 - char *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 - 433 - u32 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 - 576 - int 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 - 594 - int 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 - 608 - const 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 */
+10 -1
drivers/acpi/apei/erst-dbg.c
··· 111 111 if (rc) 112 112 goto out; 113 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 123 goto out; 124 + } 116 125 retry: 117 126 rc = len = erst_read(id, erst_dbg_buf, erst_dbg_buf_len); 118 127 /* The record may be cleared by others, try read next record */
+1 -2
drivers/acpi/device_pm.c
··· 358 358 acpi_handle handle = DEVICE_ACPI_HANDLE(dev); 359 359 struct acpi_device *adev; 360 360 361 - return handle && ACPI_SUCCESS(acpi_bus_get_device(handle, &adev)) ? 362 - adev : NULL; 361 + return handle && !acpi_bus_get_device(handle, &adev) ? adev : NULL; 363 362 } 364 363 365 364 /**
+7 -2
drivers/acpi/glue.c
··· 18 18 19 19 #define ACPI_GLUE_DEBUG 0 20 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 23 #else 23 - #define DBG(x...) do { } while(0) 24 + #define DBG(fmt, ...) \ 25 + do { \ 26 + if (0) \ 27 + printk(KERN_DEBUG PREFIX fmt, ##__VA_ARGS__); \ 28 + } while (0) 24 29 #endif 25 30 static LIST_HEAD(bus_type_list); 26 31 static DECLARE_RWSEM(bus_type_sem);
+2 -9
drivers/acpi/power.c
··· 445 445 return -ENODEV; 446 446 447 447 ret = acpi_bus_get_device(handle, &acpi_dev); 448 - if (ret) 449 - goto no_power_resource; 450 - 451 - if (!acpi_dev->power.flags.power_resources) 452 - goto no_power_resource; 448 + if (ret || !acpi_dev->power.flags.power_resources) 449 + return -ENODEV; 453 450 454 451 powered_device = kzalloc(sizeof(*powered_device), GFP_KERNEL); 455 452 if (!powered_device) ··· 468 471 } 469 472 470 473 return ret; 471 - 472 - no_power_resource: 473 - printk(KERN_DEBUG PREFIX "Invalid Power Resource to register!\n"); 474 - return -ENODEV; 475 474 } 476 475 EXPORT_SYMBOL_GPL(acpi_power_resource_register_device); 477 476
+1 -1
drivers/acpi/scan.c
··· 1346 1346 acpi_add_id(device, ACPI_DOCK_HID); 1347 1347 else if (!acpi_ibm_smbus_match(device)) 1348 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 1350 ACPI_IS_ROOT_DEVICE(device->parent)) { 1351 1351 acpi_add_id(device, ACPI_BUS_HID); /* \_SB, LNXSYBUS */ 1352 1352 strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME);
+4 -5
drivers/base/power/main.c
··· 513 513 514 514 Out: 515 515 TRACE_RESUME(error); 516 + 517 + pm_runtime_enable(dev); 516 518 return error; 517 519 } 518 520 ··· 590 588 591 589 if (!dev->power.is_suspended) 592 590 goto Unlock; 593 - 594 - pm_runtime_enable(dev); 595 591 596 592 if (dev->pm_domain) { 597 593 info = "power domain "; ··· 930 930 pm_callback_t callback = NULL; 931 931 char *info = NULL; 932 932 933 + __pm_runtime_disable(dev, false); 934 + 933 935 if (dev->power.syscore) 934 936 return 0; 935 937 ··· 1135 1133 1136 1134 Complete: 1137 1135 complete_all(&dev->power.completion); 1138 - 1139 1136 if (error) 1140 1137 async_error = error; 1141 - else if (dev->power.is_suspended) 1142 - __pm_runtime_disable(dev, false); 1143 1138 1144 1139 return error; 1145 1140 }
+5 -5
drivers/base/power/qos.c
··· 542 542 struct dev_pm_qos_request *req, s32 value) 543 543 { 544 544 struct device *ancestor = dev->parent; 545 - int error = -ENODEV; 545 + int ret = -ENODEV; 546 546 547 547 while (ancestor && !ancestor->power.ignore_children) 548 548 ancestor = ancestor->parent; 549 549 550 550 if (ancestor) 551 - error = dev_pm_qos_add_request(ancestor, req, 552 - DEV_PM_QOS_LATENCY, value); 551 + ret = dev_pm_qos_add_request(ancestor, req, 552 + DEV_PM_QOS_LATENCY, value); 553 553 554 - if (error < 0) 554 + if (ret < 0) 555 555 req->dev = NULL; 556 556 557 - return error; 557 + return ret; 558 558 } 559 559 EXPORT_SYMBOL_GPL(dev_pm_qos_add_ancestor_request); 560 560
+5
drivers/cpufreq/Kconfig
··· 20 20 config CPU_FREQ_TABLE 21 21 tristate 22 22 23 + config CPU_FREQ_GOV_COMMON 24 + bool 25 + 23 26 config CPU_FREQ_STAT 24 27 tristate "CPU frequency translation statistics" 25 28 select CPU_FREQ_TABLE ··· 144 141 config CPU_FREQ_GOV_ONDEMAND 145 142 tristate "'ondemand' cpufreq policy governor" 146 143 select CPU_FREQ_TABLE 144 + select CPU_FREQ_GOV_COMMON 147 145 help 148 146 'ondemand' - This driver adds a dynamic cpufreq policy governor. 149 147 The governor does a periodic polling and ··· 163 159 config CPU_FREQ_GOV_CONSERVATIVE 164 160 tristate "'conservative' cpufreq governor" 165 161 depends on CPU_FREQ 162 + select CPU_FREQ_GOV_COMMON 166 163 help 167 164 'conservative' - this driver is rather similar to the 'ondemand' 168 165 governor both in its source code and its purpose, the difference is
+3 -2
drivers/cpufreq/Makefile
··· 7 7 obj-$(CONFIG_CPU_FREQ_GOV_PERFORMANCE) += cpufreq_performance.o 8 8 obj-$(CONFIG_CPU_FREQ_GOV_POWERSAVE) += cpufreq_powersave.o 9 9 obj-$(CONFIG_CPU_FREQ_GOV_USERSPACE) += cpufreq_userspace.o 10 - obj-$(CONFIG_CPU_FREQ_GOV_ONDEMAND) += cpufreq_ondemand.o cpufreq_governor.o 11 - obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE) += cpufreq_conservative.o cpufreq_governor.o 10 + obj-$(CONFIG_CPU_FREQ_GOV_ONDEMAND) += cpufreq_ondemand.o 11 + obj-$(CONFIG_CPU_FREQ_GOV_CONSERVATIVE) += cpufreq_conservative.o 12 + obj-$(CONFIG_CPU_FREQ_GOV_COMMON) += cpufreq_governor.o 12 13 13 14 # CPUfreq cross-arch helpers 14 15 obj-$(CONFIG_CPU_FREQ_TABLE) += freq_table.o
+7 -4
drivers/cpufreq/cpufreq_stats.c
··· 364 364 if (ret) 365 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 371 ret = cpufreq_register_notifier(&notifier_trans_block, 368 372 CPUFREQ_TRANSITION_NOTIFIER); 369 373 if (ret) { 370 374 cpufreq_unregister_notifier(&notifier_policy_block, 371 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 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 382 return 0; 380 383 } 381 384 static void __exit cpufreq_stats_exit(void)
+9 -1
drivers/cpufreq/longhaul.c
··· 77 77 static int scale_voltage; 78 78 static int disable_acpi_c3; 79 79 static int revid_errata; 80 - 80 + static int enable; 81 81 82 82 /* Clock ratios multiplied by 10 */ 83 83 static int mults[32]; ··· 965 965 if (!x86_match_cpu(longhaul_id)) 966 966 return -ENODEV; 967 967 968 + if (!enable) { 969 + printk(KERN_ERR PFX "Option \"enable\" not set. Aborting.\n"); 970 + return -ENODEV; 971 + } 968 972 #ifdef CONFIG_SMP 969 973 if (num_online_cpus() > 1) { 970 974 printk(KERN_ERR PFX "More than 1 CPU detected, " ··· 1025 1021 * such. */ 1026 1022 module_param(revid_errata, int, 0644); 1027 1023 MODULE_PARM_DESC(revid_errata, "Ignore CPU Revision ID"); 1024 + /* By default driver is disabled to prevent incompatible 1025 + * system freeze. */ 1026 + module_param(enable, int, 0644); 1027 + MODULE_PARM_DESC(enable, "Enable driver"); 1028 1028 1029 1029 MODULE_AUTHOR("Dave Jones <davej@redhat.com>"); 1030 1030 MODULE_DESCRIPTION("Longhaul driver for VIA Cyrix processors.");
+1 -1
drivers/cpuidle/coupled.c
··· 209 209 int all; 210 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 213 ret = atomic_add_unless(&coupled->ready_waiting_counts, 214 214 -MAX_WAITING_CPUS, all); 215 215
+1 -1
drivers/cpuidle/cpuidle.c
··· 70 70 struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices); 71 71 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); 72 72 int i, dead_state = -1; 73 - int power_usage = -1; 73 + int power_usage = INT_MAX; 74 74 75 75 if (!drv) 76 76 return -ENODEV;
+1 -7
drivers/cpuidle/driver.c
··· 235 235 */ 236 236 struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev) 237 237 { 238 - struct cpuidle_driver *drv; 239 - 240 238 if (!dev) 241 239 return NULL; 242 240 243 - spin_lock(&cpuidle_driver_lock); 244 - drv = __cpuidle_get_cpu_driver(dev->cpu); 245 - spin_unlock(&cpuidle_driver_lock); 246 - 247 - return drv; 241 + return __cpuidle_get_cpu_driver(dev->cpu); 248 242 } 249 243 EXPORT_SYMBOL_GPL(cpuidle_get_cpu_driver); 250 244
+1 -1
drivers/cpuidle/governors/menu.c
··· 312 312 { 313 313 struct menu_device *data = &__get_cpu_var(menu_devices); 314 314 int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); 315 - int power_usage = -1; 315 + int power_usage = INT_MAX; 316 316 int i; 317 317 int multiplier; 318 318 struct timespec t;
+1 -1
drivers/idle/intel_idle.c
··· 506 506 if (*cpuidle_state_table[cstate].name == '\0') 507 507 pr_debug(PREFIX "unaware of model 0x%x" 508 508 " MWAIT %d please" 509 - " contact lenb@kernel.org", 509 + " contact lenb@kernel.org\n", 510 510 boot_cpu_data.x86_model, cstate); 511 511 continue; 512 512 }
+68 -37
drivers/pnp/interface.c
··· 298 298 return ret; 299 299 } 300 300 301 + static 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 + 301 334 static ssize_t pnp_set_current_resources(struct device *dmdev, 302 335 struct device_attribute *attr, 303 336 const char *ubuf, size_t count) ··· 338 305 struct pnp_dev *dev = to_pnp_dev(dmdev); 339 306 char *buf = (void *)ubuf; 340 307 int retval = 0; 341 - resource_size_t start, end; 342 308 343 309 if (dev->status & PNP_ATTACHED) { 344 310 retval = -EBUSY; ··· 381 349 goto done; 382 350 } 383 351 if (!strnicmp(buf, "set", 3)) { 352 + resource_size_t start; 353 + resource_size_t end; 354 + unsigned long flags; 355 + 384 356 if (dev->active) 385 357 goto done; 386 358 buf += 3; ··· 393 357 while (1) { 394 358 buf = skip_spaces(buf); 395 359 if (!strnicmp(buf, "io", 2)) { 396 - buf = skip_spaces(buf + 2); 397 - start = simple_strtoul(buf, &buf, 0); 398 - buf = skip_spaces(buf); 399 - if (*buf == '-') { 400 - buf = skip_spaces(buf + 1); 401 - end = simple_strtoul(buf, &buf, 0); 402 - } else 403 - end = start; 404 - pnp_add_io_resource(dev, start, end, 0); 405 - continue; 406 - } 407 - if (!strnicmp(buf, "mem", 3)) { 408 - buf = skip_spaces(buf + 3); 409 - start = simple_strtoul(buf, &buf, 0); 410 - buf = skip_spaces(buf); 411 - if (*buf == '-') { 412 - buf = skip_spaces(buf + 1); 413 - end = simple_strtoul(buf, &buf, 0); 414 - } else 415 - end = start; 416 - pnp_add_mem_resource(dev, start, end, 0); 417 - continue; 418 - } 419 - if (!strnicmp(buf, "irq", 3)) { 420 - buf = skip_spaces(buf + 3); 421 - start = simple_strtoul(buf, &buf, 0); 422 - pnp_add_irq_resource(dev, start, 0); 423 - continue; 424 - } 425 - if (!strnicmp(buf, "dma", 3)) { 426 - buf = skip_spaces(buf + 3); 427 - start = simple_strtoul(buf, &buf, 0); 428 - pnp_add_dma_resource(dev, start, 0); 429 - continue; 430 - } 431 - break; 360 + buf = pnp_get_resource_value(buf + 2, 361 + IORESOURCE_IO, 362 + &start, &end, 363 + &flags); 364 + pnp_add_io_resource(dev, start, end, flags); 365 + } else if (!strnicmp(buf, "mem", 3)) { 366 + buf = pnp_get_resource_value(buf + 3, 367 + IORESOURCE_MEM, 368 + &start, &end, 369 + &flags); 370 + pnp_add_mem_resource(dev, start, end, flags); 371 + } else if (!strnicmp(buf, "irq", 3)) { 372 + buf = pnp_get_resource_value(buf + 3, 373 + IORESOURCE_IRQ, 374 + &start, NULL, 375 + &flags); 376 + pnp_add_irq_resource(dev, start, flags); 377 + } else if (!strnicmp(buf, "dma", 3)) { 378 + buf = pnp_get_resource_value(buf + 3, 379 + IORESOURCE_DMA, 380 + &start, NULL, 381 + &flags); 382 + pnp_add_dma_resource(dev, start, flags); 383 + } else if (!strnicmp(buf, "bus", 3)) { 384 + buf = pnp_get_resource_value(buf + 3, 385 + IORESOURCE_BUS, 386 + &start, &end, 387 + NULL); 388 + pnp_add_bus_resource(dev, start, end); 389 + } else 390 + break; 432 391 } 433 392 mutex_unlock(&pnp_res_mutex); 434 393 goto done;
+21 -4
drivers/pnp/manager.c
··· 18 18 19 19 DEFINE_MUTEX(pnp_res_mutex); 20 20 21 + static 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 + 21 37 static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx) 22 38 { 23 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 42 if (res) { 27 43 pnp_dbg(&dev->dev, " io %d already set to %#llx-%#llx " 28 44 "flags %#lx\n", idx, (unsigned long long) res->start, ··· 81 65 { 82 66 struct resource *res, local_res; 83 67 84 - res = pnp_get_resource(dev, IORESOURCE_MEM, idx); 68 + res = pnp_find_resource(dev, rule->flags, IORESOURCE_MEM, idx); 85 69 if (res) { 86 70 pnp_dbg(&dev->dev, " mem %d already set to %#llx-%#llx " 87 71 "flags %#lx\n", idx, (unsigned long long) res->start, ··· 94 78 res->start = 0; 95 79 res->end = 0; 96 80 81 + /* ??? rule->flags restricted to 8 bits, all tests bogus ??? */ 97 82 if (!(rule->flags & IORESOURCE_MEM_WRITEABLE)) 98 83 res->flags |= IORESOURCE_READONLY; 99 84 if (rule->flags & IORESOURCE_MEM_CACHEABLE) ··· 140 123 5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2 141 124 }; 142 125 143 - res = pnp_get_resource(dev, IORESOURCE_IRQ, idx); 126 + res = pnp_find_resource(dev, rule->flags, IORESOURCE_IRQ, idx); 144 127 if (res) { 145 128 pnp_dbg(&dev->dev, " irq %d already set to %d flags %#lx\n", 146 129 idx, (int) res->start, res->flags); ··· 199 182 1, 3, 5, 6, 7, 0, 2, 4 200 183 }; 201 184 202 - res = pnp_get_resource(dev, IORESOURCE_DMA, idx); 185 + res = pnp_find_resource(dev, rule->flags, IORESOURCE_DMA, idx); 203 186 if (res) { 204 187 pnp_dbg(&dev->dev, " dma %d already set to %d flags %#lx\n", 205 188 idx, (int) res->start, res->flags);