aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2009-05-24 16:05:42 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2009-06-12 15:32:31 -0400
commitd161630297a20802d01c55847bfcba85d2118a9f (patch)
tree51685c169319400b6da4dc6c56b69e731c45f297 /drivers/base
parente39a71ef80877f4e30d808af9acceec80f4d2f7c (diff)
PM core: rename suspend and resume functions
This patch (as1241) renames a bunch of functions in the PM core. Rather than go through a boring list of name changes, suffice it to say that in the end we have a bunch of pairs of functions: device_resume_noirq dpm_resume_noirq device_resume dpm_resume device_complete dpm_complete device_suspend_noirq dpm_suspend_noirq device_suspend dpm_suspend device_prepare dpm_prepare in which device_X does the X operation on a single device and dpm_X invokes device_X for all devices in the dpm_list. In addition, the old dpm_power_up and device_resume_noirq have been combined into a single function (dpm_resume_noirq). Lastly, dpm_suspend_start and dpm_resume_end are the renamed versions of the former top-level device_suspend and device_resume routines. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Acked-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/main.c80
1 files changed, 34 insertions, 46 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index c5a35bc9d63b..1f3d82260db4 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -315,13 +315,13 @@ static void pm_dev_err(struct device *dev, pm_message_t state, char *info,
315/*------------------------- Resume routines -------------------------*/ 315/*------------------------- Resume routines -------------------------*/
316 316
317/** 317/**
318 * __device_resume_noirq - Power on one device (early resume). 318 * device_resume_noirq - Power on one device (early resume).
319 * @dev: Device. 319 * @dev: Device.
320 * @state: PM transition of the system being carried out. 320 * @state: PM transition of the system being carried out.
321 * 321 *
322 * Must be called with interrupts disabled. 322 * Must be called with interrupts disabled.
323 */ 323 */
324static int __device_resume_noirq(struct device *dev, pm_message_t state) 324static int device_resume_noirq(struct device *dev, pm_message_t state)
325{ 325{
326 int error = 0; 326 int error = 0;
327 327
@@ -344,16 +344,16 @@ static int __device_resume_noirq(struct device *dev, pm_message_t state)
344} 344}
345 345
346/** 346/**
347 * dpm_power_up - Power on all regular (non-sysdev) devices. 347 * dpm_resume_noirq - Power on all regular (non-sysdev) devices.
348 * @state: PM transition of the system being carried out. 348 * @state: PM transition of the system being carried out.
349 * 349 *
350 * Execute the appropriate "noirq resume" callback for all devices marked 350 * Call the "noirq" resume handlers for all devices marked as
351 * as DPM_OFF_IRQ. 351 * DPM_OFF_IRQ and enable device drivers to receive interrupts.
352 * 352 *
353 * Must be called under dpm_list_mtx. Device drivers should not receive 353 * Must be called under dpm_list_mtx. Device drivers should not receive
354 * interrupts while it's being executed. 354 * interrupts while it's being executed.
355 */ 355 */
356static void dpm_power_up(pm_message_t state) 356void dpm_resume_noirq(pm_message_t state)
357{ 357{
358 struct device *dev; 358 struct device *dev;
359 359
@@ -363,33 +363,21 @@ static void dpm_power_up(pm_message_t state)
363 int error; 363 int error;
364 364
365 dev->power.status = DPM_OFF; 365 dev->power.status = DPM_OFF;
366 error = __device_resume_noirq(dev, state); 366 error = device_resume_noirq(dev, state);
367 if (error) 367 if (error)
368 pm_dev_err(dev, state, " early", error); 368 pm_dev_err(dev, state, " early", error);
369 } 369 }
370 mutex_unlock(&dpm_list_mtx); 370 mutex_unlock(&dpm_list_mtx);
371}
372
373/**
374 * device_resume_noirq - Turn on all devices that need special attention.
375 * @state: PM transition of the system being carried out.
376 *
377 * Call the "early" resume handlers and enable device drivers to receive
378 * interrupts.
379 */
380void device_resume_noirq(pm_message_t state)
381{
382 dpm_power_up(state);
383 resume_device_irqs(); 371 resume_device_irqs();
384} 372}
385EXPORT_SYMBOL_GPL(device_resume_noirq); 373EXPORT_SYMBOL_GPL(dpm_resume_noirq);
386 374
387/** 375/**
388 * resume_device - Restore state for one device. 376 * device_resume - Restore state for one device.
389 * @dev: Device. 377 * @dev: Device.
390 * @state: PM transition of the system being carried out. 378 * @state: PM transition of the system being carried out.
391 */ 379 */
392static int resume_device(struct device *dev, pm_message_t state) 380static int device_resume(struct device *dev, pm_message_t state)
393{ 381{
394 int error = 0; 382 int error = 0;
395 383
@@ -462,7 +450,7 @@ static void dpm_resume(pm_message_t state)
462 dev->power.status = DPM_RESUMING; 450 dev->power.status = DPM_RESUMING;
463 mutex_unlock(&dpm_list_mtx); 451 mutex_unlock(&dpm_list_mtx);
464 452
465 error = resume_device(dev, state); 453 error = device_resume(dev, state);
466 454
467 mutex_lock(&dpm_list_mtx); 455 mutex_lock(&dpm_list_mtx);
468 if (error) 456 if (error)
@@ -480,11 +468,11 @@ static void dpm_resume(pm_message_t state)
480} 468}
481 469
482/** 470/**
483 * complete_device - Complete a PM transition for given device 471 * device_complete - Complete a PM transition for given device
484 * @dev: Device. 472 * @dev: Device.
485 * @state: PM transition of the system being carried out. 473 * @state: PM transition of the system being carried out.
486 */ 474 */
487static void complete_device(struct device *dev, pm_message_t state) 475static void device_complete(struct device *dev, pm_message_t state)
488{ 476{
489 down(&dev->sem); 477 down(&dev->sem);
490 478
@@ -527,7 +515,7 @@ static void dpm_complete(pm_message_t state)
527 dev->power.status = DPM_ON; 515 dev->power.status = DPM_ON;
528 mutex_unlock(&dpm_list_mtx); 516 mutex_unlock(&dpm_list_mtx);
529 517
530 complete_device(dev, state); 518 device_complete(dev, state);
531 519
532 mutex_lock(&dpm_list_mtx); 520 mutex_lock(&dpm_list_mtx);
533 } 521 }
@@ -540,19 +528,19 @@ static void dpm_complete(pm_message_t state)
540} 528}
541 529
542/** 530/**
543 * device_resume - Restore state of each device in system. 531 * dpm_resume_end - Restore state of each device in system.
544 * @state: PM transition of the system being carried out. 532 * @state: PM transition of the system being carried out.
545 * 533 *
546 * Resume all the devices, unlock them all, and allow new 534 * Resume all the devices, unlock them all, and allow new
547 * devices to be registered once again. 535 * devices to be registered once again.
548 */ 536 */
549void device_resume(pm_message_t state) 537void dpm_resume_end(pm_message_t state)
550{ 538{
551 might_sleep(); 539 might_sleep();
552 dpm_resume(state); 540 dpm_resume(state);
553 dpm_complete(state); 541 dpm_complete(state);
554} 542}
555EXPORT_SYMBOL_GPL(device_resume); 543EXPORT_SYMBOL_GPL(dpm_resume_end);
556 544
557 545
558/*------------------------- Suspend routines -------------------------*/ 546/*------------------------- Suspend routines -------------------------*/
@@ -577,13 +565,13 @@ static pm_message_t resume_event(pm_message_t sleep_state)
577} 565}
578 566
579/** 567/**
580 * __device_suspend_noirq - Shut down one device (late suspend). 568 * device_suspend_noirq - Shut down one device (late suspend).
581 * @dev: Device. 569 * @dev: Device.
582 * @state: PM transition of the system being carried out. 570 * @state: PM transition of the system being carried out.
583 * 571 *
584 * This is called with interrupts off and only a single CPU running. 572 * This is called with interrupts off and only a single CPU running.
585 */ 573 */
586static int __device_suspend_noirq(struct device *dev, pm_message_t state) 574static int device_suspend_noirq(struct device *dev, pm_message_t state)
587{ 575{
588 int error = 0; 576 int error = 0;
589 577
@@ -602,15 +590,15 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state)
602} 590}
603 591
604/** 592/**
605 * device_suspend_noirq - Shut down special devices. 593 * dpm_suspend_noirq - Power down all regular (non-sysdev) devices.
606 * @state: PM transition of the system being carried out. 594 * @state: PM transition of the system being carried out.
607 * 595 *
608 * Prevent device drivers from receiving interrupts and call the "late" 596 * Prevent device drivers from receiving interrupts and call the "noirq"
609 * suspend handlers. 597 * suspend handlers.
610 * 598 *
611 * Must be called under dpm_list_mtx. 599 * Must be called under dpm_list_mtx.
612 */ 600 */
613int device_suspend_noirq(pm_message_t state) 601int dpm_suspend_noirq(pm_message_t state)
614{ 602{
615 struct device *dev; 603 struct device *dev;
616 int error = 0; 604 int error = 0;
@@ -618,7 +606,7 @@ int device_suspend_noirq(pm_message_t state)
618 suspend_device_irqs(); 606 suspend_device_irqs();
619 mutex_lock(&dpm_list_mtx); 607 mutex_lock(&dpm_list_mtx);
620 list_for_each_entry_reverse(dev, &dpm_list, power.entry) { 608 list_for_each_entry_reverse(dev, &dpm_list, power.entry) {
621 error = __device_suspend_noirq(dev, state); 609 error = device_suspend_noirq(dev, state);
622 if (error) { 610 if (error) {
623 pm_dev_err(dev, state, " late", error); 611 pm_dev_err(dev, state, " late", error);
624 break; 612 break;
@@ -627,17 +615,17 @@ int device_suspend_noirq(pm_message_t state)
627 } 615 }
628 mutex_unlock(&dpm_list_mtx); 616 mutex_unlock(&dpm_list_mtx);
629 if (error) 617 if (error)
630 device_resume_noirq(resume_event(state)); 618 dpm_resume_noirq(resume_event(state));
631 return error; 619 return error;
632} 620}
633EXPORT_SYMBOL_GPL(device_suspend_noirq); 621EXPORT_SYMBOL_GPL(dpm_suspend_noirq);
634 622
635/** 623/**
636 * suspend_device - Save state of one device. 624 * device_suspend - Save state of one device.
637 * @dev: Device. 625 * @dev: Device.
638 * @state: PM transition of the system being carried out. 626 * @state: PM transition of the system being carried out.
639 */ 627 */
640static int suspend_device(struct device *dev, pm_message_t state) 628static int device_suspend(struct device *dev, pm_message_t state)
641{ 629{
642 int error = 0; 630 int error = 0;
643 631
@@ -704,7 +692,7 @@ static int dpm_suspend(pm_message_t state)
704 get_device(dev); 692 get_device(dev);
705 mutex_unlock(&dpm_list_mtx); 693 mutex_unlock(&dpm_list_mtx);
706 694
707 error = suspend_device(dev, state); 695 error = device_suspend(dev, state);
708 696
709 mutex_lock(&dpm_list_mtx); 697 mutex_lock(&dpm_list_mtx);
710 if (error) { 698 if (error) {
@@ -723,11 +711,11 @@ static int dpm_suspend(pm_message_t state)
723} 711}
724 712
725/** 713/**
726 * prepare_device - Execute the ->prepare() callback(s) for given device. 714 * device_prepare - Execute the ->prepare() callback(s) for given device.
727 * @dev: Device. 715 * @dev: Device.
728 * @state: PM transition of the system being carried out. 716 * @state: PM transition of the system being carried out.
729 */ 717 */
730static int prepare_device(struct device *dev, pm_message_t state) 718static int device_prepare(struct device *dev, pm_message_t state)
731{ 719{
732 int error = 0; 720 int error = 0;
733 721
@@ -781,7 +769,7 @@ static int dpm_prepare(pm_message_t state)
781 dev->power.status = DPM_PREPARING; 769 dev->power.status = DPM_PREPARING;
782 mutex_unlock(&dpm_list_mtx); 770 mutex_unlock(&dpm_list_mtx);
783 771
784 error = prepare_device(dev, state); 772 error = device_prepare(dev, state);
785 773
786 mutex_lock(&dpm_list_mtx); 774 mutex_lock(&dpm_list_mtx);
787 if (error) { 775 if (error) {
@@ -807,12 +795,12 @@ static int dpm_prepare(pm_message_t state)
807} 795}
808 796
809/** 797/**
810 * device_suspend - Save state and stop all devices in system. 798 * dpm_suspend_start - Save state and stop all devices in system.
811 * @state: PM transition of the system being carried out. 799 * @state: PM transition of the system being carried out.
812 * 800 *
813 * Prepare and suspend all devices. 801 * Prepare and suspend all devices.
814 */ 802 */
815int device_suspend(pm_message_t state) 803int dpm_suspend_start(pm_message_t state)
816{ 804{
817 int error; 805 int error;
818 806
@@ -822,7 +810,7 @@ int device_suspend(pm_message_t state)
822 error = dpm_suspend(state); 810 error = dpm_suspend(state);
823 return error; 811 return error;
824} 812}
825EXPORT_SYMBOL_GPL(device_suspend); 813EXPORT_SYMBOL_GPL(dpm_suspend_start);
826 814
827void __suspend_report_result(const char *function, void *fn, int ret) 815void __suspend_report_result(const char *function, void *fn, int ret)
828{ 816{