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-3.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI and power management fixes from Rafael J Wysocki:

- Two fixes for the new intel_pstate driver from Dirk Brandewie.

- Fix for incorrect usage of the .find_bridge() callback from struct
acpi_bus_type in the USB core and subsequent removal of that callback
from Rafael J Wysocki.

- ACPI processor driver cleanups from Chen Gang and Syam Sidhardhan.

- ACPI initialization and error messages fix from Joe Perches.

- Operating Performance Points documentation improvement from Nishanth
Menon.

- Fixes for memory leaks and potential concurrency issues and sysfs
attributes leaks during device removal in the core device PM QoS code
from Rafael J Wysocki.

- Calxeda Highbank cpufreq driver simplification from Emilio López.

- cpufreq comment cleanup from Namhyung Kim.

- Fix for a section mismatch in Calxeda Highbank interprocessor
communication code from Mark Langsdorf (this is not a PM fix strictly
speaking, but the code in question went in through the PM tree).

* tag 'pm+acpi-3.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
cpufreq / intel_pstate: Do not load on VM that does not report max P state.
cpufreq / intel_pstate: Fix intel_pstate_init() error path
ACPI / glue: Drop .find_bridge() callback from struct acpi_bus_type
ACPI / glue: Add .match() callback to struct acpi_bus_type
ACPI / porocessor: Beautify code, pr->id is u32 which is never < 0
ACPI / processor: Remove redundant NULL check before kfree
ACPI / Sleep: Avoid interleaved message on errors
PM / QoS: Remove device PM QoS sysfs attributes at the right place
PM / QoS: Fix concurrency issues and memory leaks in device PM QoS
cpufreq: highbank: do not initialize array with a loop
PM / OPP: improve introductory documentation
cpufreq: Fix a typo in comment
mailbox, pl320-ipc: remove __init from probe function

+215 -214
+20 -5
Documentation/power/opp.txt
··· 1 - *=============* 2 - * OPP Library * 3 - *=============* 1 + Operating Performance Points (OPP) Library 2 + ========================================== 4 3 5 4 (C) 2009-2010 Nishanth Menon <nm@ti.com>, Texas Instruments Incorporated 6 5 ··· 15 16 16 17 1. Introduction 17 18 =============== 19 + 1.1 What is an Operating Performance Point (OPP)? 20 + 18 21 Complex SoCs of today consists of a multiple sub-modules working in conjunction. 19 22 In an operational system executing varied use cases, not all modules in the SoC 20 23 need to function at their highest performing frequency all the time. To 21 24 facilitate this, sub-modules in a SoC are grouped into domains, allowing some 22 - domains to run at lower voltage and frequency while other domains are loaded 23 - more. The set of discrete tuples consisting of frequency and voltage pairs that 25 + domains to run at lower voltage and frequency while other domains run at 26 + voltage/frequency pairs that are higher. 27 + 28 + The set of discrete tuples consisting of frequency and voltage pairs that 24 29 the device will support per domain are called Operating Performance Points or 25 30 OPPs. 31 + 32 + As an example: 33 + Let us consider an MPU device which supports the following: 34 + {300MHz at minimum voltage of 1V}, {800MHz at minimum voltage of 1.2V}, 35 + {1GHz at minimum voltage of 1.3V} 36 + 37 + We can represent these as three OPPs as the following {Hz, uV} tuples: 38 + {300000000, 1000000} 39 + {800000000, 1200000} 40 + {1000000000, 1300000} 41 + 42 + 1.2 Operating Performance Points Library 26 43 27 44 OPP library provides a set of helper functions to organize and query the OPP 28 45 information. The library is located in drivers/base/power/opp.c and the header
+9 -46
drivers/acpi/glue.c
··· 36 36 { 37 37 if (acpi_disabled) 38 38 return -ENODEV; 39 - if (type && type->bus && type->find_device) { 39 + if (type && type->match && type->find_device) { 40 40 down_write(&bus_type_sem); 41 41 list_add_tail(&type->list, &bus_type_list); 42 42 up_write(&bus_type_sem); 43 - printk(KERN_INFO PREFIX "bus type %s registered\n", 44 - type->bus->name); 43 + printk(KERN_INFO PREFIX "bus type %s registered\n", type->name); 45 44 return 0; 46 45 } 47 46 return -ENODEV; ··· 55 56 down_write(&bus_type_sem); 56 57 list_del_init(&type->list); 57 58 up_write(&bus_type_sem); 58 - printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n", 59 - type->bus->name); 59 + printk(KERN_INFO PREFIX "bus type %s unregistered\n", 60 + type->name); 60 61 return 0; 61 62 } 62 63 return -ENODEV; 63 64 } 64 65 EXPORT_SYMBOL_GPL(unregister_acpi_bus_type); 65 66 66 - static struct acpi_bus_type *acpi_get_bus_type(struct bus_type *type) 67 + static struct acpi_bus_type *acpi_get_bus_type(struct device *dev) 67 68 { 68 69 struct acpi_bus_type *tmp, *ret = NULL; 69 70 70 - if (!type) 71 - return NULL; 72 - 73 71 down_read(&bus_type_sem); 74 72 list_for_each_entry(tmp, &bus_type_list, list) { 75 - if (tmp->bus == type) { 73 + if (tmp->match(dev)) { 76 74 ret = tmp; 77 - break; 78 - } 79 - } 80 - up_read(&bus_type_sem); 81 - return ret; 82 - } 83 - 84 - static int acpi_find_bridge_device(struct device *dev, acpi_handle * handle) 85 - { 86 - struct acpi_bus_type *tmp; 87 - int ret = -ENODEV; 88 - 89 - down_read(&bus_type_sem); 90 - list_for_each_entry(tmp, &bus_type_list, list) { 91 - if (tmp->find_bridge && !tmp->find_bridge(dev, handle)) { 92 - ret = 0; 93 75 break; 94 76 } 95 77 } ··· 241 261 242 262 static int acpi_platform_notify(struct device *dev) 243 263 { 244 - struct acpi_bus_type *type; 264 + struct acpi_bus_type *type = acpi_get_bus_type(dev); 245 265 acpi_handle handle; 246 266 int ret; 247 267 248 268 ret = acpi_bind_one(dev, NULL); 249 - if (ret && (!dev->bus || !dev->parent)) { 250 - /* bridge devices genernally haven't bus or parent */ 251 - ret = acpi_find_bridge_device(dev, &handle); 252 - if (!ret) { 253 - ret = acpi_bind_one(dev, handle); 254 - if (ret) 255 - goto out; 256 - } 257 - } 258 - 259 - type = acpi_get_bus_type(dev->bus); 260 - if (ret) { 261 - if (!type || !type->find_device) { 262 - DBG("No ACPI bus support for %s\n", dev_name(dev)); 263 - ret = -EINVAL; 264 - goto out; 265 - } 266 - 269 + if (ret && type) { 267 270 ret = type->find_device(dev, &handle); 268 271 if (ret) { 269 272 DBG("Unable to get handle for %s\n", dev_name(dev)); ··· 279 316 { 280 317 struct acpi_bus_type *type; 281 318 282 - type = acpi_get_bus_type(dev->bus); 319 + type = acpi_get_bus_type(dev); 283 320 if (type && type->cleanup) 284 321 type->cleanup(dev); 285 322
+1 -2
drivers/acpi/processor_core.c
··· 158 158 } 159 159 160 160 exit: 161 - if (buffer.pointer) 162 - kfree(buffer.pointer); 161 + kfree(buffer.pointer); 163 162 return apic_id; 164 163 } 165 164
+1 -1
drivers/acpi/processor_driver.c
··· 559 559 return 0; 560 560 #endif 561 561 562 - BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); 562 + BUG_ON(pr->id >= nr_cpu_ids); 563 563 564 564 /* 565 565 * Buggy BIOS check
+11 -5
drivers/acpi/sleep.c
··· 599 599 status = acpi_get_sleep_type_data(i, &type_a, &type_b); 600 600 if (ACPI_SUCCESS(status)) { 601 601 sleep_states[i] = 1; 602 - pr_cont(" S%d", i); 603 602 } 604 603 } 605 604 ··· 741 742 hibernation_set_ops(old_suspend_ordering ? 742 743 &acpi_hibernation_ops_old : &acpi_hibernation_ops); 743 744 sleep_states[ACPI_STATE_S4] = 1; 744 - pr_cont(KERN_CONT " S4"); 745 745 if (nosigcheck) 746 746 return; 747 747 ··· 786 788 { 787 789 acpi_status status; 788 790 u8 type_a, type_b; 791 + char supported[ACPI_S_STATE_COUNT * 3 + 1]; 792 + char *pos = supported; 793 + int i; 789 794 790 795 if (acpi_disabled) 791 796 return 0; ··· 796 795 acpi_sleep_dmi_check(); 797 796 798 797 sleep_states[ACPI_STATE_S0] = 1; 799 - pr_info(PREFIX "(supports S0"); 800 798 801 799 acpi_sleep_suspend_setup(); 802 800 acpi_sleep_hibernate_setup(); ··· 803 803 status = acpi_get_sleep_type_data(ACPI_STATE_S5, &type_a, &type_b); 804 804 if (ACPI_SUCCESS(status)) { 805 805 sleep_states[ACPI_STATE_S5] = 1; 806 - pr_cont(" S5"); 807 806 pm_power_off_prepare = acpi_power_off_prepare; 808 807 pm_power_off = acpi_power_off; 809 808 } 810 - pr_cont(")\n"); 809 + 810 + supported[0] = 0; 811 + for (i = 0; i < ACPI_S_STATE_COUNT; i++) { 812 + if (sleep_states[i]) 813 + pos += sprintf(pos, " S%d", i); 814 + } 815 + pr_info(PREFIX "(supports%s)\n", supported); 816 + 811 817 /* 812 818 * Register the tts_notifier to reboot notifier list so that the _TTS 813 819 * object can also be evaluated when the system enters S5.
+1 -6
drivers/ata/libata-acpi.c
··· 1144 1144 return -ENODEV; 1145 1145 } 1146 1146 1147 - static int ata_acpi_find_dummy(struct device *dev, acpi_handle *handle) 1148 - { 1149 - return -ENODEV; 1150 - } 1151 - 1152 1147 static struct acpi_bus_type ata_acpi_bus = { 1153 - .find_bridge = ata_acpi_find_dummy, 1148 + .name = "ATA", 1154 1149 .find_device = ata_acpi_find_device, 1155 1150 }; 1156 1151
-2
drivers/base/power/main.c
··· 99 99 dev_warn(dev, "parent %s should not be sleeping\n", 100 100 dev_name(dev->parent)); 101 101 list_add_tail(&dev->power.entry, &dpm_list); 102 - dev_pm_qos_constraints_init(dev); 103 102 mutex_unlock(&dpm_list_mtx); 104 103 } 105 104 ··· 112 113 dev->bus ? dev->bus->name : "No Bus", dev_name(dev)); 113 114 complete_all(&dev->power.completion); 114 115 mutex_lock(&dpm_list_mtx); 115 - dev_pm_qos_constraints_destroy(dev); 116 116 list_del_init(&dev->power.entry); 117 117 mutex_unlock(&dpm_list_mtx); 118 118 device_wakeup_disable(dev);
+2 -6
drivers/base/power/power.h
··· 4 4 { 5 5 if (!dev->power.early_init) { 6 6 spin_lock_init(&dev->power.lock); 7 - dev->power.power_state = PMSG_INVALID; 7 + dev->power.qos = NULL; 8 8 dev->power.early_init = true; 9 9 } 10 10 } ··· 56 56 57 57 static inline void device_pm_sleep_init(struct device *dev) {} 58 58 59 - static inline void device_pm_add(struct device *dev) 60 - { 61 - dev_pm_qos_constraints_init(dev); 62 - } 59 + static inline void device_pm_add(struct device *dev) {} 63 60 64 61 static inline void device_pm_remove(struct device *dev) 65 62 { 66 - dev_pm_qos_constraints_destroy(dev); 67 63 pm_runtime_remove(dev); 68 64 } 69 65
+123 -94
drivers/base/power/qos.c
··· 41 41 #include <linux/mutex.h> 42 42 #include <linux/export.h> 43 43 #include <linux/pm_runtime.h> 44 + #include <linux/err.h> 44 45 45 46 #include "power.h" 46 47 ··· 62 61 struct pm_qos_flags *pqf; 63 62 s32 val; 64 63 65 - if (!qos) 64 + if (IS_ERR_OR_NULL(qos)) 66 65 return PM_QOS_FLAGS_UNDEFINED; 67 66 68 67 pqf = &qos->flags; ··· 102 101 */ 103 102 s32 __dev_pm_qos_read_value(struct device *dev) 104 103 { 105 - return dev->power.qos ? pm_qos_read_value(&dev->power.qos->latency) : 0; 104 + return IS_ERR_OR_NULL(dev->power.qos) ? 105 + 0 : pm_qos_read_value(&dev->power.qos->latency); 106 106 } 107 107 108 108 /** ··· 200 198 return 0; 201 199 } 202 200 203 - /** 204 - * dev_pm_qos_constraints_init - Initalize device's PM QoS constraints pointer. 205 - * @dev: target device 206 - * 207 - * Called from the device PM subsystem during device insertion under 208 - * device_pm_lock(). 209 - */ 210 - void dev_pm_qos_constraints_init(struct device *dev) 211 - { 212 - mutex_lock(&dev_pm_qos_mtx); 213 - dev->power.qos = NULL; 214 - dev->power.power_state = PMSG_ON; 215 - mutex_unlock(&dev_pm_qos_mtx); 216 - } 201 + static void __dev_pm_qos_hide_latency_limit(struct device *dev); 202 + static void __dev_pm_qos_hide_flags(struct device *dev); 217 203 218 204 /** 219 205 * dev_pm_qos_constraints_destroy ··· 216 226 struct pm_qos_constraints *c; 217 227 struct pm_qos_flags *f; 218 228 229 + mutex_lock(&dev_pm_qos_mtx); 230 + 219 231 /* 220 232 * If the device's PM QoS resume latency limit or PM QoS flags have been 221 233 * exposed to user space, they have to be hidden at this point. 222 234 */ 223 - dev_pm_qos_hide_latency_limit(dev); 224 - dev_pm_qos_hide_flags(dev); 235 + __dev_pm_qos_hide_latency_limit(dev); 236 + __dev_pm_qos_hide_flags(dev); 225 237 226 - mutex_lock(&dev_pm_qos_mtx); 227 - 228 - dev->power.power_state = PMSG_INVALID; 229 238 qos = dev->power.qos; 230 239 if (!qos) 231 240 goto out; ··· 246 257 } 247 258 248 259 spin_lock_irq(&dev->power.lock); 249 - dev->power.qos = NULL; 260 + dev->power.qos = ERR_PTR(-ENODEV); 250 261 spin_unlock_irq(&dev->power.lock); 251 262 252 263 kfree(c->notifiers); ··· 290 301 "%s() called for already added request\n", __func__)) 291 302 return -EINVAL; 292 303 293 - req->dev = dev; 294 - 295 304 mutex_lock(&dev_pm_qos_mtx); 296 305 297 - if (!dev->power.qos) { 298 - if (dev->power.power_state.event == PM_EVENT_INVALID) { 299 - /* The device has been removed from the system. */ 300 - req->dev = NULL; 301 - ret = -ENODEV; 302 - goto out; 303 - } else { 304 - /* 305 - * Allocate the constraints data on the first call to 306 - * add_request, i.e. only if the data is not already 307 - * allocated and if the device has not been removed. 308 - */ 309 - ret = dev_pm_qos_constraints_allocate(dev); 310 - } 311 - } 306 + if (IS_ERR(dev->power.qos)) 307 + ret = -ENODEV; 308 + else if (!dev->power.qos) 309 + ret = dev_pm_qos_constraints_allocate(dev); 312 310 313 311 if (!ret) { 312 + req->dev = dev; 314 313 req->type = type; 315 314 ret = apply_constraint(req, PM_QOS_ADD_REQ, value); 316 315 } 317 316 318 - out: 319 317 mutex_unlock(&dev_pm_qos_mtx); 320 318 321 319 return ret; ··· 320 344 s32 curr_value; 321 345 int ret = 0; 322 346 323 - if (!req->dev->power.qos) 347 + if (!req) /*guard against callers passing in null */ 348 + return -EINVAL; 349 + 350 + if (WARN(!dev_pm_qos_request_active(req), 351 + "%s() called for unknown object\n", __func__)) 352 + return -EINVAL; 353 + 354 + if (IS_ERR_OR_NULL(req->dev->power.qos)) 324 355 return -ENODEV; 325 356 326 357 switch(req->type) { ··· 369 386 { 370 387 int ret; 371 388 389 + mutex_lock(&dev_pm_qos_mtx); 390 + ret = __dev_pm_qos_update_request(req, new_value); 391 + mutex_unlock(&dev_pm_qos_mtx); 392 + return ret; 393 + } 394 + EXPORT_SYMBOL_GPL(dev_pm_qos_update_request); 395 + 396 + static int __dev_pm_qos_remove_request(struct dev_pm_qos_request *req) 397 + { 398 + int ret; 399 + 372 400 if (!req) /*guard against callers passing in null */ 373 401 return -EINVAL; 374 402 ··· 387 393 "%s() called for unknown object\n", __func__)) 388 394 return -EINVAL; 389 395 390 - mutex_lock(&dev_pm_qos_mtx); 391 - ret = __dev_pm_qos_update_request(req, new_value); 392 - mutex_unlock(&dev_pm_qos_mtx); 396 + if (IS_ERR_OR_NULL(req->dev->power.qos)) 397 + return -ENODEV; 393 398 399 + ret = apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE); 400 + memset(req, 0, sizeof(*req)); 394 401 return ret; 395 402 } 396 - EXPORT_SYMBOL_GPL(dev_pm_qos_update_request); 397 403 398 404 /** 399 405 * dev_pm_qos_remove_request - modifies an existing qos request ··· 412 418 */ 413 419 int dev_pm_qos_remove_request(struct dev_pm_qos_request *req) 414 420 { 415 - int ret = 0; 416 - 417 - if (!req) /*guard against callers passing in null */ 418 - return -EINVAL; 419 - 420 - if (WARN(!dev_pm_qos_request_active(req), 421 - "%s() called for unknown object\n", __func__)) 422 - return -EINVAL; 421 + int ret; 423 422 424 423 mutex_lock(&dev_pm_qos_mtx); 425 - 426 - if (req->dev->power.qos) { 427 - ret = apply_constraint(req, PM_QOS_REMOVE_REQ, 428 - PM_QOS_DEFAULT_VALUE); 429 - memset(req, 0, sizeof(*req)); 430 - } else { 431 - /* Return if the device has been removed */ 432 - ret = -ENODEV; 433 - } 434 - 424 + ret = __dev_pm_qos_remove_request(req); 435 425 mutex_unlock(&dev_pm_qos_mtx); 436 426 return ret; 437 427 } ··· 440 462 441 463 mutex_lock(&dev_pm_qos_mtx); 442 464 443 - if (!dev->power.qos) 444 - ret = dev->power.power_state.event != PM_EVENT_INVALID ? 445 - dev_pm_qos_constraints_allocate(dev) : -ENODEV; 465 + if (IS_ERR(dev->power.qos)) 466 + ret = -ENODEV; 467 + else if (!dev->power.qos) 468 + ret = dev_pm_qos_constraints_allocate(dev); 446 469 447 470 if (!ret) 448 471 ret = blocking_notifier_chain_register( ··· 472 493 mutex_lock(&dev_pm_qos_mtx); 473 494 474 495 /* Silently return if the constraints object is not present. */ 475 - if (dev->power.qos) 496 + if (!IS_ERR_OR_NULL(dev->power.qos)) 476 497 retval = blocking_notifier_chain_unregister( 477 498 dev->power.qos->latency.notifiers, 478 499 notifier); ··· 542 563 static void __dev_pm_qos_drop_user_request(struct device *dev, 543 564 enum dev_pm_qos_req_type type) 544 565 { 566 + struct dev_pm_qos_request *req = NULL; 567 + 545 568 switch(type) { 546 569 case DEV_PM_QOS_LATENCY: 547 - dev_pm_qos_remove_request(dev->power.qos->latency_req); 570 + req = dev->power.qos->latency_req; 548 571 dev->power.qos->latency_req = NULL; 549 572 break; 550 573 case DEV_PM_QOS_FLAGS: 551 - dev_pm_qos_remove_request(dev->power.qos->flags_req); 574 + req = dev->power.qos->flags_req; 552 575 dev->power.qos->flags_req = NULL; 553 576 break; 554 577 } 578 + __dev_pm_qos_remove_request(req); 579 + kfree(req); 555 580 } 556 581 557 582 /** ··· 571 588 if (!device_is_registered(dev) || value < 0) 572 589 return -EINVAL; 573 590 574 - if (dev->power.qos && dev->power.qos->latency_req) 575 - return -EEXIST; 576 - 577 591 req = kzalloc(sizeof(*req), GFP_KERNEL); 578 592 if (!req) 579 593 return -ENOMEM; 580 594 581 595 ret = dev_pm_qos_add_request(dev, req, DEV_PM_QOS_LATENCY, value); 582 - if (ret < 0) 596 + if (ret < 0) { 597 + kfree(req); 583 598 return ret; 599 + } 600 + 601 + mutex_lock(&dev_pm_qos_mtx); 602 + 603 + if (IS_ERR_OR_NULL(dev->power.qos)) 604 + ret = -ENODEV; 605 + else if (dev->power.qos->latency_req) 606 + ret = -EEXIST; 607 + 608 + if (ret < 0) { 609 + __dev_pm_qos_remove_request(req); 610 + kfree(req); 611 + goto out; 612 + } 584 613 585 614 dev->power.qos->latency_req = req; 586 615 ret = pm_qos_sysfs_add_latency(dev); 587 616 if (ret) 588 617 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); 589 618 619 + out: 620 + mutex_unlock(&dev_pm_qos_mtx); 590 621 return ret; 591 622 } 592 623 EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit); 624 + 625 + static void __dev_pm_qos_hide_latency_limit(struct device *dev) 626 + { 627 + if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req) { 628 + pm_qos_sysfs_remove_latency(dev); 629 + __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); 630 + } 631 + } 593 632 594 633 /** 595 634 * dev_pm_qos_hide_latency_limit - Hide PM QoS latency limit from user space. ··· 619 614 */ 620 615 void dev_pm_qos_hide_latency_limit(struct device *dev) 621 616 { 622 - if (dev->power.qos && dev->power.qos->latency_req) { 623 - pm_qos_sysfs_remove_latency(dev); 624 - __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY); 625 - } 617 + mutex_lock(&dev_pm_qos_mtx); 618 + __dev_pm_qos_hide_latency_limit(dev); 619 + mutex_unlock(&dev_pm_qos_mtx); 626 620 } 627 621 EXPORT_SYMBOL_GPL(dev_pm_qos_hide_latency_limit); 628 622 ··· 638 634 if (!device_is_registered(dev)) 639 635 return -EINVAL; 640 636 641 - if (dev->power.qos && dev->power.qos->flags_req) 642 - return -EEXIST; 643 - 644 637 req = kzalloc(sizeof(*req), GFP_KERNEL); 645 638 if (!req) 646 639 return -ENOMEM; 647 640 648 - pm_runtime_get_sync(dev); 649 641 ret = dev_pm_qos_add_request(dev, req, DEV_PM_QOS_FLAGS, val); 650 - if (ret < 0) 651 - goto fail; 642 + if (ret < 0) { 643 + kfree(req); 644 + return ret; 645 + } 646 + 647 + pm_runtime_get_sync(dev); 648 + mutex_lock(&dev_pm_qos_mtx); 649 + 650 + if (IS_ERR_OR_NULL(dev->power.qos)) 651 + ret = -ENODEV; 652 + else if (dev->power.qos->flags_req) 653 + ret = -EEXIST; 654 + 655 + if (ret < 0) { 656 + __dev_pm_qos_remove_request(req); 657 + kfree(req); 658 + goto out; 659 + } 652 660 653 661 dev->power.qos->flags_req = req; 654 662 ret = pm_qos_sysfs_add_flags(dev); 655 663 if (ret) 656 664 __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); 657 665 658 - fail: 666 + out: 667 + mutex_unlock(&dev_pm_qos_mtx); 659 668 pm_runtime_put(dev); 660 669 return ret; 661 670 } 662 671 EXPORT_SYMBOL_GPL(dev_pm_qos_expose_flags); 672 + 673 + static void __dev_pm_qos_hide_flags(struct device *dev) 674 + { 675 + if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->flags_req) { 676 + pm_qos_sysfs_remove_flags(dev); 677 + __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); 678 + } 679 + } 663 680 664 681 /** 665 682 * dev_pm_qos_hide_flags - Hide PM QoS flags of a device from user space. ··· 688 663 */ 689 664 void dev_pm_qos_hide_flags(struct device *dev) 690 665 { 691 - if (dev->power.qos && dev->power.qos->flags_req) { 692 - pm_qos_sysfs_remove_flags(dev); 693 - pm_runtime_get_sync(dev); 694 - __dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_FLAGS); 695 - pm_runtime_put(dev); 696 - } 666 + pm_runtime_get_sync(dev); 667 + mutex_lock(&dev_pm_qos_mtx); 668 + __dev_pm_qos_hide_flags(dev); 669 + mutex_unlock(&dev_pm_qos_mtx); 670 + pm_runtime_put(dev); 697 671 } 698 672 EXPORT_SYMBOL_GPL(dev_pm_qos_hide_flags); 699 673 ··· 707 683 s32 value; 708 684 int ret; 709 685 710 - if (!dev->power.qos || !dev->power.qos->flags_req) 711 - return -EINVAL; 712 - 713 686 pm_runtime_get_sync(dev); 714 687 mutex_lock(&dev_pm_qos_mtx); 688 + 689 + if (IS_ERR_OR_NULL(dev->power.qos) || !dev->power.qos->flags_req) { 690 + ret = -EINVAL; 691 + goto out; 692 + } 715 693 716 694 value = dev_pm_qos_requested_flags(dev); 717 695 if (set) ··· 723 697 724 698 ret = __dev_pm_qos_update_request(dev->power.qos->flags_req, value); 725 699 700 + out: 726 701 mutex_unlock(&dev_pm_qos_mtx); 727 702 pm_runtime_put(dev); 728 - 729 703 return ret; 730 704 } 705 + #else /* !CONFIG_PM_RUNTIME */ 706 + static void __dev_pm_qos_hide_latency_limit(struct device *dev) {} 707 + static void __dev_pm_qos_hide_flags(struct device *dev) {} 731 708 #endif /* CONFIG_PM_RUNTIME */
+1
drivers/base/power/sysfs.c
··· 708 708 709 709 void dpm_sysfs_remove(struct device *dev) 710 710 { 711 + dev_pm_qos_constraints_destroy(dev); 711 712 rpm_sysfs_remove(dev); 712 713 sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group); 713 714 sysfs_remove_group(&dev->kobj, &pm_attr_group);
+1 -1
drivers/cpufreq/cpufreq_governor.h
··· 64 64 * dbs: used as a shortform for demand based switching It helps to keep variable 65 65 * names smaller, simpler 66 66 * cdbs: common dbs 67 - * on_*: On-demand governor 67 + * od_*: On-demand governor 68 68 * cs_*: Conservative governor 69 69 */ 70 70
+1 -7
drivers/cpufreq/highbank-cpufreq.c
··· 28 28 29 29 static int hb_voltage_change(unsigned int freq) 30 30 { 31 - int i; 32 - u32 msg[HB_CPUFREQ_IPC_LEN]; 33 - 34 - msg[0] = HB_CPUFREQ_CHANGE_NOTE; 35 - msg[1] = freq / 1000000; 36 - for (i = 2; i < HB_CPUFREQ_IPC_LEN; i++) 37 - msg[i] = 0; 31 + u32 msg[HB_CPUFREQ_IPC_LEN] = {HB_CPUFREQ_CHANGE_NOTE, freq / 1000000}; 38 32 39 33 return pl320_ipc_transmit(msg); 40 34 }
+14 -28
drivers/cpufreq/intel_pstate.c
··· 662 662 663 663 cpu = all_cpu_data[policy->cpu]; 664 664 665 + if (!policy->cpuinfo.max_freq) 666 + return -ENODEV; 667 + 665 668 intel_pstate_get_min_max(cpu, &min, &max); 666 669 667 670 limits.min_perf_pct = (policy->min * 100) / policy->cpuinfo.max_freq; ··· 750 747 .owner = THIS_MODULE, 751 748 }; 752 749 753 - static void intel_pstate_exit(void) 754 - { 755 - int cpu; 756 - 757 - sysfs_remove_group(intel_pstate_kobject, 758 - &intel_pstate_attr_group); 759 - debugfs_remove_recursive(debugfs_parent); 760 - 761 - cpufreq_unregister_driver(&intel_pstate_driver); 762 - 763 - if (!all_cpu_data) 764 - return; 765 - 766 - get_online_cpus(); 767 - for_each_online_cpu(cpu) { 768 - if (all_cpu_data[cpu]) { 769 - del_timer_sync(&all_cpu_data[cpu]->timer); 770 - kfree(all_cpu_data[cpu]); 771 - } 772 - } 773 - 774 - put_online_cpus(); 775 - vfree(all_cpu_data); 776 - } 777 - module_exit(intel_pstate_exit); 778 - 779 750 static int __initdata no_load; 780 751 781 752 static int __init intel_pstate_init(void) 782 753 { 783 - int rc = 0; 754 + int cpu, rc = 0; 784 755 const struct x86_cpu_id *id; 785 756 786 757 if (no_load) ··· 779 802 intel_pstate_sysfs_expose_params(); 780 803 return rc; 781 804 out: 782 - intel_pstate_exit(); 805 + get_online_cpus(); 806 + for_each_online_cpu(cpu) { 807 + if (all_cpu_data[cpu]) { 808 + del_timer_sync(&all_cpu_data[cpu]->timer); 809 + kfree(all_cpu_data[cpu]); 810 + } 811 + } 812 + 813 + put_online_cpus(); 814 + vfree(all_cpu_data); 783 815 return -ENODEV; 784 816 } 785 817 device_initcall(intel_pstate_init);
+1 -2
drivers/mailbox/pl320-ipc.c
··· 138 138 } 139 139 EXPORT_SYMBOL_GPL(pl320_ipc_unregister_notifier); 140 140 141 - static int __init pl320_probe(struct amba_device *adev, 142 - const struct amba_id *id) 141 + static int pl320_probe(struct amba_device *adev, const struct amba_id *id) 143 142 { 144 143 int ret; 145 144
+7 -1
drivers/pci/pci-acpi.c
··· 331 331 } 332 332 } 333 333 334 + static bool pci_acpi_bus_match(struct device *dev) 335 + { 336 + return dev->bus == &pci_bus_type; 337 + } 338 + 334 339 static struct acpi_bus_type acpi_pci_bus = { 335 - .bus = &pci_bus_type, 340 + .name = "PCI", 341 + .match = pci_acpi_bus_match, 336 342 .find_device = acpi_pci_find_device, 337 343 .setup = pci_acpi_setup, 338 344 .cleanup = pci_acpi_cleanup,
+7 -1
drivers/pnp/pnpacpi/core.c
··· 353 353 /* complete initialization of a PNPACPI device includes having 354 354 * pnpdev->dev.archdata.acpi_handle point to its ACPI sibling. 355 355 */ 356 + static bool acpi_pnp_bus_match(struct device *dev) 357 + { 358 + return dev->bus == &pnp_bus_type; 359 + } 360 + 356 361 static struct acpi_bus_type __initdata acpi_pnp_bus = { 357 - .bus = &pnp_bus_type, 362 + .name = "PNP", 363 + .match = acpi_pnp_bus_match, 358 364 .find_device = acpi_pnp_find_device, 359 365 }; 360 366
+6 -1
drivers/scsi/scsi_lib.c
··· 71 71 #ifdef CONFIG_ACPI 72 72 #include <acpi/acpi_bus.h> 73 73 74 + static bool acpi_scsi_bus_match(struct device *dev) 75 + { 76 + return dev->bus == &scsi_bus_type; 77 + } 78 + 74 79 int scsi_register_acpi_bus_type(struct acpi_bus_type *bus) 75 80 { 76 - bus->bus = &scsi_bus_type; 81 + bus->match = acpi_scsi_bus_match; 77 82 return register_acpi_bus_type(bus); 78 83 } 79 84 EXPORT_SYMBOL_GPL(scsi_register_acpi_bus_type);
+7 -2
drivers/usb/core/usb-acpi.c
··· 210 210 return 0; 211 211 } 212 212 213 + static bool usb_acpi_bus_match(struct device *dev) 214 + { 215 + return is_usb_device(dev) || is_usb_port(dev); 216 + } 217 + 213 218 static struct acpi_bus_type usb_acpi_bus = { 214 - .bus = &usb_bus_type, 215 - .find_bridge = usb_acpi_find_device, 219 + .name = "USB", 220 + .match = usb_acpi_bus_match, 216 221 .find_device = usb_acpi_find_device, 217 222 }; 218 223
+2 -4
include/acpi/acpi_bus.h
··· 437 437 */ 438 438 struct acpi_bus_type { 439 439 struct list_head list; 440 - struct bus_type *bus; 441 - /* For general devices under the bus */ 440 + const char *name; 441 + bool (*match)(struct device *dev); 442 442 int (*find_device) (struct device *, acpi_handle *); 443 - /* For bridges, such as PCI root bridge, IDE controller */ 444 - int (*find_bridge) (struct device *, acpi_handle *); 445 443 void (*setup)(struct device *); 446 444 void (*cleanup)(struct device *); 447 445 };