Skip to content

Commit

Permalink
PM: Convert dev_pm_put_subsys_data() into a void function
Browse files Browse the repository at this point in the history
Clients using the dev_pm_put_subsys_data() API isn't interested of a
return value. They care only of decreasing a reference to the device's
pm_subsys_data. So, let's convert the API to a void function, which
anyway seems like reasonable thing to do.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Ulf Hansson authored and Rafael J. Wysocki committed Feb 3, 2015
1 parent 766bb53 commit 1e95e3b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 deletions drivers/base/power/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,32 +56,26 @@ EXPORT_SYMBOL_GPL(dev_pm_get_subsys_data);
* @dev: Device to handle.
*
* If the reference counter of power.subsys_data is zero after dropping the
* reference, power.subsys_data is removed. Return 1 if that happens or 0
* otherwise.
* reference, power.subsys_data is removed.
*/
int dev_pm_put_subsys_data(struct device *dev)
void dev_pm_put_subsys_data(struct device *dev)
{
struct pm_subsys_data *psd;
int ret = 1;

spin_lock_irq(&dev->power.lock);

psd = dev_to_psd(dev);
if (!psd)
goto out;

if (--psd->refcount == 0) {
if (--psd->refcount == 0)
dev->power.subsys_data = NULL;
} else {
else
psd = NULL;
ret = 0;
}

out:
spin_unlock_irq(&dev->power.lock);
kfree(psd);

return ret;
}
EXPORT_SYMBOL_GPL(dev_pm_put_subsys_data);

Expand Down
2 changes: 1 addition & 1 deletion include/linux/pm.h
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ struct dev_pm_info {

extern void update_pm_runtime_accounting(struct device *dev);
extern int dev_pm_get_subsys_data(struct device *dev);
extern int dev_pm_put_subsys_data(struct device *dev);
extern void dev_pm_put_subsys_data(struct device *dev);

/*
* Power domains provide callbacks that are executed during system suspend,
Expand Down

0 comments on commit 1e95e3b

Please sign in to comment.