Skip to content

Commit b02f669

Browse files
committed
PM / QoS: Rename device resume latency QoS items
Rename symbols, variables, functions and structure fields related do the resume latency device PM QoS type so that it is clear where they belong (in particular, to avoid confusion with the latency tolerance device PM QoS type introduced by a subsequent changeset). Update the PM QoS documentation to better reflect its current state. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent b28a960 commit b02f669

8 files changed

Lines changed: 73 additions & 77 deletions

File tree

‎Documentation/power/pm_qos_interface.txt‎

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,16 @@ node.
8989
2. PM QoS per-device latency and flags framework
9090

9191
For each device, there are two lists of PM QoS requests. One is maintained
92-
along with the aggregated target of latency value and the other is for PM QoS
93-
flags. Values are updated in response to changes of the request list.
92+
along with the aggregated target of resume latency value and the other is for
93+
PM QoS flags. Values are updated in response to changes of the request list.
9494

95-
Target latency value is simply the minimum of the request values held in the
96-
parameter list elements. The PM QoS flags aggregate value is a gather (bitwise
97-
OR) of all list elements' values. Two device PM QoS flags are defined currently:
98-
PM_QOS_FLAG_NO_POWER_OFF and PM_QOS_FLAG_REMOTE_WAKEUP.
95+
Target resume latency value is simply the minimum of the request values held in
96+
the parameter list elements. The PM QoS flags aggregate value is a gather
97+
(bitwise OR) of all list elements' values. Two device PM QoS flags are defined
98+
currently: PM_QOS_FLAG_NO_POWER_OFF and PM_QOS_FLAG_REMOTE_WAKEUP.
9999

100-
Note: the aggregated target value is implemented as an atomic variable so that
101-
reading the aggregated value does not require any locking mechanism.
100+
Note: the aggregated target value is implemented in such a way that reading the
101+
aggregated value does not require any locking mechanism.
102102

103103

104104
From kernel mode the use of this interface is the following:
@@ -137,14 +137,14 @@ Add a PM QoS request for the first direct ancestor of the given device whose
137137
power.ignore_children flag is unset.
138138

139139
int dev_pm_qos_expose_latency_limit(device, value)
140-
Add a request to the device's PM QoS list of latency constraints and create
141-
a sysfs attribute pm_qos_resume_latency_us under the device's power directory
142-
allowing user space to manipulate that request.
140+
Add a request to the device's PM QoS list of resume latency constraints and
141+
create a sysfs attribute pm_qos_resume_latency_us under the device's power
142+
directory allowing user space to manipulate that request.
143143

144144
void dev_pm_qos_hide_latency_limit(device)
145145
Drop the request added by dev_pm_qos_expose_latency_limit() from the device's
146-
PM QoS list of latency constraints and remove sysfs attribute pm_qos_resume_latency_us
147-
from the device's power directory.
146+
PM QoS list of resume latency constraints and remove sysfs attribute
147+
pm_qos_resume_latency_us from the device's power directory.
148148

149149
int dev_pm_qos_expose_flags(device, value)
150150
Add a request to the device's PM QoS list of flags and create sysfs attributes
@@ -163,22 +163,17 @@ a per-device notification tree and a global notification tree.
163163
int dev_pm_qos_add_notifier(device, notifier):
164164
Adds a notification callback function for the device.
165165
The callback is called when the aggregated value of the device constraints list
166-
is changed.
166+
is changed (for resume latency device PM QoS only).
167167

168168
int dev_pm_qos_remove_notifier(device, notifier):
169169
Removes the notification callback function for the device.
170170

171171
int dev_pm_qos_add_global_notifier(notifier):
172172
Adds a notification callback function in the global notification tree of the
173173
framework.
174-
The callback is called when the aggregated value for any device is changed.
174+
The callback is called when the aggregated value for any device is changed
175+
(for resume latency device PM QoS only).
175176

176177
int dev_pm_qos_remove_global_notifier(notifier):
177178
Removes the notification callback function from the global notification tree
178179
of the framework.
179-
180-
181-
From user mode:
182-
No API for user space access to the per-device latency constraints is provided
183-
yet - still under discussion.
184-

‎Documentation/trace/events-power.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,5 @@ dev_pm_qos_remove_request "device=%s type=%s new_value=%d"
9292

9393
The first parameter gives the device name which tries to add/update/remove
9494
QoS requests.
95-
The second parameter gives the request type (e.g. "DEV_PM_QOS_LATENCY").
95+
The second parameter gives the request type (e.g. "DEV_PM_QOS_RESUME_LATENCY").
9696
The third parameter is value to be added/updated/removed.

‎drivers/base/power/power.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ extern void dpm_sysfs_remove(struct device *dev);
8989
extern void rpm_sysfs_remove(struct device *dev);
9090
extern int wakeup_sysfs_add(struct device *dev);
9191
extern void wakeup_sysfs_remove(struct device *dev);
92-
extern int pm_qos_sysfs_add_latency(struct device *dev);
93-
extern void pm_qos_sysfs_remove_latency(struct device *dev);
92+
extern int pm_qos_sysfs_add_resume_latency(struct device *dev);
93+
extern void pm_qos_sysfs_remove_resume_latency(struct device *dev);
9494
extern int pm_qos_sysfs_add_flags(struct device *dev);
9595
extern void pm_qos_sysfs_remove_flags(struct device *dev);
9696

‎drivers/base/power/qos.c‎

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_flags);
105105
s32 __dev_pm_qos_read_value(struct device *dev)
106106
{
107107
return IS_ERR_OR_NULL(dev->power.qos) ?
108-
0 : pm_qos_read_value(&dev->power.qos->latency);
108+
0 : pm_qos_read_value(&dev->power.qos->resume_latency);
109109
}
110110

111111
/**
@@ -141,11 +141,11 @@ static int apply_constraint(struct dev_pm_qos_request *req,
141141
int ret;
142142

143143
switch(req->type) {
144-
case DEV_PM_QOS_LATENCY:
145-
ret = pm_qos_update_target(&qos->latency, &req->data.pnode,
146-
action, value);
144+
case DEV_PM_QOS_RESUME_LATENCY:
145+
ret = pm_qos_update_target(&qos->resume_latency,
146+
&req->data.pnode, action, value);
147147
if (ret) {
148-
value = pm_qos_read_value(&qos->latency);
148+
value = pm_qos_read_value(&qos->resume_latency);
149149
blocking_notifier_call_chain(&dev_pm_notifiers,
150150
(unsigned long)value,
151151
req);
@@ -186,10 +186,10 @@ static int dev_pm_qos_constraints_allocate(struct device *dev)
186186
}
187187
BLOCKING_INIT_NOTIFIER_HEAD(n);
188188

189-
c = &qos->latency;
189+
c = &qos->resume_latency;
190190
plist_head_init(&c->list);
191-
c->target_value = PM_QOS_DEV_LAT_DEFAULT_VALUE;
192-
c->default_value = PM_QOS_DEV_LAT_DEFAULT_VALUE;
191+
c->target_value = PM_QOS_RESUME_LATENCY_DEFAULT_VALUE;
192+
c->default_value = PM_QOS_RESUME_LATENCY_DEFAULT_VALUE;
193193
c->type = PM_QOS_MIN;
194194
c->notifiers = n;
195195

@@ -224,7 +224,7 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
224224
* If the device's PM QoS resume latency limit or PM QoS flags have been
225225
* exposed to user space, they have to be hidden at this point.
226226
*/
227-
pm_qos_sysfs_remove_latency(dev);
227+
pm_qos_sysfs_remove_resume_latency(dev);
228228
pm_qos_sysfs_remove_flags(dev);
229229

230230
mutex_lock(&dev_pm_qos_mtx);
@@ -237,7 +237,7 @@ void dev_pm_qos_constraints_destroy(struct device *dev)
237237
goto out;
238238

