Commit e9b7bd4e authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[PATCH] one less word in struct device

This saves a word from "struct device" ... there's a refcounting mechanism
stub that's rather ineffective (the values are never even tested!), which
can safely be deleted.  With this patch it uses normal device refcounting,
so any potential users of the pm_parent mechanism will be more correct.
(That mechanism is actually unusable for now though; it does nothing.)
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>

 drivers/base/power/main.c |   26 +++-----------------------
 include/linux/pm.h        |    1 -
 2 files changed, 3 insertions(+), 24 deletions(-)
parent a1d59ce8
...@@ -30,23 +30,6 @@ LIST_HEAD(dpm_off_irq); ...@@ -30,23 +30,6 @@ LIST_HEAD(dpm_off_irq);
DECLARE_MUTEX(dpm_sem); DECLARE_MUTEX(dpm_sem);
DECLARE_MUTEX(dpm_list_sem); DECLARE_MUTEX(dpm_list_sem);
/*
* PM Reference Counting.
*/
static inline void device_pm_hold(struct device * dev)
{
if (dev)
atomic_inc(&dev->power.pm_users);
}
static inline void device_pm_release(struct device * dev)
{
if (dev)
atomic_dec(&dev->power.pm_users);
}
/** /**
* device_pm_set_parent - Specify power dependency. * device_pm_set_parent - Specify power dependency.
* @dev: Device who needs power. * @dev: Device who needs power.
...@@ -62,10 +45,8 @@ static inline void device_pm_release(struct device * dev) ...@@ -62,10 +45,8 @@ static inline void device_pm_release(struct device * dev)
void device_pm_set_parent(struct device * dev, struct device * parent) void device_pm_set_parent(struct device * dev, struct device * parent)
{ {
struct device * old_parent = dev->power.pm_parent; put_device(dev->power.pm_parent);
device_pm_release(old_parent); dev->power.pm_parent = get_device(parent);
dev->power.pm_parent = parent;
device_pm_hold(parent);
} }
EXPORT_SYMBOL_GPL(device_pm_set_parent); EXPORT_SYMBOL_GPL(device_pm_set_parent);
...@@ -75,7 +56,6 @@ int device_pm_add(struct device * dev) ...@@ -75,7 +56,6 @@ int device_pm_add(struct device * dev)
pr_debug("PM: Adding info for %s:%s\n", pr_debug("PM: Adding info for %s:%s\n",
dev->bus ? dev->bus->name : "No Bus", dev->kobj.name); dev->bus ? dev->bus->name : "No Bus", dev->kobj.name);
atomic_set(&dev->power.pm_users, 0);
down(&dpm_list_sem); down(&dpm_list_sem);
list_add_tail(&dev->power.entry, &dpm_active); list_add_tail(&dev->power.entry, &dpm_active);
device_pm_set_parent(dev, dev->parent); device_pm_set_parent(dev, dev->parent);
...@@ -91,7 +71,7 @@ void device_pm_remove(struct device * dev) ...@@ -91,7 +71,7 @@ void device_pm_remove(struct device * dev)
dev->bus ? dev->bus->name : "No Bus", dev->kobj.name); dev->bus ? dev->bus->name : "No Bus", dev->kobj.name);
down(&dpm_list_sem); down(&dpm_list_sem);
dpm_sysfs_remove(dev); dpm_sysfs_remove(dev);
device_pm_release(dev->power.pm_parent); put_device(dev->power.pm_parent);
list_del_init(&dev->power.entry); list_del_init(&dev->power.entry);
up(&dpm_list_sem); up(&dpm_list_sem);
} }
......
...@@ -224,7 +224,6 @@ struct dev_pm_info { ...@@ -224,7 +224,6 @@ struct dev_pm_info {
unsigned should_wakeup:1; unsigned should_wakeup:1;
pm_message_t prev_state; pm_message_t prev_state;
void * saved_state; void * saved_state;
atomic_t pm_users;
struct device * pm_parent; struct device * pm_parent;
struct list_head entry; struct list_head entry;
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment