Skip to content

Commit 67b06ba

Browse files
committed
PM: QoS: Drop PM_QOS_CPU_DMA_LATENCY and rename related functions
Drop the PM QoS classes enum including PM_QOS_CPU_DMA_LATENCY, drop the wrappers around pm_qos_request(), pm_qos_request_active(), and pm_qos_add/update/remove_request() introduced previously, rename these functions, respectively, to cpu_latency_qos_limit(), cpu_latency_qos_request_active(), and cpu_latency_qos_add/update/remove_request(), and update their kerneldoc comments. [While at it, drop some useless comments from these functions.] No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Reviewed-by: Amit Kucheria <[email protected]> Tested-by: Amit Kucheria <[email protected]>
1 parent 5371a79 commit 67b06ba

File tree

2 files changed

+54
-91
lines changed

2 files changed

+54
-91
lines changed

include/linux/pm_qos.h

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@
99
#include <linux/notifier.h>
1010
#include <linux/device.h>
1111

12-
enum {
13-
PM_QOS_RESERVED = 0,
14-
PM_QOS_CPU_DMA_LATENCY,
15-
16-
/* insert new class ID */
17-
PM_QOS_NUM_CLASSES,
18-
};
19-
2012
enum pm_qos_flags_status {
2113
PM_QOS_FLAGS_UNDEFINED = -1,
2214
PM_QOS_FLAGS_NONE,
@@ -144,40 +136,11 @@ bool pm_qos_update_flags(struct pm_qos_flags *pqf,
144136
struct pm_qos_flags_request *req,
145137
enum pm_qos_req_action action, s32 val);
146138

147-
void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class,
148-
s32 value);
149-
void pm_qos_update_request(struct pm_qos_request *req,
150-
s32 new_value);
151-
void pm_qos_remove_request(struct pm_qos_request *req);
152-
s32 pm_qos_request(int pm_qos_class);
153-
int pm_qos_request_active(struct pm_qos_request *req);
154-
155-
static inline void cpu_latency_qos_add_request(struct pm_qos_request *req,
156-
s32 value)
157-
{
158-
pm_qos_add_request(req, PM_QOS_CPU_DMA_LATENCY, value);
159-
}
160-
161-
static inline void cpu_latency_qos_update_request(struct pm_qos_request *req,
162-
s32 new_value)
163-
{
164-
pm_qos_update_request(req, new_value);
165-
}
166-
167-
static inline void cpu_latency_qos_remove_request(struct pm_qos_request *req)
168-
{
169-
pm_qos_remove_request(req);
170-
}
171-
172-
static inline bool cpu_latency_qos_request_active(struct pm_qos_request *req)
173-
{
174-
return pm_qos_request_active(req);
175-
}
176-
177-
static inline s32 cpu_latency_qos_limit(void)
178-
{
179-
return pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
180-
}
139+
s32 cpu_latency_qos_limit(void);
140+
bool cpu_latency_qos_request_active(struct pm_qos_request *req);
141+
void cpu_latency_qos_add_request(struct pm_qos_request *req, s32 value);
142+
void cpu_latency_qos_update_request(struct pm_qos_request *req, s32 new_value);
143+
void cpu_latency_qos_remove_request(struct pm_qos_request *req);
181144

182145
#ifdef CONFIG_PM
183146
enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev, s32 mask);

kernel/power/qos.c

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -230,21 +230,25 @@ static struct pm_qos_constraints cpu_latency_constraints = {
230230
};
231231

232232
/**
233-
* pm_qos_request - returns current system wide qos expectation
234-
* @pm_qos_class: Ignored.
235-
*
236-
* This function returns the current target value.
233+
* cpu_latency_qos_limit - Return current system-wide CPU latency QoS limit.
237234
*/
238-
s32 pm_qos_request(int pm_qos_class)
235+
s32 cpu_latency_qos_limit(void)
239236
{
240237
return pm_qos_read_value(&cpu_latency_constraints);
241238
}
242239

243-
int pm_qos_request_active(struct pm_qos_request *req)
240+
/**
241+
* cpu_latency_qos_request_active - Check the given PM QoS request.
242+
* @req: PM QoS request to check.
243+
*
244+
* Return: 'true' if @req has been added to the CPU latency QoS list, 'false'
245+
* otherwise.
246+
*/
247+
bool cpu_latency_qos_request_active(struct pm_qos_request *req)
244248
{
245249
return req->qos == &cpu_latency_constraints;
246250
}
247-
EXPORT_SYMBOL_GPL(pm_qos_request_active);
251+
EXPORT_SYMBOL_GPL(cpu_latency_qos_request_active);
248252

249253
static void cpu_latency_qos_apply(struct pm_qos_request *req,
250254
enum pm_qos_req_action action, s32 value)
@@ -255,25 +259,24 @@ static void cpu_latency_qos_apply(struct pm_qos_request *req,
255259
}
256260

257261
/**
258-
* pm_qos_add_request - inserts new qos request into the list
259-
* @req: pointer to a preallocated handle
260-
* @pm_qos_class: Ignored.
261-
* @value: defines the qos request
262+
* cpu_latency_qos_add_request - Add new CPU latency QoS request.
263+
* @req: Pointer to a preallocated handle.
264+
* @value: Requested constraint value.
265+
*
266+
* Use @value to initialize the request handle pointed to by @req, insert it as
267+
* a new entry to the CPU latency QoS list and recompute the effective QoS
268+
* constraint for that list.
262269
*
263-
* This function inserts a new entry in the PM_QOS_CPU_DMA_LATENCY list of
264-
* requested QoS performance characteristics. It recomputes the aggregate QoS
265-
* expectations for the PM_QOS_CPU_DMA_LATENCY list and initializes the @req
266-
* handle. Caller needs to save this handle for later use in updates and
267-
* removal.
270+
* Callers need to save the handle for later use in updates and removal of the
271+
* QoS request represented by it.
268272
*/
269-
void pm_qos_add_request(struct pm_qos_request *req,
270-
int pm_qos_class, s32 value)
273+
void cpu_latency_qos_add_request(struct pm_qos_request *req, s32 value)
271274
{
272-
if (!req) /*guard against callers passing in null */
275+
if (!req)
273276
return;
274277

275-
if (pm_qos_request_active(req)) {
276-
WARN(1, KERN_ERR "pm_qos_add_request() called for already added request\n");
278+
if (cpu_latency_qos_request_active(req)) {
279+
WARN(1, KERN_ERR "%s called for already added request\n", __func__);
277280
return;
278281
}
279282

@@ -282,25 +285,24 @@ void pm_qos_add_request(struct pm_qos_request *req,
282285
req->qos = &cpu_latency_constraints;
283286
cpu_latency_qos_apply(req, PM_QOS_ADD_REQ, value);
284287
}
285-
EXPORT_SYMBOL_GPL(pm_qos_add_request);
288+
EXPORT_SYMBOL_GPL(cpu_latency_qos_add_request);
286289

287290
/**
288-
* pm_qos_update_request - modifies an existing qos request
289-
* @req : handle to list element holding a pm_qos request to use
290-
* @value: defines the qos request
291-
*
292-
* Updates an existing qos request for the PM_QOS_CPU_DMA_LATENCY list along
293-
* with updating the target PM_QOS_CPU_DMA_LATENCY value.
291+
* cpu_latency_qos_update_request - Modify existing CPU latency QoS request.
292+
* @req : QoS request to update.
293+
* @new_value: New requested constraint value.
294294
*
295-
* Attempts are made to make this code callable on hot code paths.
295+
* Use @new_value to update the QoS request represented by @req in the CPU
296+
* latency QoS list along with updating the effective constraint value for that
297+
* list.
296298
*/
297-
void pm_qos_update_request(struct pm_qos_request *req, s32 new_value)
299+
void cpu_latency_qos_update_request(struct pm_qos_request *req, s32 new_value)
298300
{
299-
if (!req) /*guard against callers passing in null */
301+
if (!req)
300302
return;
301303

302-
if (!pm_qos_request_active(req)) {
303-
WARN(1, KERN_ERR "pm_qos_update_request() called for unknown object\n");
304+
if (!cpu_latency_qos_request_active(req)) {
305+
WARN(1, KERN_ERR "%s called for unknown object\n", __func__);
304306
return;
305307
}
306308

@@ -311,24 +313,22 @@ void pm_qos_update_request(struct pm_qos_request *req, s32 new_value)
311313

312314
cpu_latency_qos_apply(req, PM_QOS_UPDATE_REQ, new_value);
313315
}
314-
EXPORT_SYMBOL_GPL(pm_qos_update_request);
316+
EXPORT_SYMBOL_GPL(cpu_latency_qos_update_request);
315317

316318
/**
317-
* pm_qos_remove_request - modifies an existing qos request
318-
* @req: handle to request list element
319+
* cpu_latency_qos_remove_request - Remove existing CPU latency QoS request.
320+
* @req: QoS request to remove.
319321
*
320-
* Will remove pm qos request from the list of constraints and
321-
* recompute the current target value for PM_QOS_CPU_DMA_LATENCY. Call this
322-
* on slow code paths.
322+
* Remove the CPU latency QoS request represented by @req from the CPU latency
323+
* QoS list along with updating the effective constraint value for that list.
323324
*/
324-
void pm_qos_remove_request(struct pm_qos_request *req)
325+
void cpu_latency_qos_remove_request(struct pm_qos_request *req)
325326
{
326-
if (!req) /*guard against callers passing in null */
327+
if (!req)
327328
return;
328-
/* silent return to keep pcm code cleaner */
329329

330-
if (!pm_qos_request_active(req)) {
331-
WARN(1, KERN_ERR "pm_qos_remove_request() called for unknown object\n");
330+
if (!cpu_latency_qos_request_active(req)) {
331+
WARN(1, KERN_ERR "%s called for unknown object\n", __func__);
332332
return;
333333
}
334334

@@ -337,7 +337,7 @@ void pm_qos_remove_request(struct pm_qos_request *req)
337337
cpu_latency_qos_apply(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE);
338338
memset(req, 0, sizeof(*req));
339339
}
340-
EXPORT_SYMBOL_GPL(pm_qos_remove_request);
340+
EXPORT_SYMBOL_GPL(cpu_latency_qos_remove_request);
341341

342342
/* User space interface to the CPU latency QoS via misc device. */
343343

@@ -349,7 +349,7 @@ static int cpu_latency_qos_open(struct inode *inode, struct file *filp)
349349
if (!req)
350350
return -ENOMEM;
351351

352-
pm_qos_add_request(req, PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE);
352+
cpu_latency_qos_add_request(req, PM_QOS_DEFAULT_VALUE);
353353
filp->private_data = req;
354354

355355
return 0;
@@ -361,7 +361,7 @@ static int cpu_latency_qos_release(struct inode *inode, struct file *filp)
361361

362362
filp->private_data = NULL;
363363

364-
pm_qos_remove_request(req);
364+
cpu_latency_qos_remove_request(req);
365365
kfree(req);
366366

367367
return 0;
@@ -374,7 +374,7 @@ static ssize_t cpu_latency_qos_read(struct file *filp, char __user *buf,
374374
unsigned long flags;
375375
s32 value;
376376

377-
if (!req || !pm_qos_request_active(req))
377+
if (!req || !cpu_latency_qos_request_active(req))
378378
return -EINVAL;
379379

380380
spin_lock_irqsave(&pm_qos_lock, flags);
@@ -400,7 +400,7 @@ static ssize_t cpu_latency_qos_write(struct file *filp, const char __user *buf,
400400
return ret;
401401
}
402402

403-
pm_qos_update_request(filp->private_data, value);
403+
cpu_latency_qos_update_request(filp->private_data, value);
404404

405405
return count;
406406
}

0 commit comments

Comments
 (0)