Skip to content

Commit

Permalink
PM: Create PM workqueue if runtime PM is not configured too
Browse files Browse the repository at this point in the history
The PM workqueue is going to be used by ACPI PM notify handlers
regardless of whether or not runtime PM is configured, so move
it out of #ifdef CONFIG_PM_RUNTIME.

Do that in three places in the ACPI device PM code.

Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
rafaeljw committed Jul 22, 2014
1 parent 9a3c414 commit 28cb5ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 9 additions & 2 deletions include/linux/pm_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,20 @@
#define RPM_AUTO 0x08 /* Use autosuspend_delay */

#ifdef CONFIG_PM
extern struct workqueue_struct *pm_wq;

static inline bool queue_pm_work(struct work_struct *work)
{
return queue_work(pm_wq, work);
}

extern int pm_generic_runtime_suspend(struct device *dev);
extern int pm_generic_runtime_resume(struct device *dev);
extern int pm_runtime_force_suspend(struct device *dev);
extern int pm_runtime_force_resume(struct device *dev);
#else
static inline bool queue_pm_work(struct work_struct *work) { return false; }

static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
static inline int pm_runtime_force_suspend(struct device *dev) { return 0; }
Expand All @@ -37,8 +46,6 @@ static inline int pm_runtime_force_resume(struct device *dev) { return 0; }

#ifdef CONFIG_PM_RUNTIME

extern struct workqueue_struct *pm_wq;

extern int __pm_runtime_idle(struct device *dev, int rpmflags);
extern int __pm_runtime_suspend(struct device *dev, int rpmflags);
extern int __pm_runtime_resume(struct device *dev, int rpmflags);
Expand Down
4 changes: 0 additions & 4 deletions kernel/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ static struct attribute_group attr_group = {
.attrs = g,
};

#ifdef CONFIG_PM_RUNTIME
struct workqueue_struct *pm_wq;
EXPORT_SYMBOL_GPL(pm_wq);

Expand All @@ -625,9 +624,6 @@ static int __init pm_start_workqueue(void)

return pm_wq ? 0 : -ENOMEM;
}
#else
static inline int pm_start_workqueue(void) { return 0; }
#endif

static int __init pm_init(void)
{
Expand Down

0 comments on commit 28cb5ef

Please sign in to comment.