Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 245367
b: refs/heads/master
c: 1d2b71f
h: refs/heads/master
i:
  245365: 208b250
  245363: 01187e0
  245359: 6a0c108
v: v3
  • Loading branch information
Rafael J. Wysocki committed Apr 28, 2011
1 parent 72809ef commit 4b11fb3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 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: 638080c37ae08fd0c44cec13d7948ca5385ae851
refs/heads/master: 1d2b71f61b6a10216274e27b717becf9ae101fc7
34 changes: 17 additions & 17 deletions trunk/arch/arm/mach-shmobile/pm_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/clk.h>
#include <linux/sh_clk.h>
#include <linux/bitmap.h>
#include <linux/slab.h>

#ifdef CONFIG_PM_RUNTIME
#define BIT_ONCE 0
Expand All @@ -29,22 +30,9 @@ struct pm_runtime_data {
struct clk *clk;
};

static void __devres_release(struct device *dev, void *res)
{
struct pm_runtime_data *prd = res;

dev_dbg(dev, "__devres_release()\n");

if (test_bit(BIT_CLK_ENABLED, &prd->flags))
clk_disable(prd->clk);

if (test_bit(BIT_ACTIVE, &prd->flags))
clk_put(prd->clk);
}

static struct pm_runtime_data *__to_prd(struct device *dev)
{
return devres_find(dev, __devres_release, NULL, NULL);
return dev ? dev->power.subsys_data : NULL;
}

static void platform_pm_runtime_init(struct device *dev,
Expand Down Expand Up @@ -121,14 +109,26 @@ static int platform_bus_notify(struct notifier_block *nb,

dev_dbg(dev, "platform_bus_notify() %ld !\n", action);

if (action == BUS_NOTIFY_BIND_DRIVER) {
prd = devres_alloc(__devres_release, sizeof(*prd), GFP_KERNEL);
switch (action) {
case BUS_NOTIFY_BIND_DRIVER:
prd = kzalloc(sizeof(*prd), GFP_KERNEL);
if (prd) {
devres_add(dev, prd);
dev->power.subsys_data = prd;
dev->pwr_domain = &default_power_domain;
} else {
dev_err(dev, "unable to alloc memory for runtime pm\n");
}
break;
case BUS_NOTIFY_UNBOUND_DRIVER:
prd = __to_prd(dev);
if (prd) {
if (test_bit(BIT_CLK_ENABLED, &prd->flags))
clk_disable(prd->clk);

if (test_bit(BIT_ACTIVE, &prd->flags))
clk_put(prd->clk);
}
break;
}

return 0;
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/pm.h
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ struct dev_pm_info {
unsigned long active_jiffies;
unsigned long suspended_jiffies;
unsigned long accounting_timestamp;
void *subsys_data; /* Owned by the subsystem. */
#endif
};

Expand Down

0 comments on commit 4b11fb3

Please sign in to comment.