diff options
| -rw-r--r-- | arch/arm/mach-omap2/pm-debug.c | 4 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/powerdomain.c | 39 | ||||
| -rw-r--r-- | arch/arm/plat-omap/include/mach/powerdomain.h | 2 |
3 files changed, 31 insertions, 14 deletions
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 1b4c1600f8d8..2fc4d6abbd0a 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c | |||
| @@ -541,7 +541,7 @@ static int __init pm_dbg_init(void) | |||
| 541 | printk(KERN_ERR "%s: only OMAP3 supported\n", __func__); | 541 | printk(KERN_ERR "%s: only OMAP3 supported\n", __func__); |
| 542 | return -ENODEV; | 542 | return -ENODEV; |
| 543 | } | 543 | } |
| 544 | 544 | ||
| 545 | d = debugfs_create_dir("pm_debug", NULL); | 545 | d = debugfs_create_dir("pm_debug", NULL); |
| 546 | if (IS_ERR(d)) | 546 | if (IS_ERR(d)) |
| 547 | return PTR_ERR(d); | 547 | return PTR_ERR(d); |
| @@ -551,7 +551,7 @@ static int __init pm_dbg_init(void) | |||
| 551 | (void) debugfs_create_file("time", S_IRUGO, | 551 | (void) debugfs_create_file("time", S_IRUGO, |
| 552 | d, (void *)DEBUG_FILE_TIMERS, &debug_fops); | 552 | d, (void *)DEBUG_FILE_TIMERS, &debug_fops); |
| 553 | 553 | ||
| 554 | pwrdm_for_each(pwrdms_setup, (void *)d); | 554 | pwrdm_for_each_nolock(pwrdms_setup, (void *)d); |
| 555 | 555 | ||
| 556 | pm_dbg_dir = debugfs_create_dir("registers", d); | 556 | pm_dbg_dir = debugfs_create_dir("registers", d); |
| 557 | if (IS_ERR(pm_dbg_dir)) | 557 | if (IS_ERR(pm_dbg_dir)) |
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index 2594cbff3947..f00289abd30f 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c | |||
| @@ -273,35 +273,50 @@ struct powerdomain *pwrdm_lookup(const char *name) | |||
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | /** | 275 | /** |
| 276 | * pwrdm_for_each - call function on each registered clockdomain | 276 | * pwrdm_for_each_nolock - call function on each registered clockdomain |
| 277 | * @fn: callback function * | 277 | * @fn: callback function * |
| 278 | * | 278 | * |
| 279 | * Call the supplied function for each registered powerdomain. The | 279 | * Call the supplied function for each registered powerdomain. The |
| 280 | * callback function can return anything but 0 to bail out early from | 280 | * callback function can return anything but 0 to bail out early from |
| 281 | * the iterator. The callback function is called with the pwrdm_rwlock | 281 | * the iterator. Returns the last return value of the callback function, which |
| 282 | * held for reading, so no powerdomain structure manipulation | 282 | * should be 0 for success or anything else to indicate failure; or -EINVAL if |
| 283 | * functions should be called from the callback, although hardware | 283 | * the function pointer is null. |
| 284 | * powerdomain control functions are fine. Returns the last return | ||
| 285 | * value of the callback function, which should be 0 for success or | ||
| 286 | * anything else to indicate failure; or -EINVAL if the function | ||
| 287 | * pointer is null. | ||
| 288 | */ | 284 | */ |
| 289 | int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user), | 285 | int pwrdm_for_each_nolock(int (*fn)(struct powerdomain *pwrdm, void *user), |
| 290 | void *user) | 286 | void *user) |
| 291 | { | 287 | { |
| 292 | struct powerdomain *temp_pwrdm; | 288 | struct powerdomain *temp_pwrdm; |
| 293 | unsigned long flags; | ||
| 294 | int ret = 0; | 289 | int ret = 0; |
| 295 | 290 | ||
| 296 | if (!fn) | 291 | if (!fn) |
| 297 | return -EINVAL; | 292 | return -EINVAL; |
| 298 | 293 | ||
| 299 | read_lock_irqsave(&pwrdm_rwlock, flags); | ||
| 300 | list_for_each_entry(temp_pwrdm, &pwrdm_list, node) { | 294 | list_for_each_entry(temp_pwrdm, &pwrdm_list, node) { |
| 301 | ret = (*fn)(temp_pwrdm, user); | 295 | ret = (*fn)(temp_pwrdm, user); |
| 302 | if (ret) | 296 | if (ret) |
| 303 | break; | 297 | break; |
| 304 | } | 298 | } |
| 299 | |||
| 300 | return ret; | ||
| 301 | } | ||
| 302 | |||
| 303 | /** | ||
| 304 | * pwrdm_for_each - call function on each registered clockdomain | ||
| 305 | * @fn: callback function * | ||
| 306 | * | ||
| 307 | * This function is the same as 'pwrdm_for_each_nolock()', but keeps the | ||
| 308 | * &pwrdm_rwlock locked for reading, so no powerdomain structure manipulation | ||
| 309 | * functions should be called from the callback, although hardware powerdomain | ||
| 310 | * control functions are fine. | ||
| 311 | */ | ||
| 312 | int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user), | ||
| 313 | void *user) | ||
| 314 | { | ||
| 315 | unsigned long flags; | ||
| 316 | int ret; | ||
| 317 | |||
| 318 | read_lock_irqsave(&pwrdm_rwlock, flags); | ||
| 319 | ret = pwrdm_for_each_nolock(fn, user); | ||
| 305 | read_unlock_irqrestore(&pwrdm_rwlock, flags); | 320 | read_unlock_irqrestore(&pwrdm_rwlock, flags); |
| 306 | 321 | ||
| 307 | return ret; | 322 | return ret; |
diff --git a/arch/arm/plat-omap/include/mach/powerdomain.h b/arch/arm/plat-omap/include/mach/powerdomain.h index 6271d8556a40..fa6461423bd0 100644 --- a/arch/arm/plat-omap/include/mach/powerdomain.h +++ b/arch/arm/plat-omap/include/mach/powerdomain.h | |||
| @@ -135,6 +135,8 @@ struct powerdomain *pwrdm_lookup(const char *name); | |||
| 135 | 135 | ||
| 136 | int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user), | 136 | int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user), |
| 137 | void *user); | 137 | void *user); |
| 138 | int pwrdm_for_each_nolock(int (*fn)(struct powerdomain *pwrdm, void *user), | ||
| 139 | void *user); | ||
| 138 | 140 | ||
| 139 | int pwrdm_add_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm); | 141 | int pwrdm_add_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm); |
| 140 | int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm); | 142 | int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm); |
