From: Daniel Drake Index: linux-2.6.24-rc1-git14/drivers/base/core.c =================================================================== --- linux-2.6.24-rc1-git14.orig/drivers/base/core.c +++ linux-2.6.24-rc1-git14/drivers/base/core.c @@ -770,6 +770,9 @@ int device_add(struct device *dev) error = device_add_attrs(dev); if (error) goto AttrsError; + error = dpm_sysfs_add(dev); + if (error) + goto PMsysfsError; error = device_pm_add(dev); if (error) goto PMError; @@ -797,11 +800,13 @@ int device_add(struct device *dev) return error; BusError: device_pm_remove(dev); - PMError: + PMsysfsError: if (dev->bus) blocking_notifier_call_chain(&dev->bus->bus_notifier, BUS_NOTIFY_DEL_DEVICE, dev); device_remove_attrs(dev); + PMError: + dpm_sysfs_remove(dev); AttrsError: device_remove_class_symlinks(dev); SymlinkError: Index: linux-2.6.24-rc1-git14/drivers/base/power/Makefile =================================================================== --- linux-2.6.24-rc1-git14.orig/drivers/base/power/Makefile +++ linux-2.6.24-rc1-git14/drivers/base/power/Makefile @@ -1,5 +1,6 @@ obj-y := shutdown.o -obj-$(CONFIG_PM_SLEEP) += main.o sysfs.o +obj-$(CONFIG_PM) += sysfs.o +obj-$(CONFIG_PM_SLEEP) += main.o obj-$(CONFIG_PM_TRACE) += trace.o ifeq ($(CONFIG_DEBUG_DRIVER),y) Index: linux-2.6.24-rc1-git14/drivers/base/power/power.h =================================================================== --- linux-2.6.24-rc1-git14.orig/drivers/base/power/power.h +++ linux-2.6.24-rc1-git14/drivers/base/power/power.h @@ -21,6 +21,22 @@ static inline struct device * to_device( extern int 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_remove(struct device * dev) +{ + +} + +#endif + +#ifdef CONFIG_PM + /* * sysfs.c */ @@ -28,16 +44,16 @@ extern void device_pm_remove(struct devi extern int dpm_sysfs_add(struct device *); extern void dpm_sysfs_remove(struct device *); -#else /* CONFIG_PM_SLEEP */ - +#else /* CONFIG_PM */ -static inline int device_pm_add(struct device * dev) +static inline int dpm_sysfs_add(struct device * dev) { return 0; } -static inline void device_pm_remove(struct device * dev) +static inline void dpm_sysfs_remove(struct device * dev) { } -#endif +#endif /* CONFIG_PM */ +