239239
/* Flush the constraints lists for the device. */
240-
c = &qos->latency;
240+
c = &qos->resume_latency;
241241
plist_for_each_entry_safe(req, tmp, &c->list, data.pnode) {
242242
/*
243243
* Update constraints list and call the notification
@@ -341,7 +341,7 @@ static int __dev_pm_qos_update_request(struct dev_pm_qos_request *req,
341341
return -ENODEV;
342342

343343
switch(req->type) {
344-
case DEV_PM_QOS_LATENCY:
344+
case DEV_PM_QOS_RESUME_LATENCY:
345345
curr_value = req->data.pnode.prio;
346346
break;
347347
case DEV_PM_QOS_FLAGS:
@@ -460,8 +460,8 @@ int dev_pm_qos_add_notifier(struct device *dev, struct notifier_block *notifier)
460460
ret = dev_pm_qos_constraints_allocate(dev);
461461

462462
if (!ret)
463-
ret = blocking_notifier_chain_register(
464-
dev->power.qos->latency.notifiers, notifier);
463+
ret = blocking_notifier_chain_register(dev->power.qos->resume_latency.notifiers,
464+
notifier);
465465

466466
mutex_unlock(&dev_pm_qos_mtx);
467467
return ret;
@@ -487,9 +487,8 @@ int dev_pm_qos_remove_notifier(struct device *dev,
487487

488488
/* Silently return if the constraints object is not present. */
489489
if (!IS_ERR_OR_NULL(dev->power.qos))
490-
retval = blocking_notifier_chain_unregister(
491-
dev->power.qos->latency.notifiers,
492-
notifier);
490+
retval = blocking_notifier_chain_unregister(dev->power.qos->resume_latency.notifiers,
491+
notifier);
493492

494493
mutex_unlock(&dev_pm_qos_mtx);
495494
return retval;
@@ -543,7 +542,7 @@ int dev_pm_qos_add_ancestor_request(struct device *dev,
543542

544543
if (ancestor)
545544
ret = dev_pm_qos_add_request(ancestor, req,
546-
DEV_PM_QOS_LATENCY, value);
545+
DEV_PM_QOS_RESUME_LATENCY, value);
547546

548547
if (ret < 0)
549548
req->dev = NULL;
@@ -559,9 +558,9 @@ static void __dev_pm_qos_drop_user_request(struct device *dev,
559558
struct dev_pm_qos_request *req = NULL;
560559

561560
switch(type) {
562-
case DEV_PM_QOS_LATENCY:
563-
req = dev->power.qos->latency_req;
564-
dev->power.qos->latency_req = NULL;
561+
case DEV_PM_QOS_RESUME_LATENCY:
562+
req = dev->power.qos->resume_latency_req;
563+
dev->power.qos->resume_latency_req = NULL;
565564
break;
566565
case DEV_PM_QOS_FLAGS:
567566
req = dev->power.qos->flags_req;
@@ -597,7 +596,7 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
597596
if (!req)
598597
return -ENOMEM;
599598

600-
ret = dev_pm_qos_add_request(dev, req, DEV_PM_QOS_LATENCY, value);
599+
ret = dev_pm_qos_add_request(dev, req, DEV_PM_QOS_RESUME_LATENCY, value);
601600
if (ret < 0) {
602601
kfree(req);
603602
return ret;
@@ -609,7 +608,7 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
609608

610609
if (IS_ERR_OR_NULL(dev->power.qos))
611610
ret = -ENODEV;
612-
else if (dev->power.qos->latency_req)
611+
else if (dev->power.qos->resume_latency_req)
613612
ret = -EEXIST;
614613

615614
if (ret < 0) {
@@ -618,13 +617,13 @@ int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
618617
mutex_unlock(&dev_pm_qos_mtx);
619618
goto out;
620619
}
621-
dev->power.qos->latency_req = req;
620+
dev->power.qos->resume_latency_req = req;
622621

623622
mutex_unlock(&dev_pm_qos_mtx);
624623

625-
ret = pm_qos_sysfs_add_latency(dev);
624+
ret = pm_qos_sysfs_add_resume_latency(dev);
626625
if (ret)
627-
dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY);
626+
dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_RESUME_LATENCY);
628627

629628
out:
630629
mutex_unlock(&dev_pm_qos_sysfs_mtx);
@@ -634,8 +633,8 @@ EXPORT_SYMBOL_GPL(dev_pm_qos_expose_latency_limit);
634633

635634
static void __dev_pm_qos_hide_latency_limit(struct device *dev)
636635
{
637-
if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->latency_req)
638-
__dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_LATENCY);
636+
if (!IS_ERR_OR_NULL(dev->power.qos) && dev->power.qos->resume_latency_req)
637+
__dev_pm_qos_drop_user_request(dev, DEV_PM_QOS_RESUME_LATENCY);
639638
}
640639

