* pm_register should die
@ 2005-09-12 9:34 Pavel Machek
2005-09-12 9:41 ` Andrew Morton
2005-09-13 0:03 ` David McCullough
0 siblings, 2 replies; 8+ messages in thread
From: Pavel Machek @ 2005-09-12 9:34 UTC (permalink / raw)
To: kernel list, Andrew Morton, Linus Torvalds
Cc: vojtech, dwmw2, netdev, benjamin_kong, dagb, jgarzik, davidm,
twoller, alan, mm, scott, jsimmons
Hi!
pm_register has been obsoleted by driver model, and it was deprecated
quite long time ago. There are only 13 users left.
Attached is a patch that makes pm_register config-option, so that we
don't get the warnings on sane systems. Pretty please, remove usage of
pm_register from your subsystem.
IRDA has no usefull MAINTAINER entry; it would be nice if that could
be fixed. Alan is best contact I could find for ad1848... does someone
care about that driver, anyway? nm256_audio is written by
anonymous. Wonderfull...
Okay, it seems to me only users that matter are mtdcore, 3c509 and
maybe h3600_ts_input. After those are fixed, it should be okay to just
config it out/remove pm_register completely.
Pavel
./drivers/input/touchscreen/h3600_ts_input.c: ts->pm_dev = pm_register(PM_ILLUMINATION_DEV, PM_SYS_LIGHT,
./drivers/mtd/mtdcore.c: mtd_pm_dev = pm_register(PM_UNKNOWN_DEV, 0, mtd_pm_callback);
./drivers/net/irda/ali-ircc.c: pmdev = pm_register(PM_SYS_DEV, PM_SYS_IRDA, ali_ircc_pmproc);
./drivers/net/irda/nsc-ircc.c: pmdev = pm_register(PM_SYS_DEV, PM_SYS_IRDA, nsc_ircc_pmproc);
./drivers/net/3c509.c: lp->pmdev = pm_register(PM_ISA_DEV, card_idx, el3_pm_callback);
./drivers/serial/68328serial.c: serial_pm[i] = pm_register(PM_SYS_DEV, PM_SYS_COM, serial_pm_callback);
./sound/oss/cs4281/cs4281m.c: pmdev = cs_pm_register(PM_PCI_DEV, PM_PCI_ID(pcidev), cs4281_pm_callback);
./sound/oss/cs4281/cs4281pm-24.c:#define cs_pm_register(a, b, c) pm_register((a), (b), (c));
./sound/oss/ad1848.c: devc->pmdev = pm_register(PM_ISA_DEV, my_dev, ad1848_pm_callback);
./sound/oss/cs46xx.c: pmdev = cs_pm_register(PM_PCI_DEV, PM_PCI_ID(pci_dev), cs46xx_pm_callback);
./sound/oss/maestro.c: pmdev = pm_register(PM_PCI_DEV, PM_PCI_ID(pcidev),
./sound/oss/nm256_audio.c: pmdev = pm_register(PM_PCI_DEV, PM_PCI_ID(pcidev), handle_pm_event);
./sound/oss/opl3sa2.c: opl3sa2_state[card].pmdev = pm_register(PM_ISA_DEV, card, opl3sa2_pm_callback);
Make pm_register stuff dependend on CONFIG_OLD_PM, so it can be removed.
---
commit fff4171d1a447da54f757e2ff0bd9739d995680c
tree 75b53f93650101814da506bfc435e8f415233672
parent 6c7cd9958aa0edfb01e04bac7fc670e485a1600f
author <pavel@amd.(none)> Sun, 11 Sep 2005 23:04:34 +0200
committer <pavel@amd.(none)> Sun, 11 Sep 2005 23:04:34 +0200
arch/i386/kernel/apm.c | 6 ++++++
include/linux/pm.h | 14 ++++++++++----
kernel/power/pm.c | 3 ++-
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -1180,6 +1180,7 @@ static int suspend(int vetoable)
int err;
struct apm_user *as;
+#ifdef CONFIG_OLD_PM
if (pm_send_all(PM_SUSPEND, (void *)3)) {
/* Vetoed */
if (vetoable) {
@@ -1192,6 +1193,7 @@ static int suspend(int vetoable)
}
printk(KERN_CRIT "apm: suspend was vetoed, but suspending anyway.\n");
}
+#endif
device_suspend(PMSG_SUSPEND);
local_irq_disable();
@@ -1234,7 +1236,9 @@ static int suspend(int vetoable)
device_power_up();
local_irq_enable();
device_resume();
+#ifdef CONFIG_OLD_PM
pm_send_all(PM_RESUME, (void *)0);
+#endif
queue_event(APM_NORMAL_RESUME, NULL);
out:
spin_lock(&user_list_lock);
@@ -1355,7 +1359,9 @@ static void check_events(void)
set_time();
write_sequnlock_irq(&xtime_lock);
device_resume();
+#ifdef CONFIG_OLD_PM
pm_send_all(PM_RESUME, (void *)0);
+#endif
queue_event(event, NULL);
}
ignore_normal_resume = 0;
diff --git a/include/linux/pm.h b/include/linux/pm.h
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -27,6 +27,15 @@
#include <linux/list.h>
#include <asm/atomic.h>
+#ifdef CONFIG_PM
+extern int pm_active;
+
+#define PM_IS_ACTIVE() (pm_active != 0)
+#else
+#define PM_IS_ACTIVE() (0)
+#endif
+
+#ifdef CONFIG_OLD_PM
/*
* Power management requests... these are passed to pm_send_all() and friends.
*
@@ -96,10 +105,6 @@ struct pm_dev
#ifdef CONFIG_PM
-extern int pm_active;
-
-#define PM_IS_ACTIVE() (pm_active != 0)
-
/*
* Register a device with power management
*/
@@ -145,6 +150,7 @@ static inline int pm_send_all(pm_request
/* Functions above this comment are list-based old-style power
* managment. Please avoid using them. */
+#endif
/*
* Callbacks for platform drivers to implement.
diff --git a/kernel/power/pm.c b/kernel/power/pm.c
--- a/kernel/power/pm.c
+++ b/kernel/power/pm.c
@@ -27,6 +27,7 @@
int pm_active;
+#ifdef CONFIG_OLD_PM
/*
* Locking notes:
* pm_devs_lock can be a semaphore providing pm ops are not called
@@ -261,4 +262,4 @@ EXPORT_SYMBOL(pm_unregister_all);
EXPORT_SYMBOL(pm_send_all);
EXPORT_SYMBOL(pm_active);
-
+#endif
--
if you have sharp zaurus hardware you don't need... you know my address
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: pm_register should die
2005-09-12 9:34 pm_register should die Pavel Machek
@ 2005-09-12 9:41 ` Andrew Morton
2005-09-12 9:53 ` Pavel Machek
2005-09-13 0:03 ` David McCullough
1 sibling, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2005-09-12 9:41 UTC (permalink / raw)
To: Pavel Machek
Cc: linux-kernel, akpm, torvalds, vojtech, dwmw2, netdev,
benjamin_kong, dagb, jgarzik, davidm, twoller, alan, mm, scott,
jsimmons
Pavel Machek <pavel@ucw.cz> wrote:
>
> +#ifdef CONFIG_OLD_PM
> if (pm_send_all(PM_SUSPEND, (void *)3)) {
Can we not do this without ifdefs?
#define pm_send_all(foo, bar) 0
?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: pm_register should die
2005-09-12 9:41 ` Andrew Morton
@ 2005-09-12 9:53 ` Pavel Machek
2005-09-12 9:55 ` Pavel Machek
0 siblings, 1 reply; 8+ messages in thread
From: Pavel Machek @ 2005-09-12 9:53 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, akpm, torvalds, vojtech, dwmw2, netdev,
benjamin_kong, dagb, jgarzik, davidm, twoller, alan, mm, scott,
jsimmons
Hi!
> > +#ifdef CONFIG_OLD_PM
> > if (pm_send_all(PM_SUSPEND, (void *)3)) {
>
> Can we not do this without ifdefs?
>
> #define pm_send_all(foo, bar) 0
Okay, we probably can, but the ifdefs make very nice/easy markers
"this is going away". I'd prefer to actually delete all the code
inside those ifdefs...
I agree this patch can be improved... I hope I can get people to fix
those 13 occurences and be able to just drop everything in #ifdef
_OLD_PM.
Pavel
--
if you have sharp zaurus hardware you don't need... you know my address
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: pm_register should die
2005-09-12 9:53 ` Pavel Machek
@ 2005-09-12 9:55 ` Pavel Machek
2005-09-12 10:03 ` Andrew Morton
0 siblings, 1 reply; 8+ messages in thread
From: Pavel Machek @ 2005-09-12 9:55 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, akpm, torvalds, vojtech, dwmw2, netdev,
benjamin_kong, dagb, jgarzik, davidm, twoller, alan, mm, scott,
jsimmons
Hi!
> > > +#ifdef CONFIG_OLD_PM
> > > if (pm_send_all(PM_SUSPEND, (void *)3)) {
> >
> > Can we not do this without ifdefs?
> >
> > #define pm_send_all(foo, bar) 0
>
> Okay, we probably can, but the ifdefs make very nice/easy markers
> "this is going away". I'd prefer to actually delete all the code
> inside those ifdefs...
>
> I agree this patch can be improved... I hope I can get people to fix
> those 13 occurences and be able to just drop everything in #ifdef
> _OLD_PM.
There's another reason: they are ifdef-ed out so that you don't see
"obsolete function called" warning. Breaking the function and hiding
the warning at same time would seem like a wrong thing to do. If
someone does pm_send_all in his code, we want him to see the warning.
Pavel
--
if you have sharp zaurus hardware you don't need... you know my address
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: pm_register should die
2005-09-12 9:55 ` Pavel Machek
@ 2005-09-12 10:03 ` Andrew Morton
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Morton @ 2005-09-12 10:03 UTC (permalink / raw)
To: Pavel Machek
Cc: linux-kernel, torvalds, vojtech, dwmw2, netdev, benjamin_kong,
dagb, jgarzik, davidm, twoller, alan, mm, scott, jsimmons
Pavel Machek <pavel@suse.cz> wrote:
>
> Hi!
>
> > > > +#ifdef CONFIG_OLD_PM
> > > > if (pm_send_all(PM_SUSPEND, (void *)3)) {
> > >
> > > Can we not do this without ifdefs?
> > >
> > > #define pm_send_all(foo, bar) 0
> >
> > Okay, we probably can, but the ifdefs make very nice/easy markers
> > "this is going away". I'd prefer to actually delete all the code
> > inside those ifdefs...
> >
> > I agree this patch can be improved... I hope I can get people to fix
> > those 13 occurences and be able to just drop everything in #ifdef
> > _OLD_PM.
>
> There's another reason: they are ifdef-ed out so that you don't see
> "obsolete function called" warning. Breaking the function and hiding
> the warning at same time would seem like a wrong thing to do. If
> someone does pm_send_all in his code, we want him to see the warning.
>
Fair enough.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: pm_register should die
2005-09-12 9:34 pm_register should die Pavel Machek
2005-09-12 9:41 ` Andrew Morton
@ 2005-09-13 0:03 ` David McCullough
2005-09-13 1:32 ` Alan Cox
2005-09-13 12:12 ` Pavel Machek
1 sibling, 2 replies; 8+ messages in thread
From: David McCullough @ 2005-09-13 0:03 UTC (permalink / raw)
To: Pavel Machek
Cc: kernel list, Andrew Morton, Linus Torvalds, vojtech, dwmw2,
netdev, benjamin_kong, dagb, jgarzik, twoller, alan, mm, scott,
jsimmons
Jivin Pavel Machek lays it down ...
> Hi!
>
> pm_register has been obsoleted by driver model, and it was deprecated
> quite long time ago. There are only 13 users left.
>
> Attached is a patch that makes pm_register config-option, so that we
> don't get the warnings on sane systems. Pretty please, remove usage of
> pm_register from your subsystem.
>
> IRDA has no usefull MAINTAINER entry; it would be nice if that could
> be fixed. Alan is best contact I could find for ad1848... does someone
> care about that driver, anyway? nm256_audio is written by
> anonymous. Wonderfull...
>
> Okay, it seems to me only users that matter are mtdcore, 3c509 and
> maybe h3600_ts_input. After those are fixed, it should be okay to just
> config it out/remove pm_register completely.
Feel free to clean out pm_register usage in:
drivers/serial/68328serial.c
there's not much in there that cannot be added later if actually required,
Cheers,
Davidm
--
David McCullough, davidm@cyberguard.com.au, Custom Embedded Solutions + Security
Ph:+61 734352815 Fx:+61 738913630 http://www.uCdot.org http://www.cyberguard.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: pm_register should die
2005-09-13 0:03 ` David McCullough
@ 2005-09-13 1:32 ` Alan Cox
2005-09-13 12:12 ` Pavel Machek
1 sibling, 0 replies; 8+ messages in thread
From: Alan Cox @ 2005-09-13 1:32 UTC (permalink / raw)
To: David McCullough
Cc: Pavel Machek, kernel list, Andrew Morton, Linus Torvalds, vojtech,
dwmw2, netdev, benjamin_kong, dagb, jgarzik, twoller, alan, mm,
scott, jsimmons
> > be fixed. Alan is best contact I could find for ad1848... does someone
> > care about that driver, anyway? nm256_audio is written by
> > anonymous. Wonderfull...
AD1848 docs are public, NM256 was reverse engineered so no docs. Most
users are now using the ALSA layer. It might be simplest to kill
pm_register after OSS goes, which is now scheduled anyway.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: pm_register should die
2005-09-13 0:03 ` David McCullough
2005-09-13 1:32 ` Alan Cox
@ 2005-09-13 12:12 ` Pavel Machek
1 sibling, 0 replies; 8+ messages in thread
From: Pavel Machek @ 2005-09-13 12:12 UTC (permalink / raw)
To: David McCullough
Cc: kernel list, Andrew Morton, Linus Torvalds, vojtech, dwmw2,
netdev, benjamin_kong, dagb, jgarzik, twoller, alan, mm, scott,
jsimmons
Hi!
> > pm_register has been obsoleted by driver model, and it was deprecated
> > quite long time ago. There are only 13 users left.
> >
> > Attached is a patch that makes pm_register config-option, so that we
> > don't get the warnings on sane systems. Pretty please, remove usage of
> > pm_register from your subsystem.
> >
> > IRDA has no usefull MAINTAINER entry; it would be nice if that could
> > be fixed. Alan is best contact I could find for ad1848... does someone
> > care about that driver, anyway? nm256_audio is written by
> > anonymous. Wonderfull...
> >
> > Okay, it seems to me only users that matter are mtdcore, 3c509 and
> > maybe h3600_ts_input. After those are fixed, it should be okay to just
> > config it out/remove pm_register completely.
>
> Feel free to clean out pm_register usage in:
>
> drivers/serial/68328serial.c
>
> there's not much in there that cannot be added later if actually required,
I'd rather have someone who actually has that hardware to convert it
to driver model and test properly.
Pavel
--
if you have sharp zaurus hardware you don't need... you know my address
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-09-13 12:12 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-12 9:34 pm_register should die Pavel Machek
2005-09-12 9:41 ` Andrew Morton
2005-09-12 9:53 ` Pavel Machek
2005-09-12 9:55 ` Pavel Machek
2005-09-12 10:03 ` Andrew Morton
2005-09-13 0:03 ` David McCullough
2005-09-13 1:32 ` Alan Cox
2005-09-13 12:12 ` Pavel Machek
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).