Skip to contentSkip to conversation

pm_register should die

PATCH Pavel Machek 5 participants 8 messages Sep 12, 2005 – Sep 13, 2005

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

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(-)
arch/i386/kernel/apm.c +6 -0
@@ -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;
include/linux/pm.h +10 -4
@@ -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.
kernel/power/pm.c +2 -1
@@ -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
Signature · 1 line
if you have sharp zaurus hardware you don't need... you know my address
#1 lore raw
Quoted 3 lines · Pavel Machek

+#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

?

#2 lore raw

Hi!

Quoted 6 lines
Quoted 2 lines

+#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

Signature · 1 line
if you have sharp zaurus hardware you don't need... you know my address
#3 lore raw

Hi!

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

+#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

Quoted 7 lines

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

Signature · 1 line
if you have sharp zaurus hardware you don't need... you know my address
#4 lore raw
Quoted 14 lines · Pavel Machek

Hi!

Quoted 11 lines
Quoted 6 lines
Quoted 2 lines

+#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...

Quoted 9 lines
Quoted 3 lines

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.

#5 lore raw
In reply to Pavel Machek

Jivin Pavel Machek lays it down ...

Quoted 9 lines

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.

Quoted 8 lines

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

Signature · 2 lines
David McCullough, [email protected], Custom Embedded Solutions + Security
Ph:+61 734352815 Fx:+61 738913630 http://www.uCdot.org http://www.cyberguard.com
#6 lore raw
Quoted 3 lines
Quoted 3 lines

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.

#7 lore raw
In reply to David McCullough

Hi!

Quoted 16 lines
Quoted 7 lines

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.

Quoted 8 lines

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.

Quoted 5 lines

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

Signature · 1 line
if you have sharp zaurus hardware you don't need... you know my address