Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 108989
b: refs/heads/master
c: 3b98aea
h: refs/heads/master
i:
  108987: 09c532d
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Aug 21, 2008
1 parent e9a6d3f commit 7a4773c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 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: 7c2250352e11bf956c4cfa20b01ae6ba72882788
refs/heads/master: 3b98aeaf3a75f544dc945694f4fcf6e1c4bab89d
9 changes: 6 additions & 3 deletions trunk/drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ void device_initialize(struct device *dev)
spin_lock_init(&dev->devres_lock);
INIT_LIST_HEAD(&dev->devres_head);
device_init_wakeup(dev, 0);
device_pm_init(dev);
set_dev_node(dev, -1);
}

Expand Down Expand Up @@ -897,9 +898,10 @@ int device_add(struct device *dev)
error = bus_add_device(dev);
if (error)
goto BusError;
error = device_pm_add(dev);
error = dpm_sysfs_add(dev);
if (error)
goto PMError;
goto DPMError;
device_pm_add(dev);
kobject_uevent(&dev->kobj, KOBJ_ADD);
bus_attach_device(dev);
if (parent)
Expand All @@ -920,7 +922,7 @@ int device_add(struct device *dev)
Done:
put_device(dev);
return error;
PMError:
DPMError:
bus_remove_device(dev);
BusError:
if (dev->bus)
Expand Down Expand Up @@ -1007,6 +1009,7 @@ void device_del(struct device *dev)
struct class_interface *class_intf;

device_pm_remove(dev);
dpm_sysfs_remove(dev);
if (parent)
klist_del(&dev->knode_parent);
if (MAJOR(dev->devt)) {
Expand Down
13 changes: 3 additions & 10 deletions trunk/drivers/base/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ void device_pm_unlock(void)
* device_pm_add - add a device to the list of active devices
* @dev: Device to be added to the list
*/
int device_pm_add(struct device *dev)
void device_pm_add(struct device *dev)
{
int error;

pr_debug("PM: Adding info for %s:%s\n",
dev->bus ? dev->bus->name : "No Bus",
kobject_name(&dev->kobj));
Expand All @@ -89,13 +87,9 @@ int device_pm_add(struct device *dev)
*/
WARN_ON(true);
}
error = dpm_sysfs_add(dev);
if (!error) {
dev->power.status = DPM_ON;
list_add_tail(&dev->power.entry, &dpm_list);
}

list_add_tail(&dev->power.entry, &dpm_list);
mutex_unlock(&dpm_list_mtx);
return error;
}

/**
Expand All @@ -110,7 +104,6 @@ void device_pm_remove(struct device *dev)
dev->bus ? dev->bus->name : "No Bus",
kobject_name(&dev->kobj));
mutex_lock(&dpm_list_mtx);
dpm_sysfs_remove(dev);
list_del_init(&dev->power.entry);
mutex_unlock(&dpm_list_mtx);
}
Expand Down
9 changes: 7 additions & 2 deletions trunk/drivers/base/power/power.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
static inline void device_pm_init(struct device *dev)
{
dev->power.status = DPM_ON;
}

#ifdef CONFIG_PM_SLEEP

/*
Expand All @@ -11,12 +16,12 @@ static inline struct device *to_device(struct list_head *entry)
return container_of(entry, struct device, power.entry);
}

extern int device_pm_add(struct device *);
extern void device_pm_add(struct device *);
extern void device_pm_remove(struct device *);

#else /* CONFIG_PM_SLEEP */

static inline int device_pm_add(struct device *dev) { return 0; }
static inline void device_pm_add(struct device *dev) {}
static inline void device_pm_remove(struct device *dev) {}

#endif
Expand Down

0 comments on commit 7a4773c

Please sign in to comment.