Commit e6035258 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'pm-core', 'pm-sleep' and 'pm-qos'

* pm-core:
  PM-runtime: Call pm_runtime_active|suspended_time() from sysfs
  PM-runtime: Consolidate code to get active/suspended time

* pm-sleep:
  PM / wakeup: Drop wakeup_source_drop()
  PM / wakeup: Rework wakeup source timer cancellation

* pm-qos:
  PM / QoS: Fix typo in file description
...@@ -21,6 +21,7 @@ static inline void pm_runtime_early_init(struct device *dev) ...@@ -21,6 +21,7 @@ static inline void pm_runtime_early_init(struct device *dev)
extern void pm_runtime_init(struct device *dev); extern void pm_runtime_init(struct device *dev);
extern void pm_runtime_reinit(struct device *dev); extern void pm_runtime_reinit(struct device *dev);
extern void pm_runtime_remove(struct device *dev); extern void pm_runtime_remove(struct device *dev);
extern u64 pm_runtime_active_time(struct device *dev);
#define WAKE_IRQ_DEDICATED_ALLOCATED BIT(0) #define WAKE_IRQ_DEDICATED_ALLOCATED BIT(0)
#define WAKE_IRQ_DEDICATED_MANAGED BIT(1) #define WAKE_IRQ_DEDICATED_MANAGED BIT(1)
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* per-device constraint data struct. * per-device constraint data struct.
* *
* Note about the per-device constraint data struct allocation: * Note about the per-device constraint data struct allocation:
* . The per-device constraints data struct ptr is tored into the device * . The per-device constraints data struct ptr is stored into the device
* dev_pm_info. * dev_pm_info.
* . To minimize the data usage by the per-device constraints, the data struct * . To minimize the data usage by the per-device constraints, the data struct
* is only allocated at the first call to dev_pm_qos_add_request. * is only allocated at the first call to dev_pm_qos_add_request.
......
...@@ -64,7 +64,7 @@ static int rpm_suspend(struct device *dev, int rpmflags); ...@@ -64,7 +64,7 @@ static int rpm_suspend(struct device *dev, int rpmflags);
* runtime_status field is updated, to account the time in the old state * runtime_status field is updated, to account the time in the old state
* correctly. * correctly.
*/ */
void update_pm_runtime_accounting(struct device *dev) static void update_pm_runtime_accounting(struct device *dev)
{ {
u64 now, last, delta; u64 now, last, delta;
...@@ -98,7 +98,7 @@ static void __update_runtime_status(struct device *dev, enum rpm_status status) ...@@ -98,7 +98,7 @@ static void __update_runtime_status(struct device *dev, enum rpm_status status)
dev->power.runtime_status = status; dev->power.runtime_status = status;
} }
u64 pm_runtime_suspended_time(struct device *dev) static u64 rpm_get_accounted_time(struct device *dev, bool suspended)
{ {
u64 time; u64 time;
unsigned long flags; unsigned long flags;
...@@ -106,12 +106,22 @@ u64 pm_runtime_suspended_time(struct device *dev) ...@@ -106,12 +106,22 @@ u64 pm_runtime_suspended_time(struct device *dev)
spin_lock_irqsave(&dev->power.lock, flags); spin_lock_irqsave(&dev->power.lock, flags);
update_pm_runtime_accounting(dev); update_pm_runtime_accounting(dev);
time = dev->power.suspended_time; time = suspended ? dev->power.suspended_time : dev->power.active_time;
spin_unlock_irqrestore(&dev->power.lock, flags); spin_unlock_irqrestore(&dev->power.lock, flags);
return time; return time;
} }
u64 pm_runtime_active_time(struct device *dev)
{
return rpm_get_accounted_time(dev, false);
}
u64 pm_runtime_suspended_time(struct device *dev)
{
return rpm_get_accounted_time(dev, true);
}
EXPORT_SYMBOL_GPL(pm_runtime_suspended_time); EXPORT_SYMBOL_GPL(pm_runtime_suspended_time);
/** /**
......
...@@ -125,13 +125,9 @@ static ssize_t runtime_active_time_show(struct device *dev, ...@@ -125,13 +125,9 @@ static ssize_t runtime_active_time_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
int ret; int ret;
u64 tmp; u64 tmp = pm_runtime_active_time(dev);
spin_lock_irq(&dev->power.lock);
update_pm_runtime_accounting(dev);
tmp = dev->power.active_time;
do_div(tmp, NSEC_PER_MSEC); do_div(tmp, NSEC_PER_MSEC);
ret = sprintf(buf, "%llu\n", tmp); ret = sprintf(buf, "%llu\n", tmp);
spin_unlock_irq(&dev->power.lock);
return ret; return ret;
} }
...@@ -141,13 +137,9 @@ static ssize_t runtime_suspended_time_show(struct device *dev, ...@@ -141,13 +137,9 @@ static ssize_t runtime_suspended_time_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
int ret; int ret;
u64 tmp; u64 tmp = pm_runtime_suspended_time(dev);
spin_lock_irq(&dev->power.lock);
update_pm_runtime_accounting(dev);
tmp = dev->power.suspended_time;
do_div(tmp, NSEC_PER_MSEC); do_div(tmp, NSEC_PER_MSEC);
ret = sprintf(buf, "%llu\n", tmp); ret = sprintf(buf, "%llu\n", tmp);
spin_unlock_irq(&dev->power.lock);
return ret; return ret;
} }
......
...@@ -108,23 +108,6 @@ struct wakeup_source *wakeup_source_create(const char *name) ...@@ -108,23 +108,6 @@ struct wakeup_source *wakeup_source_create(const char *name)
} }
EXPORT_SYMBOL_GPL(wakeup_source_create); EXPORT_SYMBOL_GPL(wakeup_source_create);
/**
* wakeup_source_drop - Prepare a struct wakeup_source object for destruction.
* @ws: Wakeup source to prepare for destruction.
*
* Callers must ensure that __pm_stay_awake() or __pm_wakeup_event() will never
* be run in parallel with this function for the same wakeup source object.
*/
void wakeup_source_drop(struct wakeup_source *ws)
{
if (!ws)
return;
del_timer_sync(&ws->timer);
__pm_relax(ws);
}
EXPORT_SYMBOL_GPL(wakeup_source_drop);
/* /*
* Record wakeup_source statistics being deleted into a dummy wakeup_source. * Record wakeup_source statistics being deleted into a dummy wakeup_source.
*/ */
...@@ -164,7 +147,7 @@ void wakeup_source_destroy(struct wakeup_source *ws) ...@@ -164,7 +147,7 @@ void wakeup_source_destroy(struct wakeup_source *ws)
if (!ws) if (!ws)
return; return;
wakeup_source_drop(ws); __pm_relax(ws);
wakeup_source_record(ws); wakeup_source_record(ws);
kfree_const(ws->name); kfree_const(ws->name);
kfree(ws); kfree(ws);
...@@ -207,6 +190,13 @@ void wakeup_source_remove(struct wakeup_source *ws) ...@@ -207,6 +190,13 @@ void wakeup_source_remove(struct wakeup_source *ws)
list_del_rcu(&ws->entry); list_del_rcu(&ws->entry);
raw_spin_unlock_irqrestore(&events_lock, flags); raw_spin_unlock_irqrestore(&events_lock, flags);
synchronize_srcu(&wakeup_srcu); synchronize_srcu(&wakeup_srcu);
del_timer_sync(&ws->timer);
/*
* Clear timer.function to make wakeup_source_not_registered() treat
* this wakeup source as not registered.
*/
ws->timer.function = NULL;
} }
EXPORT_SYMBOL_GPL(wakeup_source_remove); EXPORT_SYMBOL_GPL(wakeup_source_remove);
......
...@@ -643,7 +643,6 @@ struct dev_pm_info { ...@@ -643,7 +643,6 @@ struct dev_pm_info {
struct dev_pm_qos *qos; struct dev_pm_qos *qos;
}; };
extern void update_pm_runtime_accounting(struct device *dev);
extern int dev_pm_get_subsys_data(struct device *dev); extern int dev_pm_get_subsys_data(struct device *dev);
extern void dev_pm_put_subsys_data(struct device *dev); extern void dev_pm_put_subsys_data(struct device *dev);
......
...@@ -96,7 +96,6 @@ static inline void device_set_wakeup_path(struct device *dev) ...@@ -96,7 +96,6 @@ static inline void device_set_wakeup_path(struct device *dev)
/* drivers/base/power/wakeup.c */ /* drivers/base/power/wakeup.c */
extern void wakeup_source_prepare(struct wakeup_source *ws, const char *name); extern void wakeup_source_prepare(struct wakeup_source *ws, const char *name);
extern struct wakeup_source *wakeup_source_create(const char *name); extern struct wakeup_source *wakeup_source_create(const char *name);
extern void wakeup_source_drop(struct wakeup_source *ws);
extern void wakeup_source_destroy(struct wakeup_source *ws); extern void wakeup_source_destroy(struct wakeup_source *ws);
extern void wakeup_source_add(struct wakeup_source *ws); extern void wakeup_source_add(struct wakeup_source *ws);
extern void wakeup_source_remove(struct wakeup_source *ws); extern void wakeup_source_remove(struct wakeup_source *ws);
...@@ -134,8 +133,6 @@ static inline struct wakeup_source *wakeup_source_create(const char *name) ...@@ -134,8 +133,6 @@ static inline struct wakeup_source *wakeup_source_create(const char *name)
return NULL; return NULL;
} }
static inline void wakeup_source_drop(struct wakeup_source *ws) {}
static inline void wakeup_source_destroy(struct wakeup_source *ws) {} static inline void wakeup_source_destroy(struct wakeup_source *ws) {}
static inline void wakeup_source_add(struct wakeup_source *ws) {} static inline void wakeup_source_add(struct wakeup_source *ws) {}
...@@ -204,12 +201,6 @@ static inline void wakeup_source_init(struct wakeup_source *ws, ...@@ -204,12 +201,6 @@ static inline void wakeup_source_init(struct wakeup_source *ws,
wakeup_source_add(ws); wakeup_source_add(ws);
} }
static inline void wakeup_source_trash(struct wakeup_source *ws)
{
wakeup_source_remove(ws);
wakeup_source_drop(ws);
}
static inline void __pm_wakeup_event(struct wakeup_source *ws, unsigned int msec) static inline void __pm_wakeup_event(struct wakeup_source *ws, unsigned int msec)
{ {
return pm_wakeup_ws_event(ws, msec, false); return pm_wakeup_ws_event(ws, msec, false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment