PM: QoS: Drop iterations over global QoS classes
After commit c3082a674f
("PM: QoS: Get rid of unused flags") the
only global PM QoS class in use is PM_QOS_CPU_DMA_LATENCY, so it
does not really make sense to iterate over global QoS classes
anywhere, since there is only one.
Remove iterations over global QoS classes from the code and use
PM_QOS_CPU_DMA_LATENCY as the target class directly where needed.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
Tested-by: Amit Kucheria <amit.kucheria@linaro.org>
This commit is contained in:
parent
dcd70ca1a3
commit
63cffc0534
|
@ -412,7 +412,8 @@ int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(pm_qos_remove_notifier);
|
EXPORT_SYMBOL_GPL(pm_qos_remove_notifier);
|
||||||
|
|
||||||
/* User space interface to PM QoS classes via misc devices */
|
/* User space interface to global PM QoS via misc device. */
|
||||||
|
|
||||||
static int register_pm_qos_misc(struct pm_qos_object *qos)
|
static int register_pm_qos_misc(struct pm_qos_object *qos)
|
||||||
{
|
{
|
||||||
qos->pm_qos_power_miscdev.minor = MISC_DYNAMIC_MINOR;
|
qos->pm_qos_power_miscdev.minor = MISC_DYNAMIC_MINOR;
|
||||||
|
@ -422,35 +423,18 @@ static int register_pm_qos_misc(struct pm_qos_object *qos)
|
||||||
return misc_register(&qos->pm_qos_power_miscdev);
|
return misc_register(&qos->pm_qos_power_miscdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int find_pm_qos_object_by_minor(int minor)
|
|
||||||
{
|
|
||||||
int pm_qos_class;
|
|
||||||
|
|
||||||
for (pm_qos_class = PM_QOS_CPU_DMA_LATENCY;
|
|
||||||
pm_qos_class < PM_QOS_NUM_CLASSES; pm_qos_class++) {
|
|
||||||
if (minor ==
|
|
||||||
pm_qos_array[pm_qos_class]->pm_qos_power_miscdev.minor)
|
|
||||||
return pm_qos_class;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int pm_qos_power_open(struct inode *inode, struct file *filp)
|
static int pm_qos_power_open(struct inode *inode, struct file *filp)
|
||||||
{
|
{
|
||||||
long pm_qos_class;
|
struct pm_qos_request *req;
|
||||||
|
|
||||||
pm_qos_class = find_pm_qos_object_by_minor(iminor(inode));
|
req = kzalloc(sizeof(*req), GFP_KERNEL);
|
||||||
if (pm_qos_class >= PM_QOS_CPU_DMA_LATENCY) {
|
|
||||||
struct pm_qos_request *req = kzalloc(sizeof(*req), GFP_KERNEL);
|
|
||||||
if (!req)
|
if (!req)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
pm_qos_add_request(req, pm_qos_class, PM_QOS_DEFAULT_VALUE);
|
pm_qos_add_request(req, PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE);
|
||||||
filp->private_data = req;
|
filp->private_data = req;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
return -EPERM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pm_qos_power_release(struct inode *inode, struct file *filp)
|
static int pm_qos_power_release(struct inode *inode, struct file *filp)
|
||||||
|
@ -464,7 +448,6 @@ static int pm_qos_power_release(struct inode *inode, struct file *filp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t pm_qos_power_read(struct file *filp, char __user *buf,
|
static ssize_t pm_qos_power_read(struct file *filp, char __user *buf,
|
||||||
size_t count, loff_t *f_pos)
|
size_t count, loff_t *f_pos)
|
||||||
{
|
{
|
||||||
|
@ -507,26 +490,19 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int __init pm_qos_power_init(void)
|
static int __init pm_qos_power_init(void)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret;
|
||||||
int i;
|
|
||||||
|
|
||||||
BUILD_BUG_ON(ARRAY_SIZE(pm_qos_array) != PM_QOS_NUM_CLASSES);
|
BUILD_BUG_ON(ARRAY_SIZE(pm_qos_array) != PM_QOS_NUM_CLASSES);
|
||||||
|
|
||||||
for (i = PM_QOS_CPU_DMA_LATENCY; i < PM_QOS_NUM_CLASSES; i++) {
|
ret = register_pm_qos_misc(pm_qos_array[PM_QOS_CPU_DMA_LATENCY]);
|
||||||
ret = register_pm_qos_misc(pm_qos_array[i]);
|
if (ret < 0)
|
||||||
if (ret < 0) {
|
pr_err("%s: %s setup failed\n", __func__,
|
||||||
pr_err("%s: %s setup failed\n",
|
pm_qos_array[PM_QOS_CPU_DMA_LATENCY]->name);
|
||||||
__func__, pm_qos_array[i]->name);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
late_initcall(pm_qos_power_init);
|
late_initcall(pm_qos_power_init);
|
||||||
|
|
||||||
/* Definitions related to the frequency QoS below. */
|
/* Definitions related to the frequency QoS below. */
|
||||||
|
|
Loading…
Reference in New Issue