Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 167029
b: refs/heads/master
c: ee894b1
h: refs/heads/master
i:
  167027: 68c45b1
v: v3
  • Loading branch information
Artem Bityutskiy authored and Kevin Hilman committed Oct 5, 2009
1 parent 82bbd60 commit d1c2737
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eb350f74ebff9573641c5fb689fb071b695ef35b
refs/heads/master: ee894b18e064447f86019af38a90ccb091880942
4 changes: 2 additions & 2 deletions trunk/arch/arm/mach-omap2/pm-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ static int __init pm_dbg_init(void)
printk(KERN_ERR "%s: only OMAP3 supported\n", __func__);
return -ENODEV;
}

d = debugfs_create_dir("pm_debug", NULL);
if (IS_ERR(d))
return PTR_ERR(d);
Expand All @@ -551,7 +551,7 @@ static int __init pm_dbg_init(void)
(void) debugfs_create_file("time", S_IRUGO,
d, (void *)DEBUG_FILE_TIMERS, &debug_fops);

pwrdm_for_each(pwrdms_setup, (void *)d);
pwrdm_for_each_nolock(pwrdms_setup, (void *)d);

pm_dbg_dir = debugfs_create_dir("registers", d);
if (IS_ERR(pm_dbg_dir))
Expand Down
39 changes: 27 additions & 12 deletions trunk/arch/arm/mach-omap2/powerdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,35 +273,50 @@ struct powerdomain *pwrdm_lookup(const char *name)
}

/**
* pwrdm_for_each - call function on each registered clockdomain
* pwrdm_for_each_nolock - call function on each registered clockdomain
* @fn: callback function *
*
* Call the supplied function for each registered powerdomain. The
* callback function can return anything but 0 to bail out early from
* the iterator. The callback function is called with the pwrdm_rwlock
* held for reading, so no powerdomain structure manipulation
* functions should be called from the callback, although hardware
* powerdomain control functions are fine. Returns the last return
* value of the callback function, which should be 0 for success or
* anything else to indicate failure; or -EINVAL if the function
* pointer is null.
* the iterator. Returns the last return value of the callback function, which
* should be 0 for success or anything else to indicate failure; or -EINVAL if
* the function pointer is null.
*/
int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user),
void *user)
int pwrdm_for_each_nolock(int (*fn)(struct powerdomain *pwrdm, void *user),
void *user)
{
struct powerdomain *temp_pwrdm;
unsigned long flags;
int ret = 0;

if (!fn)
return -EINVAL;

read_lock_irqsave(&pwrdm_rwlock, flags);
list_for_each_entry(temp_pwrdm, &pwrdm_list, node) {
ret = (*fn)(temp_pwrdm, user);
if (ret)
break;
}

return ret;
}

/**
* pwrdm_for_each - call function on each registered clockdomain
* @fn: callback function *
*
* This function is the same as 'pwrdm_for_each_nolock()', but keeps the
* &pwrdm_rwlock locked for reading, so no powerdomain structure manipulation
* functions should be called from the callback, although hardware powerdomain
* control functions are fine.
*/
int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user),
void *user)
{
unsigned long flags;
int ret;

read_lock_irqsave(&pwrdm_rwlock, flags);
ret = pwrdm_for_each_nolock(fn, user);
read_unlock_irqrestore(&pwrdm_rwlock, flags);

return ret;
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/arm/plat-omap/include/mach/powerdomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ struct powerdomain *pwrdm_lookup(const char *name);

int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user),
void *user);
int pwrdm_for_each_nolock(int (*fn)(struct powerdomain *pwrdm, void *user),
void *user);

int pwrdm_add_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm);
int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm);
Expand Down

0 comments on commit d1c2737

Please sign in to comment.