|
From: Todd P. <tp...@mv...> - 2005-03-22 00:55:35
|
Now that DPM extensions for driver scale callbacks and device
constraints do not depend on LDM PM data structures, some support for
these can be provided when CONFIG_PM=n (although that is expected to be
a rare situation). A patch to fixup these follows, thanks -- Todd
diff -u linux-2.6.10/drivers/base/power/Makefile linux-2.6.10/drivers/base/power/Makefile
--- linux-2.6.10/drivers/base/power/Makefile 2005-03-10 21:26:07.000000000 +0000
+++ linux-2.6.10/drivers/base/power/Makefile 2005-03-21 23:02:11.000000000 +0000
@@ -1,5 +1,5 @@
-obj-y := shutdown.o
-obj-$(CONFIG_PM) += main.o suspend.o resume.o runtime.o sysfs.o power-dpm.o
+obj-y := shutdown.o power-dpm.o
+obj-$(CONFIG_PM) += main.o suspend.o resume.o runtime.o sysfs.o
ifeq ($(CONFIG_DEBUG_DRIVER),y)
EXTRA_CFLAGS += -DDEBUG
diff -u linux-2.6.10/drivers/base/power/power-dpm.c linux-2.6.10/drivers/base/power/power-dpm.c
--- linux-2.6.10/drivers/base/power/power-dpm.c 2005-03-10 21:30:56.000000000 +0000
+++ linux-2.6.10/drivers/base/power/power-dpm.c 2005-03-21 23:24:13.000000000 +0000
@@ -155,13 +155,12 @@
* Device constraints
*/
-
+#ifdef CONFIG_DPM
LIST_HEAD(dpm_constraints);
DECLARE_MUTEX(dpm_constraints_sem);
void assert_constraints(struct constraints *constraints)
{
-#ifdef CONFIG_DPM
if (! constraints || constraints->asserted)
return;
@@ -172,13 +171,11 @@
/* DPM-PM-TODO: Check against DPM state. */
-#endif /* CONFIG_DPM */
}
void deassert_constraints(struct constraints *constraints)
{
-#ifdef CONFIG_DPM
if (! constraints || ! constraints->asserted)
return;
@@ -186,7 +183,6 @@
constraints->asserted = 0;
list_del_init(&constraints->entry);
up(&dpm_constraints_sem);
-#endif /* CONFIG_DPM */
}
@@ -196,7 +192,6 @@
static ssize_t
constraints_show(struct device * dev, char * buf)
{
-#ifdef CONFIG_DPM
int i, cnt = 0;
if (dev->constraints) {
@@ -215,15 +210,11 @@
}
return cnt;
-#else /* CONFIG_DPM */
- return 0;
-#endif /* CONFIG_DPM */
}
static ssize_t
constraints_store(struct device * dev, const char * buf, size_t count)
{
-#ifdef CONFIG_DPM
int num_args, paramid, min, max;
int cidx;
const char *cp, *paramname;
@@ -299,14 +290,21 @@
}
return ret < 0 ? ret : count;
-#else /* CONFIG_DPM */
- return -EINVAL;
-#endif /* CONFIG_DPM */
}
DEVICE_ATTR(constraints,S_IWUSR | S_IRUGO,
constraints_show,constraints_store);
+#else /* CONFIG_DPM */
+void assert_constraints(struct constraints *constraints)
+{
+}
+
+void deassert_constraints(struct constraints *constraints)
+{
+}
+#endif /* CONFIG_DPM */
+
#ifdef CONFIG_DPM
/*
@@ -410,6 +408,7 @@
int dpm_show_opconstraints(struct dpm_opt *opt, char * buf)
{
+#ifdef CONFIG_PM
struct list_head * entry;
int len = 0;
@@ -423,6 +422,9 @@
}
return len;
+#else /* CONFIG_PM */
+ return 0;
+#endif /* CONFIG_PM */
}
#endif /* CONFIG_DPM */
diff -u linux-2.6.10/include/linux/pm.h linux-2.6.10/include/linux/pm.h
--- linux-2.6.10/include/linux/pm.h 2005-03-10 21:26:07.000000000 +0000
+++ linux-2.6.10/include/linux/pm.h 2005-03-21 23:08:21.000000000 +0000
@@ -260,17 +260,10 @@
SCALE_POSTCHANGE,
};
-#ifdef CONFIG_PM
extern void assert_constraints(struct constraints *);
extern void deassert_constraints(struct constraints *);
extern void power_event(char *eventstr);
extern void device_power_event(struct device * dev, char *eventstr);
-#else /* CONFIG_PM */
-static inline void assert_constraints(struct constraints *c) {}
-static inline void deassert_constraints(struct constraints *c) {}
-static inline void power_event(char *eventstr) {}
-static inline void device_power_event(struct device * dev, char *eventstr) {}
-#endif /* CONFIG_PM */
#endif /* __KERNEL__ */
|