aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2010-09-22 16:09:10 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2010-10-16 19:57:43 -0400
commit074037ec79bea73edf1b1ec72fef1010e83e3cc5 (patch)
tree1876caa07f755e680da5ea102d985efe4b508d56 /include/linux/pm.h
parent0702d9ee0f1dcb6258789032f03b3208bfafaffc (diff)
PM / Wakeup: Introduce wakeup source objects and event statistics (v3)
Introduce struct wakeup_source for representing system wakeup sources within the kernel and for collecting statistics related to them. Make the recently introduced helper functions pm_wakeup_event(), pm_stay_awake() and pm_relax() use struct wakeup_source objects internally, so that wakeup statistics associated with wakeup devices can be collected and reported in a consistent way (the definition of pm_relax() is changed, which is harmless, because this function is not called directly by anyone yet). Introduce new wakeup-related sysfs device attributes in /sys/devices/.../power for reporting the device wakeup statistics. Change the global wakeup events counters event_count and events_in_progress into atomic variables, so that it is not necessary to acquire a global spinlock in pm_wakeup_event(), pm_stay_awake() and pm_relax(), which should allow us to avoid lock contention in these functions on SMP systems with many wakeup devices. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/pm.h')
-rw-r--r--include/linux/pm.h16
1 files changed, 4 insertions, 12 deletions
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 52e8c55ff314..a84118911ced 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -448,23 +448,24 @@ enum rpm_request {
448 RPM_REQ_RESUME, 448 RPM_REQ_RESUME,
449}; 449};
450 450
451struct wakeup_source;
452
451struct dev_pm_info { 453struct dev_pm_info {
452 pm_message_t power_state; 454 pm_message_t power_state;
453 unsigned int can_wakeup:1; 455 unsigned int can_wakeup:1;
454 unsigned int should_wakeup:1;
455 unsigned async_suspend:1; 456 unsigned async_suspend:1;
456 enum dpm_state status; /* Owned by the PM core */ 457 enum dpm_state status; /* Owned by the PM core */
458 spinlock_t lock;
457#ifdef CONFIG_PM_SLEEP 459#ifdef CONFIG_PM_SLEEP
458 struct list_head entry; 460 struct list_head entry;
459 struct completion completion; 461 struct completion completion;
460 unsigned long wakeup_count; 462 struct wakeup_source *wakeup;
461#endif 463#endif
462#ifdef CONFIG_PM_RUNTIME 464#ifdef CONFIG_PM_RUNTIME
463 struct timer_list suspend_timer; 465 struct timer_list suspend_timer;
464 unsigned long timer_expires; 466 unsigned long timer_expires;
465 struct work_struct work; 467 struct work_struct work;
466 wait_queue_head_t wait_queue; 468 wait_queue_head_t wait_queue;
467 spinlock_t lock;
468 atomic_t usage_count; 469 atomic_t usage_count;
469 atomic_t child_count; 470 atomic_t child_count;
470 unsigned int disable_depth:3; 471 unsigned int disable_depth:3;
@@ -559,11 +560,6 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
559 } while (0) 560 } while (0)
560 561
561extern void device_pm_wait_for_dev(struct device *sub, struct device *dev); 562extern void device_pm_wait_for_dev(struct device *sub, struct device *dev);
562
563/* drivers/base/power/wakeup.c */
564extern void pm_wakeup_event(struct device *dev, unsigned int msec);
565extern void pm_stay_awake(struct device *dev);
566extern void pm_relax(void);
567#else /* !CONFIG_PM_SLEEP */ 563#else /* !CONFIG_PM_SLEEP */
568 564
569#define device_pm_lock() do {} while (0) 565#define device_pm_lock() do {} while (0)
@@ -577,10 +573,6 @@ static inline int dpm_suspend_start(pm_message_t state)
577#define suspend_report_result(fn, ret) do {} while (0) 573#define suspend_report_result(fn, ret) do {} while (0)
578 574
579static inline void device_pm_wait_for_dev(struct device *a, struct device *b) {} 575static inline void device_pm_wait_for_dev(struct device *a, struct device *b) {}
580
581static inline void pm_wakeup_event(struct device *dev, unsigned int msec) {}
582static inline void pm_stay_awake(struct device *dev) {}
583static inline void pm_relax(void) {}
584#endif /* !CONFIG_PM_SLEEP */ 576#endif /* !CONFIG_PM_SLEEP */
585 577
586/* How to reorder dpm_list after device_move() */ 578/* How to reorder dpm_list after device_move() */