diff options
| author | Alex Frid <afrid@nvidia.com> | 2012-01-29 14:39:25 -0500 |
|---|---|---|
| committer | Rafael J. Wysocki <rjw@sisk.pl> | 2012-01-29 14:39:25 -0500 |
| commit | d031e1de2c5ba91e67ed83f6adf624543ab2b03d (patch) | |
| tree | 2d8b2c052c920d1973e6b1e00cbd95502bd9c0e0 | |
| parent | 0496c8ae366724a0a2136cec09a2e277e782c126 (diff) | |
PM / QoS: Simplify PM QoS expansion/merge
- Replace class ID #define with enumeration
- Loop through PM QoS objects during initialization (rather than
initializing them one-by-one)
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-by: Antti Miettinen <amiettinen@nvidia.com>
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
Acked-by: markgross <markgross@thegnar.org>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
| -rw-r--r-- | include/linux/pm_qos.h | 14 | ||||
| -rw-r--r-- | kernel/power/qos.c | 23 |
2 files changed, 19 insertions, 18 deletions
diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index e5bbcbaa6f57..5ac91d8e69de 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h | |||
| @@ -9,12 +9,16 @@ | |||
| 9 | #include <linux/miscdevice.h> | 9 | #include <linux/miscdevice.h> |
| 10 | #include <linux/device.h> | 10 | #include <linux/device.h> |
| 11 | 11 | ||
| 12 | #define PM_QOS_RESERVED 0 | 12 | enum { |
| 13 | #define PM_QOS_CPU_DMA_LATENCY 1 | 13 | PM_QOS_RESERVED = 0, |
| 14 | #define PM_QOS_NETWORK_LATENCY 2 | 14 | PM_QOS_CPU_DMA_LATENCY, |
| 15 | #define PM_QOS_NETWORK_THROUGHPUT 3 | 15 | PM_QOS_NETWORK_LATENCY, |
| 16 | PM_QOS_NETWORK_THROUGHPUT, | ||
| 17 | |||
| 18 | /* insert new class ID */ | ||
| 19 | PM_QOS_NUM_CLASSES, | ||
| 20 | }; | ||
| 16 | 21 | ||
| 17 | #define PM_QOS_NUM_CLASSES 4 | ||
| 18 | #define PM_QOS_DEFAULT_VALUE -1 | 22 | #define PM_QOS_DEFAULT_VALUE -1 |
| 19 | 23 | ||
| 20 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) | 24 | #define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) |
diff --git a/kernel/power/qos.c b/kernel/power/qos.c index 995e3bd3417b..d6d6dbd1ecc0 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c | |||
| @@ -469,21 +469,18 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, | |||
| 469 | static int __init pm_qos_power_init(void) | 469 | static int __init pm_qos_power_init(void) |
| 470 | { | 470 | { |
| 471 | int ret = 0; | 471 | int ret = 0; |
| 472 | int i; | ||
| 472 | 473 | ||
| 473 | ret = register_pm_qos_misc(&cpu_dma_pm_qos); | 474 | BUILD_BUG_ON(ARRAY_SIZE(pm_qos_array) != PM_QOS_NUM_CLASSES); |
| 474 | if (ret < 0) { | 475 | |
| 475 | printk(KERN_ERR "pm_qos_param: cpu_dma_latency setup failed\n"); | 476 | for (i = 1; i < PM_QOS_NUM_CLASSES; i++) { |
| 476 | return ret; | 477 | ret = register_pm_qos_misc(pm_qos_array[i]); |
| 477 | } | 478 | if (ret < 0) { |
| 478 | ret = register_pm_qos_misc(&network_lat_pm_qos); | 479 | printk(KERN_ERR "pm_qos_param: %s setup failed\n", |
| 479 | if (ret < 0) { | 480 | pm_qos_array[i]->name); |
| 480 | printk(KERN_ERR "pm_qos_param: network_latency setup failed\n"); | 481 | return ret; |
| 481 | return ret; | 482 | } |
| 482 | } | 483 | } |
| 483 | ret = register_pm_qos_misc(&network_throughput_pm_qos); | ||
| 484 | if (ret < 0) | ||
| 485 | printk(KERN_ERR | ||
| 486 | "pm_qos_param: network_throughput setup failed\n"); | ||
| 487 | 484 | ||
| 488 | return ret; | 485 | return ret; |
| 489 | } | 486 | } |
