LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Re: + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree
[not found] <200803190315.m2J3FXnK029022@imap1.linux-foundation.org>
@ 2008-03-19 14:55 ` Alan Stern
2008-03-19 18:48 ` Andrew Morton
0 siblings, 1 reply; 15+ messages in thread
From: Alan Stern @ 2008-03-19 14:55 UTC (permalink / raw)
To: Andrew Morton
Cc: Linux-pm mailing list, Kernel development list, Greg KH, lenb,
Rafael J. Wysocki
On Tue, 18 Mar 2008 akpm@linux-foundation.org wrote:
> Subject: pm-convert-wakeup-flag-accessors-to-inline-functions fix
> From: Andrew Morton <akpm@linux-foundation.org>
>
> ia64 allmodconfig:
>
> In file included from include/linux/device.h:381,
> from include/linux/rtc.h:110,
> from include/linux/efi.h:19,
> from include/asm/sal.h:40,
> from include/asm-ia64/mca.h:20,
> from arch/ia64/kernel/asm-offsets.c:17:
> include/linux/pm_wakeup.h: In function `device_init_wakeup':
> include/linux/pm_wakeup.h:35: error: structure has no member named `should_wakeup'
> include/linux/pm_wakeup.h: In function `device_set_wakeup_enable':
> include/linux/pm_wakeup.h:45: error: structure has no member named `should_wakeup'
> include/linux/pm_wakeup.h: In function `device_may_wakeup':
> include/linux/pm_wakeup.h:50: error: structure has no member named `should_wakeup'
>
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: Greg KH <greg@kroah.com>
> Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> Cc: Len Brown <lenb@kernel.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> include/linux/pm_wakeup.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff -puN include/linux/pm_wakeup.h~pm-convert-wakeup-flag-accessors-to-inline-functions-fix include/linux/pm_wakeup.h
> --- a/include/linux/pm_wakeup.h~pm-convert-wakeup-flag-accessors-to-inline-functions-fix
> +++ a/include/linux/pm_wakeup.h
> @@ -25,7 +25,7 @@
> # error "please don't include this file directly"
> #endif
>
> -#ifdef CONFIG_PM
> +#ifdef CONFIG_PM_SLEEP
>
> /* changes to device_may_wakeup take effect on the next pm state change.
> * by default, devices should wakeup if they can.
This is completely wrong.
Andrew, I don't know what happened. But if you go back and compare my
original patch to the
pm-make-wakeup-flags-available-whenever-config_pm-is-set patch you
actually applied, you'll see that you managed to leave out a hunk.
Possibly because of a conflict with one of Rafael's patches affecting
the same area of code.
Here's a URL for that patch as rebased by Rafael:
http://marc.info/?l=linux-kernel&m=120528034413861&w=2
The very first hunk in that patch makes the should_wakeup flag
available always, not just when CONFIG_PM_SLEEP is set. If you go back
and import it with that first hunk intact then there should be no need
for this "fix" patch.
(In order to do this, you'll first have to revert
pm-convert-wakeup-flag-accessors-to-inline-functions.patch and then
re-apply it afterward, because it depends on this one.)
Alan Stern
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree
2008-03-19 14:55 ` + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree Alan Stern
@ 2008-03-19 18:48 ` Andrew Morton
2008-03-19 18:57 ` Greg KH
0 siblings, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2008-03-19 18:48 UTC (permalink / raw)
To: Alan Stern
Cc: Linux-pm mailing list, Kernel development list, Greg KH, lenb,
Rafael J. Wysocki
On Wed, 19 Mar 2008 10:55:35 -0400 (EDT) Alan Stern <stern@rowland.harvard.edu> wrote:
> On Tue, 18 Mar 2008 akpm@linux-foundation.org wrote:
>
> > Subject: pm-convert-wakeup-flag-accessors-to-inline-functions fix
> > From: Andrew Morton <akpm@linux-foundation.org>
> >
> > ia64 allmodconfig:
> >
> > In file included from include/linux/device.h:381,
> > from include/linux/rtc.h:110,
> > from include/linux/efi.h:19,
> > from include/asm/sal.h:40,
> > from include/asm-ia64/mca.h:20,
> > from arch/ia64/kernel/asm-offsets.c:17:
> > include/linux/pm_wakeup.h: In function `device_init_wakeup':
> > include/linux/pm_wakeup.h:35: error: structure has no member named `should_wakeup'
> > include/linux/pm_wakeup.h: In function `device_set_wakeup_enable':
> > include/linux/pm_wakeup.h:45: error: structure has no member named `should_wakeup'
> > include/linux/pm_wakeup.h: In function `device_may_wakeup':
> > include/linux/pm_wakeup.h:50: error: structure has no member named `should_wakeup'
> >
> > Cc: Alan Stern <stern@rowland.harvard.edu>
> > Cc: Greg KH <greg@kroah.com>
> > Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> > Cc: Len Brown <lenb@kernel.org>
> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> > ---
> >
> > include/linux/pm_wakeup.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff -puN include/linux/pm_wakeup.h~pm-convert-wakeup-flag-accessors-to-inline-functions-fix include/linux/pm_wakeup.h
> > --- a/include/linux/pm_wakeup.h~pm-convert-wakeup-flag-accessors-to-inline-functions-fix
> > +++ a/include/linux/pm_wakeup.h
> > @@ -25,7 +25,7 @@
> > # error "please don't include this file directly"
> > #endif
> >
> > -#ifdef CONFIG_PM
> > +#ifdef CONFIG_PM_SLEEP
> >
> > /* changes to device_may_wakeup take effect on the next pm state change.
> > * by default, devices should wakeup if they can.
>
> This is completely wrong.
>
> Andrew, I don't know what happened. But if you go back and compare my
> original patch to the
> pm-make-wakeup-flags-available-whenever-config_pm-is-set patch you
> actually applied, you'll see that you managed to leave out a hunk.
> Possibly because of a conflict with one of Rafael's patches affecting
> the same area of code.
>
> Here's a URL for that patch as rebased by Rafael:
>
> http://marc.info/?l=linux-kernel&m=120528034413861&w=2
But there was a patch with the same title from yourself sent four days
later, which is what I merged.
Plus Greg has been merging and dropping older versions under our feet and
maybe Len has too.
> The very first hunk in that patch makes the should_wakeup flag
> available always, not just when CONFIG_PM_SLEEP is set. If you go back
> and import it with that first hunk intact then there should be no need
> for this "fix" patch.
> (In order to do this, you'll first have to revert
> pm-convert-wakeup-flag-accessors-to-inline-functions.patch and then
> re-apply it afterward, because it depends on this one.)
<shudder>
I'll drop everything, let's start again.
Only how? umm, please review Greg's driver tree, let us know which patches
shoudl be dropped from that then send new ones, I guess.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree
2008-03-19 18:48 ` Andrew Morton
@ 2008-03-19 18:57 ` Greg KH
2008-03-19 21:33 ` [PATCH 0/3] PM wakeup flags revisited (was: Re: + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree) Rafael J. Wysocki
2008-03-19 21:46 ` + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree Alan Stern
0 siblings, 2 replies; 15+ messages in thread
From: Greg KH @ 2008-03-19 18:57 UTC (permalink / raw)
To: Andrew Morton
Cc: Alan Stern, Linux-pm mailing list, Kernel development list, lenb,
Rafael J. Wysocki
On Wed, Mar 19, 2008 at 11:48:29AM -0700, Andrew Morton wrote:
> I'll drop everything, let's start again.
>
> Only how? umm, please review Greg's driver tree, let us know which patches
> shoudl be dropped from that then send new ones, I guess.
Yes, please do, I'm confused as well :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 0/3] PM wakeup flags revisited (was: Re: + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree)
2008-03-19 18:57 ` Greg KH
@ 2008-03-19 21:33 ` Rafael J. Wysocki
2008-03-19 21:35 ` [PATCH 1/3] Fix misuse of wakeup flag accessors in serial core Rafael J. Wysocki
` (2 more replies)
2008-03-19 21:46 ` + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree Alan Stern
1 sibling, 3 replies; 15+ messages in thread
From: Rafael J. Wysocki @ 2008-03-19 21:33 UTC (permalink / raw)
To: Greg KH
Cc: Andrew Morton, Alan Stern, Linux-pm mailing list,
Kernel development list, lenb
On Wednesday, 19 of March 2008, Greg KH wrote:
> On Wed, Mar 19, 2008 at 11:48:29AM -0700, Andrew Morton wrote:
> > I'll drop everything, let's start again.
> >
> > Only how? umm, please review Greg's driver tree, let us know which patches
> > shoudl be dropped from that then send new ones, I guess.
>
> Yes, please do, I'm confused as well :)
Please drop pm-make-wakeup-flags-available-whenever-config_pm-is-set.patch
and apply the following three patches instead.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/3] Fix misuse of wakeup flag accessors in serial core
2008-03-19 21:33 ` [PATCH 0/3] PM wakeup flags revisited (was: Re: + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree) Rafael J. Wysocki
@ 2008-03-19 21:35 ` Rafael J. Wysocki
2008-03-20 23:23 ` patch pm-fix-misuse-of-wakeup-flag-accessors-in-serial-core.patch added to gregkh-2.6 tree gregkh
2008-03-19 21:37 ` [PATCH 2/3] PM: Make wakeup flags available whenever CONFIG_PM is set (ver 2) Rafael J. Wysocki
2008-03-19 21:39 ` [PATCH 3/3] PM: Convert wakeup flag accessors to inline functions Rafael J. Wysocki
2 siblings, 1 reply; 15+ messages in thread
From: Rafael J. Wysocki @ 2008-03-19 21:35 UTC (permalink / raw)
To: Greg KH
Cc: Andrew Morton, Alan Stern, Linux-pm mailing list,
Kernel development list, lenb
From: Alan Stern <stern@rowland.harvard.edu>
This patch (as1059) fixes a mistake in the way the serial core
initializes a device's wakeup settings. It should use the accessor
routine instead of relying on a macro producing an lvalue.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
Index: usb-2.6/drivers/serial/serial_core.c
===================================================================
--- usb-2.6.orig/drivers/serial/serial_core.c
+++ usb-2.6/drivers/serial/serial_core.c
@@ -2356,7 +2356,7 @@ int uart_add_one_port(struct uart_driver
*/
tty_dev = tty_register_device(drv->tty_driver, port->line, port->dev);
if (likely(!IS_ERR(tty_dev))) {
- device_can_wakeup(tty_dev) = 1;
+ device_init_wakeup(tty_dev, 1);
device_set_wakeup_enable(tty_dev, 0);
} else
printk(KERN_ERR "Cannot register tty device on line %d\n",
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 2/3] PM: Make wakeup flags available whenever CONFIG_PM is set (ver 2)
2008-03-19 21:33 ` [PATCH 0/3] PM wakeup flags revisited (was: Re: + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree) Rafael J. Wysocki
2008-03-19 21:35 ` [PATCH 1/3] Fix misuse of wakeup flag accessors in serial core Rafael J. Wysocki
@ 2008-03-19 21:37 ` Rafael J. Wysocki
2008-03-19 22:22 ` [linux-pm] " David Brownell
2008-03-20 23:23 ` patch pm-make-wakeup-flags-available-whenever-config_pm-is-set.patch added to gregkh-2.6 tree gregkh
2008-03-19 21:39 ` [PATCH 3/3] PM: Convert wakeup flag accessors to inline functions Rafael J. Wysocki
2 siblings, 2 replies; 15+ messages in thread
From: Rafael J. Wysocki @ 2008-03-19 21:37 UTC (permalink / raw)
To: Greg KH
Cc: Andrew Morton, Alan Stern, Linux-pm mailing list,
Kernel development list, lenb
From: Alan Stern <stern@rowland.harvard.edu>
The various wakeup flags and their accessor macros in struct
dev_pm_info should be available whenever CONFIG_PM is enabled, not
just when CONFIG_PM_SLEEP is on. Otherwise remote wakeup won't always
be configurable for runtime power management. This patch (as1056b)
fixes the oversight.
[rjw: rebased]
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/base/power/main.c | 2 --
drivers/base/power/sysfs.c | 2 ++
include/linux/pm.h | 36 +++++++++++++++++++++---------------
3 files changed, 23 insertions(+), 17 deletions(-)
Index: linux-2.6/include/linux/pm.h
===================================================================
--- linux-2.6.orig/include/linux/pm.h
+++ linux-2.6/include/linux/pm.h
@@ -183,9 +183,9 @@ typedef struct pm_message {
struct dev_pm_info {
pm_message_t power_state;
unsigned can_wakeup:1;
+ unsigned should_wakeup:1;
bool sleeping:1; /* Owned by the PM core */
#ifdef CONFIG_PM_SLEEP
- unsigned should_wakeup:1;
struct list_head entry;
#endif
};
@@ -198,11 +198,6 @@ extern void device_resume(void);
extern int device_suspend(pm_message_t state);
extern int device_prepare_suspend(pm_message_t state);
-#define device_set_wakeup_enable(dev,val) \
- ((dev)->power.should_wakeup = !!(val))
-#define device_may_wakeup(dev) \
- (device_can_wakeup(dev) && (dev)->power.should_wakeup)
-
extern void __suspend_report_result(const char *function, void *fn, int ret);
#define suspend_report_result(fn, ret) \
@@ -210,6 +205,24 @@ extern void __suspend_report_result(cons
__suspend_report_result(__FUNCTION__, fn, ret); \
} while (0)
+#else /* !CONFIG_PM_SLEEP */
+
+static inline int device_suspend(pm_message_t state)
+{
+ return 0;
+}
+
+#define suspend_report_result(fn, ret) do { } while (0)
+
+#endif /* !CONFIG_PM_SLEEP */
+
+#ifdef CONFIG_PM
+
+#define device_set_wakeup_enable(dev,val) \
+ ((dev)->power.should_wakeup = !!(val))
+#define device_may_wakeup(dev) \
+ (device_can_wakeup(dev) && (dev)->power.should_wakeup)
+
/*
* Platform hook to activate device wakeup capability, if that's not already
* handled by enable_irq_wake() etc.
@@ -224,24 +237,17 @@ static inline int call_platform_enable_w
return 0;
}
-#else /* !CONFIG_PM_SLEEP */
-
-static inline int device_suspend(pm_message_t state)
-{
- return 0;
-}
+#else /* !CONFIG_PM */
#define device_set_wakeup_enable(dev,val) do{}while(0)
#define device_may_wakeup(dev) (0)
-#define suspend_report_result(fn, ret) do { } while (0)
-
static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
{
return 0;
}
-#endif /* !CONFIG_PM_SLEEP */
+#endif /* !CONFIG_PM */
/* changes to device_may_wakeup take effect on the next pm state change.
* by default, devices should wakeup if they can.
Index: linux-2.6/drivers/base/power/main.c
===================================================================
--- linux-2.6.orig/drivers/base/power/main.c
+++ linux-2.6/drivers/base/power/main.c
@@ -57,8 +57,6 @@ static DEFINE_MUTEX(dpm_list_mtx);
/* 'true' if all devices have been suspended, protected by dpm_list_mtx */
static bool all_sleeping;
-int (*platform_enable_wakeup)(struct device *dev, int is_on);
-
/**
* device_pm_add - add a device to the list of active devices
* @dev: Device to be added to the list
Index: linux-2.6/drivers/base/power/sysfs.c
===================================================================
--- linux-2.6.orig/drivers/base/power/sysfs.c
+++ linux-2.6/drivers/base/power/sysfs.c
@@ -6,6 +6,8 @@
#include <linux/string.h>
#include "power.h"
+int (*platform_enable_wakeup)(struct device *dev, int is_on);
+
/*
* wakeup - Report/change current wakeup option for device
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 3/3] PM: Convert wakeup flag accessors to inline functions
2008-03-19 21:33 ` [PATCH 0/3] PM wakeup flags revisited (was: Re: + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree) Rafael J. Wysocki
2008-03-19 21:35 ` [PATCH 1/3] Fix misuse of wakeup flag accessors in serial core Rafael J. Wysocki
2008-03-19 21:37 ` [PATCH 2/3] PM: Make wakeup flags available whenever CONFIG_PM is set (ver 2) Rafael J. Wysocki
@ 2008-03-19 21:39 ` Rafael J. Wysocki
2008-03-20 23:23 ` patch pm-convert-wakeup-flag-accessors-to-inline-functions.patch added to gregkh-2.6 tree gregkh
2 siblings, 1 reply; 15+ messages in thread
From: Rafael J. Wysocki @ 2008-03-19 21:39 UTC (permalink / raw)
To: Greg KH
Cc: Andrew Morton, Alan Stern, Linux-pm mailing list,
Kernel development list, lenb
From: Alan Stern <stern@rowland.harvard.edu>
This patch (as1058) improves the wakeup macros in include/linux/pm.h.
All but the trivial ones are converted to inline routines, which
requires moving them to a separate header file since they depend on
the definition of struct device.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
include/linux/device.h | 3 +
include/linux/pm.h | 46 -----------------------
include/linux/pm_wakeup.h | 90 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 94 insertions(+), 45 deletions(-)
Index: linux-2.6/include/linux/pm.h
===================================================================
--- linux-2.6.orig/include/linux/pm.h
+++ linux-2.6/include/linux/pm.h
@@ -212,54 +212,10 @@ static inline int device_suspend(pm_mess
return 0;
}
-#define suspend_report_result(fn, ret) do { } while (0)
+#define suspend_report_result(fn, ret) do {} while (0)
#endif /* !CONFIG_PM_SLEEP */
-#ifdef CONFIG_PM
-
-#define device_set_wakeup_enable(dev,val) \
- ((dev)->power.should_wakeup = !!(val))
-#define device_may_wakeup(dev) \
- (device_can_wakeup(dev) && (dev)->power.should_wakeup)
-
-/*
- * Platform hook to activate device wakeup capability, if that's not already
- * handled by enable_irq_wake() etc.
- * Returns zero on success, else negative errno
- */
-extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
-
-static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
-{
- if (platform_enable_wakeup)
- return (*platform_enable_wakeup)(dev, is_on);
- return 0;
-}
-
-#else /* !CONFIG_PM */
-
-#define device_set_wakeup_enable(dev,val) do{}while(0)
-#define device_may_wakeup(dev) (0)
-
-static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
-{
- return 0;
-}
-
-#endif /* !CONFIG_PM */
-
-/* changes to device_may_wakeup take effect on the next pm state change.
- * by default, devices should wakeup if they can.
- */
-#define device_can_wakeup(dev) \
- ((dev)->power.can_wakeup)
-#define device_init_wakeup(dev,val) \
- do { \
- device_can_wakeup(dev) = !!(val); \
- device_set_wakeup_enable(dev,val); \
- } while(0)
-
/*
* Global Power Management flags
* Used to keep APM and ACPI from both being active
Index: linux-2.6/include/linux/device.h
===================================================================
--- linux-2.6.orig/include/linux/device.h
+++ linux-2.6/include/linux/device.h
@@ -475,6 +475,9 @@ struct device {
void (*release)(struct device *dev);
};
+/* Get the wakeup routines, which depend on struct device */
+#include <linux/pm_wakeup.h>
+
#ifdef CONFIG_NUMA
static inline int dev_to_node(struct device *dev)
{
Index: linux-2.6/include/linux/pm_wakeup.h
===================================================================
--- /dev/null
+++ linux-2.6/include/linux/pm_wakeup.h
@@ -0,0 +1,90 @@
+/*
+ * pm_wakeup.h - Power management wakeup interface
+ *
+ * Copyright (C) 2008 Alan Stern
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _LINUX_PM_WAKEUP_H
+#define _LINUX_PM_WAKEUP_H
+
+#ifndef _DEVICE_H_
+# error "please don't include this file directly"
+#endif
+
+#ifdef CONFIG_PM
+
+/* changes to device_may_wakeup take effect on the next pm state change.
+ * by default, devices should wakeup if they can.
+ */
+static inline void device_init_wakeup(struct device *dev, int val)
+{
+ dev->power.can_wakeup = dev->power.should_wakeup = !!val;
+}
+
+static inline int device_can_wakeup(struct device *dev)
+{
+ return dev->power.can_wakeup;
+}
+
+static inline void device_set_wakeup_enable(struct device *dev, int val)
+{
+ dev->power.should_wakeup = !!val;
+}
+
+static inline int device_may_wakeup(struct device *dev)
+{
+ return dev->power.can_wakeup & dev->power.should_wakeup;
+}
+
+/*
+ * Platform hook to activate device wakeup capability, if that's not already
+ * handled by enable_irq_wake() etc.
+ * Returns zero on success, else negative errno
+ */
+extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
+
+static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
+{
+ if (platform_enable_wakeup)
+ return (*platform_enable_wakeup)(dev, is_on);
+ return 0;
+}
+
+#else /* !CONFIG_PM */
+
+/* For some reason the next two routines work even without CONFIG_PM */
+static inline void device_init_wakeup(struct device *dev, int val)
+{
+ dev->power.can_wakeup = !!val;
+}
+
+static inline int device_can_wakeup(struct device *dev)
+{
+ return dev->power.can_wakeup;
+}
+
+#define device_set_wakeup_enable(dev, val) do {} while (0)
+#define device_may_wakeup(dev) 0
+
+static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
+{
+ return 0;
+}
+
+#endif /* !CONFIG_PM */
+
+#endif /* _LINUX_PM_WAKEUP_H */
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree
2008-03-19 18:57 ` Greg KH
2008-03-19 21:33 ` [PATCH 0/3] PM wakeup flags revisited (was: Re: + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree) Rafael J. Wysocki
@ 2008-03-19 21:46 ` Alan Stern
2008-03-19 21:55 ` Rafael J. Wysocki
1 sibling, 1 reply; 15+ messages in thread
From: Alan Stern @ 2008-03-19 21:46 UTC (permalink / raw)
To: Greg KH
Cc: Andrew Morton, Linux-pm mailing list, Kernel development list,
lenb, Rafael J. Wysocki
On Wed, 19 Mar 2008, Greg KH wrote:
> On Wed, Mar 19, 2008 at 11:48:29AM -0700, Andrew Morton wrote:
> > I'll drop everything, let's start again.
> >
> > Only how? umm, please review Greg's driver tree, let us know which patches
> > shoudl be dropped from that then send new ones, I guess.
>
> Yes, please do, I'm confused as well :)
Okay. No doubt Rafael will correct me if I get something wrong.
Greg's tree still contains the original, wrong version of
pm-make-wakeup-flags-available-whenever-config_pm-is-set.patch. It
should be reverted. In its place should be substituted this series of
patches (URLs for 0/3 ... 3/3):
http://marc.info/?l=linux-kernel&m=120561808422302&w=2
http://marc.info/?l=linux-kernel&m=120561808522316&w=2
http://marc.info/?l=linux-kernel&m=120561808522322&w=2
http://marc.info/?l=linux-kernel&m=120561808622328&w=2
There is likely to be a conflict in applying the 2/3 patch, because its
first hunk touches a region of code also affected by work Rafael has
been doing. The important aspect of that hunk is that it moves the
should_wakeup flag definition outside the region protected by "#ifdef
CONFIG_PM_SLEEP".
Alan Stern
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree
2008-03-19 21:46 ` + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree Alan Stern
@ 2008-03-19 21:55 ` Rafael J. Wysocki
2008-03-19 22:04 ` Alan Stern
0 siblings, 1 reply; 15+ messages in thread
From: Rafael J. Wysocki @ 2008-03-19 21:55 UTC (permalink / raw)
To: Alan Stern
Cc: Greg KH, Andrew Morton, Linux-pm mailing list,
Kernel development list, lenb
On Wednesday, 19 of March 2008, Alan Stern wrote:
> On Wed, 19 Mar 2008, Greg KH wrote:
>
> > On Wed, Mar 19, 2008 at 11:48:29AM -0700, Andrew Morton wrote:
> > > I'll drop everything, let's start again.
> > >
> > > Only how? umm, please review Greg's driver tree, let us know which patches
> > > shoudl be dropped from that then send new ones, I guess.
> >
> > Yes, please do, I'm confused as well :)
>
> Okay. No doubt Rafael will correct me if I get something wrong.
>
> Greg's tree still contains the original, wrong version of
> pm-make-wakeup-flags-available-whenever-config_pm-is-set.patch. It
> should be reverted. In its place should be substituted this series of
> patches (URLs for 0/3 ... 3/3):
>
> http://marc.info/?l=linux-kernel&m=120561808422302&w=2
> http://marc.info/?l=linux-kernel&m=120561808522316&w=2
> http://marc.info/?l=linux-kernel&m=120561808522322&w=2
> http://marc.info/?l=linux-kernel&m=120561808622328&w=2
>
> There is likely to be a conflict in applying the 2/3 patch, because its
> first hunk touches a region of code also affected by work Rafael has
> been doing. The important aspect of that hunk is that it moves the
> should_wakeup flag definition outside the region protected by "#ifdef
> CONFIG_PM_SLEEP".
I've just resent the three patches, rebased on top of the current tree.
Please double check if everytning is right.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree
2008-03-19 21:55 ` Rafael J. Wysocki
@ 2008-03-19 22:04 ` Alan Stern
0 siblings, 0 replies; 15+ messages in thread
From: Alan Stern @ 2008-03-19 22:04 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Greg KH, Andrew Morton, Linux-pm mailing list,
Kernel development list, lenb
On Wed, 19 Mar 2008, Rafael J. Wysocki wrote:
> I've just resent the three patches, rebased on top of the current tree.
Yep, our messages crossed each other.
> Please double check if everytning is right.
It is.
Alan Stern
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [linux-pm] [PATCH 2/3] PM: Make wakeup flags available whenever CONFIG_PM is set (ver 2)
2008-03-19 21:37 ` [PATCH 2/3] PM: Make wakeup flags available whenever CONFIG_PM is set (ver 2) Rafael J. Wysocki
@ 2008-03-19 22:22 ` David Brownell
2008-03-20 23:23 ` patch pm-make-wakeup-flags-available-whenever-config_pm-is-set.patch added to gregkh-2.6 tree gregkh
1 sibling, 0 replies; 15+ messages in thread
From: David Brownell @ 2008-03-19 22:22 UTC (permalink / raw)
To: linux-pm
Cc: Rafael J. Wysocki, Greg KH, Andrew Morton, Kernel development list
On Wednesday 19 March 2008, Rafael J. Wysocki wrote:
> From: Alan Stern <stern@rowland.harvard.edu>
>
> The various wakeup flags and their accessor macros in struct
> dev_pm_info should be available whenever CONFIG_PM is enabled, not
> just when CONFIG_PM_SLEEP is on. Otherwise remote wakeup won't always
> be configurable for runtime power management. This patch (as1056b)
> fixes the oversight.
More accurately, fixes the "regression" ... as noted sometime
last summer, after 296699de6bdc717189a331ab6bbe90e05c94db06
introduced CONFIG_SUSPEND. But that didn't make the regression
list for that kernel, ergo the delay in fixing it.
- Dave
> [rjw: rebased]
>
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---
> drivers/base/power/main.c | 2 --
> drivers/base/power/sysfs.c | 2 ++
> include/linux/pm.h | 36 +++++++++++++++++++++---------------
> 3 files changed, 23 insertions(+), 17 deletions(-)
>
> Index: linux-2.6/include/linux/pm.h
> ===================================================================
> --- linux-2.6.orig/include/linux/pm.h
> +++ linux-2.6/include/linux/pm.h
> @@ -183,9 +183,9 @@ typedef struct pm_message {
> struct dev_pm_info {
> pm_message_t power_state;
> unsigned can_wakeup:1;
> + unsigned should_wakeup:1;
> bool sleeping:1; /* Owned by the PM core */
> #ifdef CONFIG_PM_SLEEP
> - unsigned should_wakeup:1;
> struct list_head entry;
> #endif
> };
> @@ -198,11 +198,6 @@ extern void device_resume(void);
> extern int device_suspend(pm_message_t state);
> extern int device_prepare_suspend(pm_message_t state);
>
> -#define device_set_wakeup_enable(dev,val) \
> - ((dev)->power.should_wakeup = !!(val))
> -#define device_may_wakeup(dev) \
> - (device_can_wakeup(dev) && (dev)->power.should_wakeup)
> -
> extern void __suspend_report_result(const char *function, void *fn, int ret);
>
> #define suspend_report_result(fn, ret) \
> @@ -210,6 +205,24 @@ extern void __suspend_report_result(cons
> __suspend_report_result(__FUNCTION__, fn, ret); \
> } while (0)
>
> +#else /* !CONFIG_PM_SLEEP */
> +
> +static inline int device_suspend(pm_message_t state)
> +{
> + return 0;
> +}
> +
> +#define suspend_report_result(fn, ret) do { } while (0)
> +
> +#endif /* !CONFIG_PM_SLEEP */
> +
> +#ifdef CONFIG_PM
> +
> +#define device_set_wakeup_enable(dev,val) \
> + ((dev)->power.should_wakeup = !!(val))
> +#define device_may_wakeup(dev) \
> + (device_can_wakeup(dev) && (dev)->power.should_wakeup)
> +
> /*
> * Platform hook to activate device wakeup capability, if that's not already
> * handled by enable_irq_wake() etc.
> @@ -224,24 +237,17 @@ static inline int call_platform_enable_w
> return 0;
> }
>
> -#else /* !CONFIG_PM_SLEEP */
> -
> -static inline int device_suspend(pm_message_t state)
> -{
> - return 0;
> -}
> +#else /* !CONFIG_PM */
>
> #define device_set_wakeup_enable(dev,val) do{}while(0)
> #define device_may_wakeup(dev) (0)
>
> -#define suspend_report_result(fn, ret) do { } while (0)
> -
> static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
> {
> return 0;
> }
>
> -#endif /* !CONFIG_PM_SLEEP */
> +#endif /* !CONFIG_PM */
>
> /* changes to device_may_wakeup take effect on the next pm state change.
> * by default, devices should wakeup if they can.
> Index: linux-2.6/drivers/base/power/main.c
> ===================================================================
> --- linux-2.6.orig/drivers/base/power/main.c
> +++ linux-2.6/drivers/base/power/main.c
> @@ -57,8 +57,6 @@ static DEFINE_MUTEX(dpm_list_mtx);
> /* 'true' if all devices have been suspended, protected by dpm_list_mtx */
> static bool all_sleeping;
>
> -int (*platform_enable_wakeup)(struct device *dev, int is_on);
> -
> /**
> * device_pm_add - add a device to the list of active devices
> * @dev: Device to be added to the list
> Index: linux-2.6/drivers/base/power/sysfs.c
> ===================================================================
> --- linux-2.6.orig/drivers/base/power/sysfs.c
> +++ linux-2.6/drivers/base/power/sysfs.c
> @@ -6,6 +6,8 @@
> #include <linux/string.h>
> #include "power.h"
>
> +int (*platform_enable_wakeup)(struct device *dev, int is_on);
> +
>
> /*
> * wakeup - Report/change current wakeup option for device
>
> _______________________________________________
> linux-pm mailing list
> linux-pm@lists.linux-foundation.org
> https://lists.linux-foundation.org/mailman/listinfo/linux-pm
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* patch pm-convert-wakeup-flag-accessors-to-inline-functions.patch added to gregkh-2.6 tree
2008-03-19 21:39 ` [PATCH 3/3] PM: Convert wakeup flag accessors to inline functions Rafael J. Wysocki
@ 2008-03-20 23:23 ` gregkh
0 siblings, 0 replies; 15+ messages in thread
From: gregkh @ 2008-03-20 23:23 UTC (permalink / raw)
To: stern, akpm, greg, gregkh, linux-kernel, linux-pm, rjw
This is a note to let you know that I've just added the patch titled
Subject: PM: Convert wakeup flag accessors to inline functions
to my gregkh-2.6 tree. Its filename is
pm-convert-wakeup-flag-accessors-to-inline-functions.patch
This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/
>From rjw@sisk.pl Thu Mar 20 16:21:39 2008
From: Alan Stern <stern@rowland.harvard.edu>
Date: Wed, 19 Mar 2008 22:39:13 +0100
Subject: PM: Convert wakeup flag accessors to inline functions
To: Greg KH <greg@kroah.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, Alan Stern <stern@rowland.harvard.edu>, Linux-pm mailing list <linux-pm@lists.linux-foundation.org>, Kernel development list <linux-kernel@vger.kernel.org>, lenb@kernel.org
Message-ID: <200803192239.14091.rjw@sisk.pl>
Content-Disposition: inline
From: Alan Stern <stern@rowland.harvard.edu>
This patch (as1058) improves the wakeup macros in include/linux/pm.h.
All but the trivial ones are converted to inline routines, which
requires moving them to a separate header file since they depend on
the definition of struct device.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
include/linux/device.h | 3 +
include/linux/pm.h | 46 -----------------------
include/linux/pm_wakeup.h | 90 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 94 insertions(+), 45 deletions(-)
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -475,6 +475,9 @@ struct device {
void (*release)(struct device *dev);
};
+/* Get the wakeup routines, which depend on struct device */
+#include <linux/pm_wakeup.h>
+
#ifdef CONFIG_NUMA
static inline int dev_to_node(struct device *dev)
{
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -212,54 +212,10 @@ static inline int device_suspend(pm_mess
return 0;
}
-#define suspend_report_result(fn, ret) do { } while (0)
+#define suspend_report_result(fn, ret) do {} while (0)
#endif /* !CONFIG_PM_SLEEP */
-#ifdef CONFIG_PM
-
-#define device_set_wakeup_enable(dev,val) \
- ((dev)->power.should_wakeup = !!(val))
-#define device_may_wakeup(dev) \
- (device_can_wakeup(dev) && (dev)->power.should_wakeup)
-
-/*
- * Platform hook to activate device wakeup capability, if that's not already
- * handled by enable_irq_wake() etc.
- * Returns zero on success, else negative errno
- */
-extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
-
-static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
-{
- if (platform_enable_wakeup)
- return (*platform_enable_wakeup)(dev, is_on);
- return 0;
-}
-
-#else /* !CONFIG_PM */
-
-#define device_set_wakeup_enable(dev,val) do{}while(0)
-#define device_may_wakeup(dev) (0)
-
-static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
-{
- return 0;
-}
-
-#endif /* !CONFIG_PM */
-
-/* changes to device_may_wakeup take effect on the next pm state change.
- * by default, devices should wakeup if they can.
- */
-#define device_can_wakeup(dev) \
- ((dev)->power.can_wakeup)
-#define device_init_wakeup(dev,val) \
- do { \
- device_can_wakeup(dev) = !!(val); \
- device_set_wakeup_enable(dev,val); \
- } while(0)
-
/*
* Global Power Management flags
* Used to keep APM and ACPI from both being active
--- /dev/null
+++ b/include/linux/pm_wakeup.h
@@ -0,0 +1,90 @@
+/*
+ * pm_wakeup.h - Power management wakeup interface
+ *
+ * Copyright (C) 2008 Alan Stern
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _LINUX_PM_WAKEUP_H
+#define _LINUX_PM_WAKEUP_H
+
+#ifndef _DEVICE_H_
+# error "please don't include this file directly"
+#endif
+
+#ifdef CONFIG_PM
+
+/* changes to device_may_wakeup take effect on the next pm state change.
+ * by default, devices should wakeup if they can.
+ */
+static inline void device_init_wakeup(struct device *dev, int val)
+{
+ dev->power.can_wakeup = dev->power.should_wakeup = !!val;
+}
+
+static inline int device_can_wakeup(struct device *dev)
+{
+ return dev->power.can_wakeup;
+}
+
+static inline void device_set_wakeup_enable(struct device *dev, int val)
+{
+ dev->power.should_wakeup = !!val;
+}
+
+static inline int device_may_wakeup(struct device *dev)
+{
+ return dev->power.can_wakeup & dev->power.should_wakeup;
+}
+
+/*
+ * Platform hook to activate device wakeup capability, if that's not already
+ * handled by enable_irq_wake() etc.
+ * Returns zero on success, else negative errno
+ */
+extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
+
+static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
+{
+ if (platform_enable_wakeup)
+ return (*platform_enable_wakeup)(dev, is_on);
+ return 0;
+}
+
+#else /* !CONFIG_PM */
+
+/* For some reason the next two routines work even without CONFIG_PM */
+static inline void device_init_wakeup(struct device *dev, int val)
+{
+ dev->power.can_wakeup = !!val;
+}
+
+static inline int device_can_wakeup(struct device *dev)
+{
+ return dev->power.can_wakeup;
+}
+
+#define device_set_wakeup_enable(dev, val) do {} while (0)
+#define device_may_wakeup(dev) 0
+
+static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
+{
+ return 0;
+}
+
+#endif /* !CONFIG_PM */
+
+#endif /* _LINUX_PM_WAKEUP_H */
Patches currently in gregkh-2.6 which might be from stern@rowland.harvard.edu are
usb/usb-convert-usb.h-struct-usb_device-to-kernel-doc.patch
usb/usb-make-usb_storage_onetouch-available-with-pm.patch
usb/usb-usb-ohci-sm501-driver-use-the-conventional-convention-for-suspend-and-resume.patch
usb/usb-reorganize-code-in-hub.c.patch
usb/usb-ehci-carry-out-port-handover-during-each-root-hub-resume.patch
usb/usb-new-quirk-flag-to-avoid-set-interface.patch
usb/drivers-usb-core-devio.c-suppress-warning-with-64k-page_size.patch
usb/usb-make-usb-persist-work-after-every-system-sleep.patch
usb/usb-remove-config_usb_persist-setting.patch
usb/usb-check-serial-number-string-after-device-reset.patch
usb/usb-enable-usb-persist-by-default.patch
usb/usb-remove-dev-power.power_state.patch
usb/usb-isd200-fix-memory-leak-in-isd200_get_inquiry_data.patch
usb/usb-remove-experimental-tags-from-some-usb-gadget-kconfig-entries.patch
driver-core/pm-handle-device-registrations-during-suspend-resume.patch
driver-core/pm-convert-wakeup-flag-accessors-to-inline-functions.patch
driver-core/driver-core-call-device_pm_add-after-bus_add_device-in-device_add.patch
driver-core/pm-fix-misuse-of-wakeup-flag-accessors-in-serial-core.patch
driver-core/pm-make-wakeup-flags-available-whenever-config_pm-is-set.patch
^ permalink raw reply [flat|nested] 15+ messages in thread
* patch pm-fix-misuse-of-wakeup-flag-accessors-in-serial-core.patch added to gregkh-2.6 tree
2008-03-19 21:35 ` [PATCH 1/3] Fix misuse of wakeup flag accessors in serial core Rafael J. Wysocki
@ 2008-03-20 23:23 ` gregkh
0 siblings, 0 replies; 15+ messages in thread
From: gregkh @ 2008-03-20 23:23 UTC (permalink / raw)
To: stern, akpm, greg, gregkh, linux-kernel, linux-pm, rjw
This is a note to let you know that I've just added the patch titled
Subject: PM: Fix misuse of wakeup flag accessors in serial core
to my gregkh-2.6 tree. Its filename is
pm-fix-misuse-of-wakeup-flag-accessors-in-serial-core.patch
This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/
>From rjw@sisk.pl Thu Mar 20 16:20:16 2008
From: Alan Stern <stern@rowland.harvard.edu>
Date: Wed, 19 Mar 2008 22:35:13 +0100
Subject: PM: Fix misuse of wakeup flag accessors in serial core
To: Greg KH <greg@kroah.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, Alan Stern <stern@rowland.harvard.edu>, Linux-pm mailing list <linux-pm@lists.linux-foundation.org>, Kernel development list <linux-kernel@vger.kernel.org>, lenb@kernel.org
Message-ID: <200803192235.14645.rjw@sisk.pl>
Content-Disposition: inline
From: Alan Stern <stern@rowland.harvard.edu>
This patch (as1059) fixes a mistake in the way the serial core
initializes a device's wakeup settings. It should use the accessor
routine instead of relying on a macro producing an lvalue.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/serial/serial_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -2356,7 +2356,7 @@ int uart_add_one_port(struct uart_driver
*/
tty_dev = tty_register_device(drv->tty_driver, port->line, port->dev);
if (likely(!IS_ERR(tty_dev))) {
- device_can_wakeup(tty_dev) = 1;
+ device_init_wakeup(tty_dev, 1);
device_set_wakeup_enable(tty_dev, 0);
} else
printk(KERN_ERR "Cannot register tty device on line %d\n",
Patches currently in gregkh-2.6 which might be from stern@rowland.harvard.edu are
usb/usb-convert-usb.h-struct-usb_device-to-kernel-doc.patch
usb/usb-make-usb_storage_onetouch-available-with-pm.patch
usb/usb-usb-ohci-sm501-driver-use-the-conventional-convention-for-suspend-and-resume.patch
usb/usb-reorganize-code-in-hub.c.patch
usb/usb-ehci-carry-out-port-handover-during-each-root-hub-resume.patch
usb/usb-new-quirk-flag-to-avoid-set-interface.patch
usb/drivers-usb-core-devio.c-suppress-warning-with-64k-page_size.patch
usb/usb-make-usb-persist-work-after-every-system-sleep.patch
usb/usb-remove-config_usb_persist-setting.patch
usb/usb-check-serial-number-string-after-device-reset.patch
usb/usb-enable-usb-persist-by-default.patch
usb/usb-remove-dev-power.power_state.patch
usb/usb-isd200-fix-memory-leak-in-isd200_get_inquiry_data.patch
usb/usb-remove-experimental-tags-from-some-usb-gadget-kconfig-entries.patch
driver-core/pm-handle-device-registrations-during-suspend-resume.patch
driver-core/pm-convert-wakeup-flag-accessors-to-inline-functions.patch
driver-core/driver-core-call-device_pm_add-after-bus_add_device-in-device_add.patch
driver-core/pm-fix-misuse-of-wakeup-flag-accessors-in-serial-core.patch
driver-core/pm-make-wakeup-flags-available-whenever-config_pm-is-set.patch
^ permalink raw reply [flat|nested] 15+ messages in thread
* patch pm-make-wakeup-flags-available-whenever-config_pm-is-set.patch added to gregkh-2.6 tree
2008-03-19 21:37 ` [PATCH 2/3] PM: Make wakeup flags available whenever CONFIG_PM is set (ver 2) Rafael J. Wysocki
2008-03-19 22:22 ` [linux-pm] " David Brownell
@ 2008-03-20 23:23 ` gregkh
1 sibling, 0 replies; 15+ messages in thread
From: gregkh @ 2008-03-20 23:23 UTC (permalink / raw)
To: stern, akpm, greg, gregkh, linux-kernel, linux-pm, rjw
This is a note to let you know that I've just added the patch titled
Subject: PM: Make wakeup flags available whenever CONFIG_PM is set
to my gregkh-2.6 tree. Its filename is
pm-make-wakeup-flags-available-whenever-config_pm-is-set.patch
This tree can be found at
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/
>From rjw@sisk.pl Thu Mar 20 16:20:59 2008
From: Alan Stern <stern@rowland.harvard.edu>
Date: Wed, 19 Mar 2008 22:37:42 +0100
Subject: PM: Make wakeup flags available whenever CONFIG_PM is set
To: Greg KH <greg@kroah.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, Alan Stern <stern@rowland.harvard.edu>, Linux-pm mailing list <linux-pm@lists.linux-foundation.org>, Kernel development list <linux-kernel@vger.kernel.org>, lenb@kernel.org
Message-ID: <200803192237.43123.rjw@sisk.pl>
Content-Disposition: inline
From: Alan Stern <stern@rowland.harvard.edu>
The various wakeup flags and their accessor macros in struct
dev_pm_info should be available whenever CONFIG_PM is enabled, not
just when CONFIG_PM_SLEEP is on. Otherwise remote wakeup won't always
be configurable for runtime power management. This patch (as1056b)
fixes the oversight.
David Brownell adds:
More accurately, fixes the "regression" ... as noted sometime
last summer, after 296699de6bdc717189a331ab6bbe90e05c94db06
introduced CONFIG_SUSPEND. But that didn't make the regression
list for that kernel, ergo the delay in fixing it.
[rjw: rebased]
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/base/power/main.c | 2 --
drivers/base/power/sysfs.c | 2 ++
include/linux/pm.h | 36 +++++++++++++++++++++---------------
3 files changed, 23 insertions(+), 17 deletions(-)
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -57,8 +57,6 @@ static DEFINE_MUTEX(dpm_list_mtx);
/* 'true' if all devices have been suspended, protected by dpm_list_mtx */
static bool all_sleeping;
-int (*platform_enable_wakeup)(struct device *dev, int is_on);
-
/**
* device_pm_add - add a device to the list of active devices
* @dev: Device to be added to the list
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -6,6 +6,8 @@
#include <linux/string.h>
#include "power.h"
+int (*platform_enable_wakeup)(struct device *dev, int is_on);
+
/*
* wakeup - Report/change current wakeup option for device
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -183,9 +183,9 @@ typedef struct pm_message {
struct dev_pm_info {
pm_message_t power_state;
unsigned can_wakeup:1;
+ unsigned should_wakeup:1;
bool sleeping:1; /* Owned by the PM core */
#ifdef CONFIG_PM_SLEEP
- unsigned should_wakeup:1;
struct list_head entry;
#endif
};
@@ -198,11 +198,6 @@ extern void device_resume(void);
extern int device_suspend(pm_message_t state);
extern int device_prepare_suspend(pm_message_t state);
-#define device_set_wakeup_enable(dev,val) \
- ((dev)->power.should_wakeup = !!(val))
-#define device_may_wakeup(dev) \
- (device_can_wakeup(dev) && (dev)->power.should_wakeup)
-
extern void __suspend_report_result(const char *function, void *fn, int ret);
#define suspend_report_result(fn, ret) \
@@ -210,6 +205,24 @@ extern void __suspend_report_result(cons
__suspend_report_result(__FUNCTION__, fn, ret); \
} while (0)
+#else /* !CONFIG_PM_SLEEP */
+
+static inline int device_suspend(pm_message_t state)
+{
+ return 0;
+}
+
+#define suspend_report_result(fn, ret) do { } while (0)
+
+#endif /* !CONFIG_PM_SLEEP */
+
+#ifdef CONFIG_PM
+
+#define device_set_wakeup_enable(dev,val) \
+ ((dev)->power.should_wakeup = !!(val))
+#define device_may_wakeup(dev) \
+ (device_can_wakeup(dev) && (dev)->power.should_wakeup)
+
/*
* Platform hook to activate device wakeup capability, if that's not already
* handled by enable_irq_wake() etc.
@@ -224,24 +237,17 @@ static inline int call_platform_enable_w
return 0;
}
-#else /* !CONFIG_PM_SLEEP */
-
-static inline int device_suspend(pm_message_t state)
-{
- return 0;
-}
+#else /* !CONFIG_PM */
#define device_set_wakeup_enable(dev,val) do{}while(0)
#define device_may_wakeup(dev) (0)
-#define suspend_report_result(fn, ret) do { } while (0)
-
static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
{
return 0;
}
-#endif /* !CONFIG_PM_SLEEP */
+#endif /* !CONFIG_PM */
/* changes to device_may_wakeup take effect on the next pm state change.
* by default, devices should wakeup if they can.
Patches currently in gregkh-2.6 which might be from stern@rowland.harvard.edu are
usb/usb-convert-usb.h-struct-usb_device-to-kernel-doc.patch
usb/usb-make-usb_storage_onetouch-available-with-pm.patch
usb/usb-usb-ohci-sm501-driver-use-the-conventional-convention-for-suspend-and-resume.patch
usb/usb-reorganize-code-in-hub.c.patch
usb/usb-ehci-carry-out-port-handover-during-each-root-hub-resume.patch
usb/usb-new-quirk-flag-to-avoid-set-interface.patch
usb/drivers-usb-core-devio.c-suppress-warning-with-64k-page_size.patch
usb/usb-make-usb-persist-work-after-every-system-sleep.patch
usb/usb-remove-config_usb_persist-setting.patch
usb/usb-check-serial-number-string-after-device-reset.patch
usb/usb-enable-usb-persist-by-default.patch
usb/usb-remove-dev-power.power_state.patch
usb/usb-isd200-fix-memory-leak-in-isd200_get_inquiry_data.patch
usb/usb-remove-experimental-tags-from-some-usb-gadget-kconfig-entries.patch
driver-core/pm-handle-device-registrations-during-suspend-resume.patch
driver-core/pm-convert-wakeup-flag-accessors-to-inline-functions.patch
driver-core/driver-core-call-device_pm_add-after-bus_add_device-in-device_add.patch
driver-core/pm-fix-misuse-of-wakeup-flag-accessors-in-serial-core.patch
driver-core/pm-make-wakeup-flags-available-whenever-config_pm-is-set.patch
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 3/3] PM: convert wakeup flag accessors to inline functions
2008-03-14 22:37 linux-next20080314 build fails with !CONFIG_PM Rafael J. Wysocki
@ 2008-03-15 21:54 ` Alan Stern
0 siblings, 0 replies; 15+ messages in thread
From: Alan Stern @ 2008-03-15 21:54 UTC (permalink / raw)
To: Greg KH, Andrew Morton, Rafael J. Wysocki
Cc: Kamalesh Babulal, linux-next, sfr, Kernel development list, apw,
Len Brown, Linux-pm mailing list
This patch (as1058) improves the wakeup macros in include/linux/pm.h.
All but the trivial ones are converted to inline routines, which
requires moving them to a separate header file since they depend on
the definition of struct device.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
---
Index: usb-2.6/include/linux/pm.h
===================================================================
--- usb-2.6.orig/include/linux/pm.h
+++ usb-2.6/include/linux/pm.h
@@ -211,54 +211,10 @@ static inline int device_suspend(pm_mess
return 0;
}
-#define suspend_report_result(fn, ret) do { } while (0)
+#define suspend_report_result(fn, ret) do {} while (0)
#endif /* !CONFIG_PM_SLEEP */
-#ifdef CONFIG_PM
-
-#define device_set_wakeup_enable(dev,val) \
- ((dev)->power.should_wakeup = !!(val))
-#define device_may_wakeup(dev) \
- (device_can_wakeup(dev) && (dev)->power.should_wakeup)
-
-/*
- * Platform hook to activate device wakeup capability, if that's not already
- * handled by enable_irq_wake() etc.
- * Returns zero on success, else negative errno
- */
-extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
-
-static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
-{
- if (platform_enable_wakeup)
- return (*platform_enable_wakeup)(dev, is_on);
- return 0;
-}
-
-#else /* !CONFIG_PM */
-
-#define device_set_wakeup_enable(dev,val) do{}while(0)
-#define device_may_wakeup(dev) (0)
-
-static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
-{
- return 0;
-}
-
-#endif /* !CONFIG_PM */
-
-/* changes to device_may_wakeup take effect on the next pm state change.
- * by default, devices should wakeup if they can.
- */
-#define device_can_wakeup(dev) \
- ((dev)->power.can_wakeup)
-#define device_init_wakeup(dev,val) \
- do { \
- device_can_wakeup(dev) = !!(val); \
- device_set_wakeup_enable(dev,val); \
- } while(0)
-
/*
* Global Power Management flags
* Used to keep APM and ACPI from both being active
Index: usb-2.6/include/linux/device.h
===================================================================
--- usb-2.6.orig/include/linux/device.h
+++ usb-2.6/include/linux/device.h
@@ -475,6 +475,9 @@ struct device {
void (*release)(struct device *dev);
};
+/* Get the wakeup routines, which depend on struct device */
+#include <linux/pm_wakeup.h>
+
#ifdef CONFIG_NUMA
static inline int dev_to_node(struct device *dev)
{
Index: usb-2.6/include/linux/pm_wakeup.h
===================================================================
--- /dev/null
+++ usb-2.6/include/linux/pm_wakeup.h
@@ -0,0 +1,90 @@
+/*
+ * pm_wakeup.h - Power management wakeup interface
+ *
+ * Copyright (C) 2008 Alan Stern
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _LINUX_PM_WAKEUP_H
+#define _LINUX_PM_WAKEUP_H
+
+#ifndef _DEVICE_H_
+# error "please don't include this file directly"
+#endif
+
+#ifdef CONFIG_PM
+
+/* changes to device_may_wakeup take effect on the next pm state change.
+ * by default, devices should wakeup if they can.
+ */
+static inline void device_init_wakeup(struct device *dev, int val)
+{
+ dev->power.can_wakeup = dev->power.should_wakeup = !!val;
+}
+
+static inline int device_can_wakeup(struct device *dev)
+{
+ return dev->power.can_wakeup;
+}
+
+static inline void device_set_wakeup_enable(struct device *dev, int val)
+{
+ dev->power.should_wakeup = !!val;
+}
+
+static inline int device_may_wakeup(struct device *dev)
+{
+ return dev->power.can_wakeup & dev->power.should_wakeup;
+}
+
+/*
+ * Platform hook to activate device wakeup capability, if that's not already
+ * handled by enable_irq_wake() etc.
+ * Returns zero on success, else negative errno
+ */
+extern int (*platform_enable_wakeup)(struct device *dev, int is_on);
+
+static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
+{
+ if (platform_enable_wakeup)
+ return (*platform_enable_wakeup)(dev, is_on);
+ return 0;
+}
+
+#else /* !CONFIG_PM */
+
+/* For some reason the next two routines work even without CONFIG_PM */
+static inline void device_init_wakeup(struct device *dev, int val)
+{
+ dev->power.can_wakeup = !!val;
+}
+
+static inline int device_can_wakeup(struct device *dev)
+{
+ return dev->power.can_wakeup;
+}
+
+#define device_set_wakeup_enable(dev, val) do {} while (0)
+#define device_may_wakeup(dev) 0
+
+static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
+{
+ return 0;
+}
+
+#endif /* !CONFIG_PM */
+
+#endif /* _LINUX_PM_WAKEUP_H */
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2008-03-20 23:24 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <200803190315.m2J3FXnK029022@imap1.linux-foundation.org>
2008-03-19 14:55 ` + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree Alan Stern
2008-03-19 18:48 ` Andrew Morton
2008-03-19 18:57 ` Greg KH
2008-03-19 21:33 ` [PATCH 0/3] PM wakeup flags revisited (was: Re: + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree) Rafael J. Wysocki
2008-03-19 21:35 ` [PATCH 1/3] Fix misuse of wakeup flag accessors in serial core Rafael J. Wysocki
2008-03-20 23:23 ` patch pm-fix-misuse-of-wakeup-flag-accessors-in-serial-core.patch added to gregkh-2.6 tree gregkh
2008-03-19 21:37 ` [PATCH 2/3] PM: Make wakeup flags available whenever CONFIG_PM is set (ver 2) Rafael J. Wysocki
2008-03-19 22:22 ` [linux-pm] " David Brownell
2008-03-20 23:23 ` patch pm-make-wakeup-flags-available-whenever-config_pm-is-set.patch added to gregkh-2.6 tree gregkh
2008-03-19 21:39 ` [PATCH 3/3] PM: Convert wakeup flag accessors to inline functions Rafael J. Wysocki
2008-03-20 23:23 ` patch pm-convert-wakeup-flag-accessors-to-inline-functions.patch added to gregkh-2.6 tree gregkh
2008-03-19 21:46 ` + pm-convert-wakeup-flag-accessors-to-inline-functions-fix.patch added to -mm tree Alan Stern
2008-03-19 21:55 ` Rafael J. Wysocki
2008-03-19 22:04 ` Alan Stern
2008-03-14 22:37 linux-next20080314 build fails with !CONFIG_PM Rafael J. Wysocki
2008-03-15 21:54 ` [PATCH 3/3] PM: convert wakeup flag accessors to inline functions Alan Stern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).