641640
/**
@@ -646,7 +645,7 @@ void dev_pm_qos_hide_latency_limit(struct device *dev)
646645
{
647646
mutex_lock(&dev_pm_qos_sysfs_mtx);
648647

649-
pm_qos_sysfs_remove_latency(dev);
648+
pm_qos_sysfs_remove_resume_latency(dev);
650649

651650
mutex_lock(&dev_pm_qos_mtx);
652651
__dev_pm_qos_hide_latency_limit(dev);

‎drivers/base/power/sysfs.c‎

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,16 @@ static ssize_t autosuspend_delay_ms_store(struct device *dev,
218218
static DEVICE_ATTR(autosuspend_delay_ms, 0644, autosuspend_delay_ms_show,
219219
autosuspend_delay_ms_store);
220220

221-
static ssize_t pm_qos_latency_show(struct device *dev,
222-
struct device_attribute *attr, char *buf)
221+
static ssize_t pm_qos_resume_latency_show(struct device *dev,
222+
struct device_attribute *attr,
223+
char *buf)
223224
{
224-
return sprintf(buf, "%d\n", dev_pm_qos_requested_latency(dev));
225+
return sprintf(buf, "%d\n", dev_pm_qos_requested_resume_latency(dev));
225226
}
226227

227-
static ssize_t pm_qos_latency_store(struct device *dev,
228-
struct device_attribute *attr,
229-
const char *buf, size_t n)
228+
static ssize_t pm_qos_resume_latency_store(struct device *dev,
229+
struct device_attribute *attr,
230+
const char *buf, size_t n)
230231
{
231232
s32 value;
232233
int ret;
@@ -237,12 +238,13 @@ static ssize_t pm_qos_latency_store(struct device *dev,
237238
if (value < 0)
238239
return -EINVAL;
239240

240-
ret = dev_pm_qos_update_request(dev->power.qos->latency_req, value);
241+
ret = dev_pm_qos_update_request(dev->power.qos->resume_latency_req,
242+
value);
241243
return ret < 0 ? ret : n;
242244
}
243245

244246
static DEVICE_ATTR(pm_qos_resume_latency_us, 0644,
245-
pm_qos_latency_show, pm_qos_latency_store);
247+
pm_qos_resume_latency_show, pm_qos_resume_latency_store);
246248

247249
static ssize_t pm_qos_no_power_off_show(struct device *dev,
248250
struct device_attribute *attr,
@@ -618,15 +620,15 @@ static struct attribute_group pm_runtime_attr_group = {
618620
.attrs = runtime_attrs,
619621
};
620622

621-
static struct attribute *pm_qos_latency_attrs[] = {
623+
static struct attribute *pm_qos_resume_latency_attrs[] = {
622624
#ifdef CONFIG_PM_RUNTIME
623625
&dev_attr_pm_qos_resume_latency_us.attr,
624626
#endif /* CONFIG_PM_RUNTIME */
625627
NULL,
626628
};
627-
static struct attribute_group pm_qos_latency_attr_group = {
629+
static struct attribute_group pm_qos_resume_latency_attr_group = {
628630
.name = power_group_name,
629-
.attrs = pm_qos_latency_attrs,
631+
.attrs = pm_qos_resume_latency_attrs,
630632
};
631633

632634
static struct attribute *pm_qos_flags_attrs[] = {
@@ -681,14 +683,14 @@ void wakeup_sysfs_remove(struct device *dev)
681683
sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group);
682684
}
683685

