[PATCH] [PM] Fixes missing PM entries in sysfs withoutCONFIG_PM_SLEEP

From: Dasgupta, Romit
Date: Sun Aug 03 2008 - 10:13:18 EST


Alan,
Here is a patch for you. Tested with

1) CONFIG_SUSPEND, CONFIG_HIBERNATION i.e. with CONFIG_PM_SLEEP
2) without CONFIG_PM_SLEEP but with CONFIG_PM
3) without CONFIG_PM

Thanks,
-Romit


Description: Fixes missing PM entries in sysfs without CONFIG_PM_SLEEP.
Signed-off-by: Romit Dasgupta <romit@xxxxxx>
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index a3252c0..ad8112d 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -1,3 +1,25 @@
+#ifdef CONFIG_PM
+
+/*
+ * sysfs.c
+ */
+
+extern int dpm_sysfs_add(struct device *);
+extern void dpm_sysfs_remove(struct device *);
+
+#else /* CONFIG_PM */
+
+static inline int dpm_sysfs_add(struct device *dev)
+{
+ return 0;
+}
+
+static inline void dpm_sysfs_remove(struct device *dev)
+{
+}
+
+#endif
+
#ifdef CONFIG_PM_SLEEP

/*
@@ -16,29 +38,13 @@ 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
- */
-
-extern int dpm_sysfs_add(struct device *);
-extern void dpm_sysfs_remove(struct device *);
-
-#else /* CONFIG_PM */
-
-static inline int dpm_sysfs_add(struct device *dev)
+static inline int device_pm_add(struct device *dev)
{
- return 0;
+ return dpm_sysfs_add(dev);
}
-
-static inline void dpm_sysfs_remove(struct device *dev)
+static inline void device_pm_remove(struct device *dev)
{
+ dpm_sysfs_remove(dev);
}

#endif

>-----Original Message-----
>From: Alan Stern [mailto:stern@xxxxxxxxxxxxxxxxxxx]
>Sent: Sunday, August 03, 2008 5:16 AM
>To: Dasgupta, Romit
>Cc: David Engraf; Greg KH; linux-usb@xxxxxxxxxxxxxxx
>Subject: RE: usb_create_sysfs_dev_files in hub.c:1586 fails on system boot
>
>On Fri, 1 Aug 2008, Dasgupta, Romit wrote:
>
>> CONFIG_PM_SLEEP needs to be enabled for power to be added as a sysfs and
>that is dependent on CONFIG_SUSPEND (Suspend to RAM and standby).
>
>You're right. I thought we had fixed that some time ago, but it's
>still wrong. In particular, the inline definition of device_pm_add()
>in drivers/base/power/power.h is wrong; it needs to call
>dpm_sysfs_add().
>
>I can't make up a patch now; I'll do it on Monday if nobody beats me to
>it.
>
>Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/