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 branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6:
PM: Runtime PM documentation update
PM / Runtime: Use device type and device class callbacks
PM: Use pm_runtime_put_sync in system resume
PM: Measure device suspend and resume times
PM: Make the initcall_debug style timing for suspend/resume complete

+282 -102
+131 -80
Documentation/power/runtime_pm.txt
··· 42 42 ... 43 43 }; 44 44 45 - The ->runtime_suspend() callback is executed by the PM core for the bus type of 46 - the device being suspended. The bus type's callback is then _entirely_ 47 - _responsible_ for handling the device as appropriate, which may, but need not 48 - include executing the device driver's own ->runtime_suspend() callback (from the 49 - PM core's point of view it is not necessary to implement a ->runtime_suspend() 50 - callback in a device driver as long as the bus type's ->runtime_suspend() knows 51 - what to do to handle the device). 45 + The ->runtime_suspend(), ->runtime_resume() and ->runtime_idle() callbacks are 46 + executed by the PM core for either the bus type, or device type (if the bus 47 + type's callback is not defined), or device class (if the bus type's and device 48 + type's callbacks are not defined) of given device. The bus type, device type 49 + and device class callbacks are referred to as subsystem-level callbacks in what 50 + follows. 52 51 53 - * Once the bus type's ->runtime_suspend() callback has completed successfully 52 + The subsystem-level suspend callback is _entirely_ _responsible_ for handling 53 + the suspend of the device as appropriate, which may, but need not include 54 + executing the device driver's own ->runtime_suspend() callback (from the 55 + PM core's point of view it is not necessary to implement a ->runtime_suspend() 56 + callback in a device driver as long as the subsystem-level suspend callback 57 + knows what to do to handle the device). 58 + 59 + * Once the subsystem-level suspend callback has completed successfully 54 60 for given device, the PM core regards the device as suspended, which need 55 61 not mean that the device has been put into a low power state. It is 56 62 supposed to mean, however, that the device will not process data and will 57 - not communicate with the CPU(s) and RAM until its bus type's 58 - ->runtime_resume() callback is executed for it. The run-time PM status of 59 - a device after successful execution of its bus type's ->runtime_suspend() 60 - callback is 'suspended'. 63 + not communicate with the CPU(s) and RAM until the subsystem-level resume 64 + callback is executed for it. The run-time PM status of a device after 65 + successful execution of the subsystem-level suspend callback is 'suspended'. 61 66 62 - * If the bus type's ->runtime_suspend() callback returns -EBUSY or -EAGAIN, 63 - the device's run-time PM status is supposed to be 'active', which means that 64 - the device _must_ be fully operational afterwards. 67 + * If the subsystem-level suspend callback returns -EBUSY or -EAGAIN, 68 + the device's run-time PM status is 'active', which means that the device 69 + _must_ be fully operational afterwards. 65 70 66 - * If the bus type's ->runtime_suspend() callback returns an error code 67 - different from -EBUSY or -EAGAIN, the PM core regards this as a fatal 68 - error and will refuse to run the helper functions described in Section 4 69 - for the device, until the status of it is directly set either to 'active' 70 - or to 'suspended' (the PM core provides special helper functions for this 71 - purpose). 71 + * If the subsystem-level suspend callback returns an error code different 72 + from -EBUSY or -EAGAIN, the PM core regards this as a fatal error and will 73 + refuse to run the helper functions described in Section 4 for the device, 74 + until the status of it is directly set either to 'active', or to 'suspended' 75 + (the PM core provides special helper functions for this purpose). 72 76 73 - In particular, if the driver requires remote wakeup capability for proper 74 - functioning and device_run_wake() returns 'false' for the device, then 75 - ->runtime_suspend() should return -EBUSY. On the other hand, if 76 - device_run_wake() returns 'true' for the device and the device is put 77 - into a low power state during the execution of its bus type's 78 - ->runtime_suspend(), it is expected that remote wake-up (i.e. hardware mechanism 79 - allowing the device to request a change of its power state, such as PCI PME) 80 - will be enabled for the device. Generally, remote wake-up should be enabled 81 - for all input devices put into a low power state at run time. 77 + In particular, if the driver requires remote wake-up capability (i.e. hardware 78 + mechanism allowing the device to request a change of its power state, such as 79 + PCI PME) for proper functioning and device_run_wake() returns 'false' for the 80 + device, then ->runtime_suspend() should return -EBUSY. On the other hand, if 81 + device_run_wake() returns 'true' for the device and the device is put into a low 82 + power state during the execution of the subsystem-level suspend callback, it is 83 + expected that remote wake-up will be enabled for the device. Generally, remote 84 + wake-up should be enabled for all input devices put into a low power state at 85 + run time. 82 86 83 - The ->runtime_resume() callback is executed by the PM core for the bus type of 84 - the device being woken up. The bus type's callback is then _entirely_ 85 - _responsible_ for handling the device as appropriate, which may, but need not 86 - include executing the device driver's own ->runtime_resume() callback (from the 87 - PM core's point of view it is not necessary to implement a ->runtime_resume() 88 - callback in a device driver as long as the bus type's ->runtime_resume() knows 89 - what to do to handle the device). 87 + The subsystem-level resume callback is _entirely_ _responsible_ for handling the 88 + resume of the device as appropriate, which may, but need not include executing 89 + the device driver's own ->runtime_resume() callback (from the PM core's point of 90 + view it is not necessary to implement a ->runtime_resume() callback in a device 91 + driver as long as the subsystem-level resume callback knows what to do to handle 92 + the device). 90 93 91 - * Once the bus type's ->runtime_resume() callback has completed successfully, 92 - the PM core regards the device as fully operational, which means that the 93 - device _must_ be able to complete I/O operations as needed. The run-time 94 - PM status of the device is then 'active'. 94 + * Once the subsystem-level resume callback has completed successfully, the PM 95 + core regards the device as fully operational, which means that the device 96 + _must_ be able to complete I/O operations as needed. The run-time PM status 97 + of the device is then 'active'. 95 98 96 - * If the bus type's ->runtime_resume() callback returns an error code, the PM 97 - core regards this as a fatal error and will refuse to run the helper 98 - functions described in Section 4 for the device, until its status is 99 - directly set either to 'active' or to 'suspended' (the PM core provides 100 - special helper functions for this purpose). 99 + * If the subsystem-level resume callback returns an error code, the PM core 100 + regards this as a fatal error and will refuse to run the helper functions 101 + described in Section 4 for the device, until its status is directly set 102 + either to 'active' or to 'suspended' (the PM core provides special helper 103 + functions for this purpose). 101 104 102 - The ->runtime_idle() callback is executed by the PM core for the bus type of 103 - given device whenever the device appears to be idle, which is indicated to the 104 - PM core by two counters, the device's usage counter and the counter of 'active' 105 - children of the device. 105 + The subsystem-level idle callback is executed by the PM core whenever the device 106 + appears to be idle, which is indicated to the PM core by two counters, the 107 + device's usage counter and the counter of 'active' children of the device. 106 108 107 109 * If any of these counters is decreased using a helper function provided by 108 110 the PM core and it turns out to be equal to zero, the other counter is 109 111 checked. If that counter also is equal to zero, the PM core executes the 110 - device bus type's ->runtime_idle() callback (with the device as an 111 - argument). 112 + subsystem-level idle callback with the device as an argument. 112 113 113 - The action performed by a bus type's ->runtime_idle() callback is totally 114 - dependent on the bus type in question, but the expected and recommended action 115 - is to check if the device can be suspended (i.e. if all of the conditions 116 - necessary for suspending the device are satisfied) and to queue up a suspend 117 - request for the device in that case. The value returned by this callback is 118 - ignored by the PM core. 114 + The action performed by a subsystem-level idle callback is totally dependent on 115 + the subsystem in question, but the expected and recommended action is to check 116 + if the device can be suspended (i.e. if all of the conditions necessary for 117 + suspending the device are satisfied) and to queue up a suspend request for the 118 + device in that case. The value returned by this callback is ignored by the PM 119 + core. 119 120 120 121 The helper functions provided by the PM core, described in Section 4, guarantee 121 122 that the following constraints are met with respect to the bus type's run-time ··· 239 238 removing the device from device hierarchy 240 239 241 240 int pm_runtime_idle(struct device *dev); 242 - - execute ->runtime_idle() for the device's bus type; returns 0 on success 243 - or error code on failure, where -EINPROGRESS means that ->runtime_idle() 244 - is already being executed 241 + - execute the subsystem-level idle callback for the device; returns 0 on 242 + success or error code on failure, where -EINPROGRESS means that 243 + ->runtime_idle() is already being executed 245 244 246 245 int pm_runtime_suspend(struct device *dev); 247 - - execute ->runtime_suspend() for the device's bus type; returns 0 on 246 + - execute the subsystem-level suspend callback for the device; returns 0 on 248 247 success, 1 if the device's run-time PM status was already 'suspended', or 249 248 error code on failure, where -EAGAIN or -EBUSY means it is safe to attempt 250 249 to suspend the device again in future 251 250 252 251 int pm_runtime_resume(struct device *dev); 253 - - execute ->runtime_resume() for the device's bus type; returns 0 on 252 + - execute the subsystem-leve resume callback for the device; returns 0 on 254 253 success, 1 if the device's run-time PM status was already 'active' or 255 254 error code on failure, where -EAGAIN means it may be safe to attempt to 256 255 resume the device again in future, but 'power.runtime_error' should be 257 256 checked additionally 258 257 259 258 int pm_request_idle(struct device *dev); 260 - - submit a request to execute ->runtime_idle() for the device's bus type 261 - (the request is represented by a work item in pm_wq); returns 0 on success 262 - or error code if the request has not been queued up 259 + - submit a request to execute the subsystem-level idle callback for the 260 + device (the request is represented by a work item in pm_wq); returns 0 on 261 + success or error code if the request has not been queued up 263 262 264 263 int pm_schedule_suspend(struct device *dev, unsigned int delay); 265 - - schedule the execution of ->runtime_suspend() for the device's bus type 266 - in future, where 'delay' is the time to wait before queuing up a suspend 267 - work item in pm_wq, in milliseconds (if 'delay' is zero, the work item is 268 - queued up immediately); returns 0 on success, 1 if the device's PM 264 + - schedule the execution of the subsystem-level suspend callback for the 265 + device in future, where 'delay' is the time to wait before queuing up a 266 + suspend work item in pm_wq, in milliseconds (if 'delay' is zero, the work 267 + item is queued up immediately); returns 0 on success, 1 if the device's PM 269 268 run-time status was already 'suspended', or error code if the request 270 269 hasn't been scheduled (or queued up if 'delay' is 0); if the execution of 271 270 ->runtime_suspend() is already scheduled and not yet expired, the new 272 271 value of 'delay' will be used as the time to wait 273 272 274 273 int pm_request_resume(struct device *dev); 275 - - submit a request to execute ->runtime_resume() for the device's bus type 276 - (the request is represented by a work item in pm_wq); returns 0 on 274 + - submit a request to execute the subsystem-level resume callback for the 275 + device (the request is represented by a work item in pm_wq); returns 0 on 277 276 success, 1 if the device's run-time PM status was already 'active', or 278 277 error code if the request hasn't been queued up 279 278 ··· 304 303 run-time PM callbacks described in Section 2 305 304 306 305 int pm_runtime_disable(struct device *dev); 307 - - prevent the run-time PM helper functions from running the device bus 308 - type's run-time PM callbacks, make sure that all of the pending run-time 309 - PM operations on the device are either completed or canceled; returns 310 - 1 if there was a resume request pending and it was necessary to execute 311 - ->runtime_resume() for the device's bus type to satisfy that request, 312 - otherwise 0 is returned 306 + - prevent the run-time PM helper functions from running subsystem-level 307 + run-time PM callbacks for the device, make sure that all of the pending 308 + run-time PM operations on the device are either completed or canceled; 309 + returns 1 if there was a resume request pending and it was necessary to 310 + execute the subsystem-level resume callback for the device to satisfy that 311 + request, otherwise 0 is returned 313 312 314 313 void pm_suspend_ignore_children(struct device *dev, bool enable); 315 314 - set/unset the power.ignore_children flag of the device ··· 379 378 they will fail returning -EAGAIN, because the device's usage counter is 380 379 incremented by the core before executing ->probe() and ->remove(). Still, it 381 380 may be desirable to suspend the device as soon as ->probe() or ->remove() has 382 - finished, so the PM core uses pm_runtime_idle_sync() to invoke the device bus 383 - type's ->runtime_idle() callback at that time. 381 + finished, so the PM core uses pm_runtime_idle_sync() to invoke the 382 + subsystem-level idle callback for the device at that time. 383 + 384 + 6. Run-time PM and System Sleep 385 + 386 + Run-time PM and system sleep (i.e., system suspend and hibernation, also known 387 + as suspend-to-RAM and suspend-to-disk) interact with each other in a couple of 388 + ways. If a device is active when a system sleep starts, everything is 389 + straightforward. But what should happen if the device is already suspended? 390 + 391 + The device may have different wake-up settings for run-time PM and system sleep. 392 + For example, remote wake-up may be enabled for run-time suspend but disallowed 393 + for system sleep (device_may_wakeup(dev) returns 'false'). When this happens, 394 + the subsystem-level system suspend callback is responsible for changing the 395 + device's wake-up setting (it may leave that to the device driver's system 396 + suspend routine). It may be necessary to resume the device and suspend it again 397 + in order to do so. The same is true if the driver uses different power levels 398 + or other settings for run-time suspend and system sleep. 399 + 400 + During system resume, devices generally should be brought back to full power, 401 + even if they were suspended before the system sleep began. There are several 402 + reasons for this, including: 403 + 404 + * The device might need to switch power levels, wake-up settings, etc. 405 + 406 + * Remote wake-up events might have been lost by the firmware. 407 + 408 + * The device's children may need the device to be at full power in order 409 + to resume themselves. 410 + 411 + * The driver's idea of the device state may not agree with the device's 412 + physical state. This can happen during resume from hibernation. 413 + 414 + * The device might need to be reset. 415 + 416 + * Even though the device was suspended, if its usage counter was > 0 then most 417 + likely it would need a run-time resume in the near future anyway. 418 + 419 + * Always going back to full power is simplest. 420 + 421 + If the device was suspended before the sleep began, then its run-time PM status 422 + will have to be updated to reflect the actual post-system sleep status. The way 423 + to do this is: 424 + 425 + pm_runtime_disable(dev); 426 + pm_runtime_set_active(dev); 427 + pm_runtime_enable(dev); 428 + 429 + The PM core always increments the run-time usage counter before calling the 430 + ->prepare() callback and decrements it after calling the ->complete() callback. 431 + Hence disabling run-time PM temporarily like this will not cause any run-time 432 + suspend callbacks to be lost.
+106 -22
drivers/base/power/main.c
··· 161 161 list_move_tail(&dev->power.entry, &dpm_list); 162 162 } 163 163 164 + static ktime_t initcall_debug_start(struct device *dev) 165 + { 166 + ktime_t calltime = ktime_set(0, 0); 167 + 168 + if (initcall_debug) { 169 + pr_info("calling %s+ @ %i\n", 170 + dev_name(dev), task_pid_nr(current)); 171 + calltime = ktime_get(); 172 + } 173 + 174 + return calltime; 175 + } 176 + 177 + static void initcall_debug_report(struct device *dev, ktime_t calltime, 178 + int error) 179 + { 180 + ktime_t delta, rettime; 181 + 182 + if (initcall_debug) { 183 + rettime = ktime_get(); 184 + delta = ktime_sub(rettime, calltime); 185 + pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev), 186 + error, (unsigned long long)ktime_to_ns(delta) >> 10); 187 + } 188 + } 189 + 164 190 /** 165 191 * pm_op - Execute the PM operation appropriate for given PM event. 166 192 * @dev: Device to handle. ··· 198 172 pm_message_t state) 199 173 { 200 174 int error = 0; 201 - ktime_t calltime, delta, rettime; 175 + ktime_t calltime; 202 176 203 - if (initcall_debug) { 204 - pr_info("calling %s+ @ %i\n", 205 - dev_name(dev), task_pid_nr(current)); 206 - calltime = ktime_get(); 207 - } 177 + calltime = initcall_debug_start(dev); 208 178 209 179 switch (state.event) { 210 180 #ifdef CONFIG_SUSPEND ··· 249 227 error = -EINVAL; 250 228 } 251 229 252 - if (initcall_debug) { 253 - rettime = ktime_get(); 254 - delta = ktime_sub(rettime, calltime); 255 - pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev), 256 - error, (unsigned long long)ktime_to_ns(delta) >> 10); 257 - } 230 + initcall_debug_report(dev, calltime, error); 258 231 259 232 return error; 260 233 } ··· 326 309 if (initcall_debug) { 327 310 rettime = ktime_get(); 328 311 delta = ktime_sub(rettime, calltime); 329 - printk("initcall %s_i+ returned %d after %Ld usecs\n", dev_name(dev), 330 - error, (unsigned long long)ktime_to_ns(delta) >> 10); 312 + printk("initcall %s_i+ returned %d after %Ld usecs\n", 313 + dev_name(dev), error, 314 + (unsigned long long)ktime_to_ns(delta) >> 10); 331 315 } 332 316 333 317 return error; ··· 372 354 kobject_name(&dev->kobj), pm_verb(state.event), info, error); 373 355 } 374 356 357 + static void dpm_show_time(ktime_t starttime, pm_message_t state, char *info) 358 + { 359 + ktime_t calltime; 360 + s64 usecs64; 361 + int usecs; 362 + 363 + calltime = ktime_get(); 364 + usecs64 = ktime_to_ns(ktime_sub(calltime, starttime)); 365 + do_div(usecs64, NSEC_PER_USEC); 366 + usecs = usecs64; 367 + if (usecs == 0) 368 + usecs = 1; 369 + pr_info("PM: %s%s%s of devices complete after %ld.%03ld msecs\n", 370 + info ?: "", info ? " " : "", pm_verb(state.event), 371 + usecs / USEC_PER_MSEC, usecs % USEC_PER_MSEC); 372 + } 373 + 375 374 /*------------------------- Resume routines -------------------------*/ 376 375 377 376 /** ··· 425 390 void dpm_resume_noirq(pm_message_t state) 426 391 { 427 392 struct device *dev; 393 + ktime_t starttime = ktime_get(); 428 394 429 395 mutex_lock(&dpm_list_mtx); 430 396 transition_started = false; ··· 439 403 pm_dev_err(dev, state, " early", error); 440 404 } 441 405 mutex_unlock(&dpm_list_mtx); 406 + dpm_show_time(starttime, state, "early"); 442 407 resume_device_irqs(); 443 408 } 444 409 EXPORT_SYMBOL_GPL(dpm_resume_noirq); 410 + 411 + /** 412 + * legacy_resume - Execute a legacy (bus or class) resume callback for device. 413 + * dev: Device to resume. 414 + * cb: Resume callback to execute. 415 + */ 416 + static int legacy_resume(struct device *dev, int (*cb)(struct device *dev)) 417 + { 418 + int error; 419 + ktime_t calltime; 420 + 421 + calltime = initcall_debug_start(dev); 422 + 423 + error = cb(dev); 424 + suspend_report_result(cb, error); 425 + 426 + initcall_debug_report(dev, calltime, error); 427 + 428 + return error; 429 + } 445 430 446 431 /** 447 432 * device_resume - Execute "resume" callbacks for given device. ··· 484 427 error = pm_op(dev, dev->bus->pm, state); 485 428 } else if (dev->bus->resume) { 486 429 pm_dev_dbg(dev, state, "legacy "); 487 - error = dev->bus->resume(dev); 430 + error = legacy_resume(dev, dev->bus->resume); 488 431 } 489 432 if (error) 490 433 goto End; ··· 505 448 error = pm_op(dev, dev->class->pm, state); 506 449 } else if (dev->class->resume) { 507 450 pm_dev_dbg(dev, state, "legacy class "); 508 - error = dev->class->resume(dev); 451 + error = legacy_resume(dev, dev->class->resume); 509 452 } 510 453 } 511 454 End: ··· 525 468 static void dpm_resume(pm_message_t state) 526 469 { 527 470 struct list_head list; 471 + ktime_t starttime = ktime_get(); 528 472 529 473 INIT_LIST_HEAD(&list); 530 474 mutex_lock(&dpm_list_mtx); ··· 554 496 } 555 497 list_splice(&list, &dpm_list); 556 498 mutex_unlock(&dpm_list_mtx); 499 + dpm_show_time(starttime, state, NULL); 557 500 } 558 501 559 502 /** ··· 607 548 mutex_unlock(&dpm_list_mtx); 608 549 609 550 device_complete(dev, state); 610 - pm_runtime_put_noidle(dev); 551 + pm_runtime_put_sync(dev); 611 552 612 553 mutex_lock(&dpm_list_mtx); 613 554 } ··· 687 628 int dpm_suspend_noirq(pm_message_t state) 688 629 { 689 630 struct device *dev; 631 + ktime_t starttime = ktime_get(); 690 632 int error = 0; 691 633 692 634 suspend_device_irqs(); ··· 703 643 mutex_unlock(&dpm_list_mtx); 704 644 if (error) 705 645 dpm_resume_noirq(resume_event(state)); 646 + else 647 + dpm_show_time(starttime, state, "late"); 706 648 return error; 707 649 } 708 650 EXPORT_SYMBOL_GPL(dpm_suspend_noirq); 651 + 652 + /** 653 + * legacy_suspend - Execute a legacy (bus or class) suspend callback for device. 654 + * dev: Device to suspend. 655 + * cb: Suspend callback to execute. 656 + */ 657 + static int legacy_suspend(struct device *dev, pm_message_t state, 658 + int (*cb)(struct device *dev, pm_message_t state)) 659 + { 660 + int error; 661 + ktime_t calltime; 662 + 663 + calltime = initcall_debug_start(dev); 664 + 665 + error = cb(dev, state); 666 + suspend_report_result(cb, error); 667 + 668 + initcall_debug_report(dev, calltime, error); 669 + 670 + return error; 671 + } 709 672 710 673 /** 711 674 * device_suspend - Execute "suspend" callbacks for given device. ··· 747 664 error = pm_op(dev, dev->class->pm, state); 748 665 } else if (dev->class->suspend) { 749 666 pm_dev_dbg(dev, state, "legacy class "); 750 - error = dev->class->suspend(dev, state); 751 - suspend_report_result(dev->class->suspend, error); 667 + error = legacy_suspend(dev, state, dev->class->suspend); 752 668 } 753 669 if (error) 754 670 goto End; ··· 768 686 error = pm_op(dev, dev->bus->pm, state); 769 687 } else if (dev->bus->suspend) { 770 688 pm_dev_dbg(dev, state, "legacy "); 771 - error = dev->bus->suspend(dev, state); 772 - suspend_report_result(dev->bus->suspend, error); 689 + error = legacy_suspend(dev, state, dev->bus->suspend); 773 690 } 774 691 } 775 692 End: ··· 784 703 static int dpm_suspend(pm_message_t state) 785 704 { 786 705 struct list_head list; 706 + ktime_t starttime = ktime_get(); 787 707 int error = 0; 788 708 789 709 INIT_LIST_HEAD(&list); ··· 810 728 } 811 729 list_splice(&list, dpm_list.prev); 812 730 mutex_unlock(&dpm_list_mtx); 731 + if (!error) 732 + dpm_show_time(starttime, state, NULL); 813 733 return error; 814 734 } 815 735 ··· 880 796 pm_runtime_get_noresume(dev); 881 797 if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) { 882 798 /* Wake-up requested during system sleep transition. */ 883 - pm_runtime_put_noidle(dev); 799 + pm_runtime_put_sync(dev); 884 800 error = -EBUSY; 885 801 } else { 886 802 error = device_prepare(dev, state);
+45
drivers/base/power/runtime.c
··· 85 85 dev->bus->pm->runtime_idle(dev); 86 86 87 87 spin_lock_irq(&dev->power.lock); 88 + } else if (dev->type && dev->type->pm && dev->type->pm->runtime_idle) { 89 + spin_unlock_irq(&dev->power.lock); 90 + 91 + dev->type->pm->runtime_idle(dev); 92 + 93 + spin_lock_irq(&dev->power.lock); 94 + } else if (dev->class && dev->class->pm 95 + && dev->class->pm->runtime_idle) { 96 + spin_unlock_irq(&dev->power.lock); 97 + 98 + dev->class->pm->runtime_idle(dev); 99 + 100 + spin_lock_irq(&dev->power.lock); 88 101 } 89 102 90 103 dev->power.idle_notification = false; ··· 204 191 spin_unlock_irq(&dev->power.lock); 205 192 206 193 retval = dev->bus->pm->runtime_suspend(dev); 194 + 195 + spin_lock_irq(&dev->power.lock); 196 + dev->power.runtime_error = retval; 197 + } else if (dev->type && dev->type->pm 198 + && dev->type->pm->runtime_suspend) { 199 + spin_unlock_irq(&dev->power.lock); 200 + 201 + retval = dev->type->pm->runtime_suspend(dev); 202 + 203 + spin_lock_irq(&dev->power.lock); 204 + dev->power.runtime_error = retval; 205 + } else if (dev->class && dev->class->pm 206 + && dev->class->pm->runtime_suspend) { 207 + spin_unlock_irq(&dev->power.lock); 208 + 209 + retval = dev->class->pm->runtime_suspend(dev); 207 210 208 211 spin_lock_irq(&dev->power.lock); 209 212 dev->power.runtime_error = retval; ··· 385 356 spin_unlock_irq(&dev->power.lock); 386 357 387 358 retval = dev->bus->pm->runtime_resume(dev); 359 + 360 + spin_lock_irq(&dev->power.lock); 361 + dev->power.runtime_error = retval; 362 + } else if (dev->type && dev->type->pm 363 + && dev->type->pm->runtime_resume) { 364 + spin_unlock_irq(&dev->power.lock); 365 + 366 + retval = dev->type->pm->runtime_resume(dev); 367 + 368 + spin_lock_irq(&dev->power.lock); 369 + dev->power.runtime_error = retval; 370 + } else if (dev->class && dev->class->pm 371 + && dev->class->pm->runtime_resume) { 372 + spin_unlock_irq(&dev->power.lock); 373 + 374 + retval = dev->class->pm->runtime_resume(dev); 388 375 389 376 spin_lock_irq(&dev->power.lock); 390 377 dev->power.runtime_error = retval;