684-
int pm_qos_sysfs_add_latency(struct device *dev)
686+
int pm_qos_sysfs_add_resume_latency(struct device *dev)
685687
{
686-
return sysfs_merge_group(&dev->kobj, &pm_qos_latency_attr_group);
688+
return sysfs_merge_group(&dev->kobj, &pm_qos_resume_latency_attr_group);
687689
}
688690

689-
void pm_qos_sysfs_remove_latency(struct device *dev)
691+
void pm_qos_sysfs_remove_resume_latency(struct device *dev)
690692
{
691-
sysfs_unmerge_group(&dev->kobj, &pm_qos_latency_attr_group);
693+
sysfs_unmerge_group(&dev->kobj, &pm_qos_resume_latency_attr_group);
692694
}
693695

694696
int pm_qos_sysfs_add_flags(struct device *dev)

‎drivers/mtd/nand/sh_flctl.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ static void flctl_select_chip(struct mtd_info *mtd, int chipnr)
897897
if (!flctl->qos_request) {
898898
ret = dev_pm_qos_add_request(&flctl->pdev->dev,
899899
&flctl->pm_qos,
900-
DEV_PM_QOS_LATENCY,
900+
DEV_PM_QOS_RESUME_LATENCY,
901901
100);
902902
if (ret < 0)
903903
dev_err(&flctl->pdev->dev,

‎include/linux/pm_qos.h‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ enum pm_qos_flags_status {
3232
#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
3333
#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
3434
#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
35-
#define PM_QOS_DEV_LAT_DEFAULT_VALUE 0
35+
#define PM_QOS_RESUME_LATENCY_DEFAULT_VALUE 0
3636

3737
#define PM_QOS_FLAG_NO_POWER_OFF (1 << 0)
3838
#define PM_QOS_FLAG_REMOTE_WAKEUP (1 << 1)
@@ -49,7 +49,7 @@ struct pm_qos_flags_request {
4949
};
5050

5151
enum dev_pm_qos_req_type {
52-
DEV_PM_QOS_LATENCY = 1,
52+
DEV_PM_QOS_RESUME_LATENCY = 1,
5353
DEV_PM_QOS_FLAGS,
5454
};
5555

@@ -87,9 +87,9 @@ struct pm_qos_flags {
8787
};
8888

8989
struct dev_pm_qos {
90-
struct pm_qos_constraints latency;
90+
struct pm_qos_constraints resume_latency;
9191
struct pm_qos_flags flags;
92-
struct dev_pm_qos_request *latency_req;
92+
struct dev_pm_qos_request *resume_latency_req;
9393
struct dev_pm_qos_request *flags_req;
9494
};
9595

@@ -196,9 +196,9 @@ int dev_pm_qos_expose_flags(struct device *dev, s32 value);
196196
void dev_pm_qos_hide_flags(struct device *dev);
197197
int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set);
198198

199-
static inline s32 dev_pm_qos_requested_latency(struct device *dev)
199+
static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev)
200200
{
201-
return dev->power.qos->latency_req->data.pnode.prio;
201+
return dev->power.qos->resume_latency_req->data.pnode.prio;
202202
}
203203

204204
static inline s32 dev_pm_qos_requested_flags(struct device *dev)
@@ -215,7 +215,7 @@ static inline void dev_pm_qos_hide_flags(struct device *dev) {}
215215
static inline int dev_pm_qos_update_flags(struct device *dev, s32 m, bool set)
216216
{ return 0; }
217217

218-
static inline s32 dev_pm_qos_requested_latency(struct device *dev) { return 0; }
218+
static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev) { return 0; }
219219
static inline s32 dev_pm_qos_requested_flags(struct device *dev) { return 0; }
220220
#endif
221221

0 commit comments

Comments
 (0)