2004-10-21 07:42:53

by Dmitry Torokhov

[permalink] [raw]
Subject: [PATCH 0/7] New input patches

Hi Vojtech,

I have some more input patches for you. Please let me know if you like any
of these and I will push them onto bkbits.

01-whitespace.patch
- get rid of trailing whitespace in sermouse.c and vsxxxaa.c

02-remove-class-device-on-disconnect.patch
- when hardware device associated with evdev, mousedev, joydev or
tsdev is disconnected remove class device right away, do not wait
till the last user of corresponding /dev/input/ device closes it.
It allows hardware drivers be unloaded at any time.

03-link-input_dev-and-serio.patch
- Link input_dev->dev and serio.dev so when corresponding class
devices are created they are linked (device, driver) to their
serio driver and device.

04-i8042-debug.patch
- Alow activate i8042 debugging without recompiling, I am tired of
asking people to edit/recompile.

05-i8042-old-pm-remove.patch
- get rid of old-style PM handling as APM calls device_suspend
so we actually were doing the same work twice.

06-i8042-remove-reboot-notifier.patch
- since i8042 now has shutdown driver core method we do not need
reboot notifier, i8042_shutdown will do the work.

07-input-remove-pm_dev.patch
- pm_dev is deprecated and nobody except for h3600 (which does not
even compile) uses it, remove from input core.

Thanks!

--
Dmitry


2004-10-21 07:42:55

by Dmitry Torokhov

[permalink] [raw]
Subject: [PATCH 1/7] Input: whitespace fixes


===================================================================


[email protected], 2004-10-13 01:03:04-05:00, [email protected]
Input: couple of whitespace fixes.

Signed-off-by: Dmitry Torokhov <[email protected]>


sermouse.c | 24 ++++++++++++------------
vsxxxaa.c | 2 +-
2 files changed, 13 insertions(+), 13 deletions(-)


===================================================================



diff -Nru a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c
--- a/drivers/input/mouse/sermouse.c 2004-10-21 02:08:05 -05:00
+++ b/drivers/input/mouse/sermouse.c 2004-10-21 02:08:05 -05:00
@@ -11,18 +11,18 @@
/*
* 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
+ * 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
- *
+ *
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <[email protected]>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
@@ -73,19 +73,19 @@

case 0:
if ((data & 0xf8) != 0x80) return;
- input_report_key(dev, BTN_LEFT, !(data & 4));
+ input_report_key(dev, BTN_LEFT, !(data & 4));
input_report_key(dev, BTN_RIGHT, !(data & 1));
input_report_key(dev, BTN_MIDDLE, !(data & 2));
break;

- case 1:
- case 3:
+ case 1:
+ case 3:
input_report_rel(dev, REL_X, data / 2);
input_report_rel(dev, REL_Y, -buf[1]);
buf[0] = data - data / 2;
break;

- case 2:
+ case 2:
case 4:
input_report_rel(dev, REL_X, buf[0]);
input_report_rel(dev, REL_Y, buf[1] - data);
@@ -145,7 +145,7 @@
case 3:

switch (sermouse->type) {
-
+
case SERIO_MS:
sermouse->type = SERIO_MP;

@@ -164,7 +164,7 @@
input_report_rel(dev, REL_WHEEL, (data & 8) - (data & 7));
break;
}
-
+
break;

case 4:
@@ -243,7 +243,7 @@
{
struct sermouse *sermouse;
unsigned char c;
-
+
if ((serio->type & SERIO_TYPE) != SERIO_RS232)
return;

@@ -287,7 +287,7 @@
}

input_register_device(&sermouse->dev);
-
+
printk(KERN_INFO "input: %s on %s\n", sermouse_protocols[sermouse->type], serio->phys);
}

diff -Nru a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c
--- a/drivers/input/mouse/vsxxxaa.c 2004-10-21 02:08:05 -05:00
+++ b/drivers/input/mouse/vsxxxaa.c 2004-10-21 02:08:05 -05:00
@@ -45,7 +45,7 @@
* | 4 --- 3 |
* \ 2 1 /
* -------
- *
+ *
* DEC socket DE9 DB25 Note
* 1 (GND) 5 7 -
* 2 (RxD) 2 3 -

2004-10-21 07:47:53

by Dmitry Torokhov

[permalink] [raw]
Subject: [PATCH 5/7] Input: i8042 remove old-style PM handling


===================================================================


[email protected], 2004-10-20 00:40:19-05:00, [email protected]
Input: i8042 - get rid of old-style power management handler since
AMP calls both pm_send and device_suspend.

Signed-off-by: Dmitry Torokhov <[email protected]>


i8042.c | 89 +++++++++++++++++++++-------------------------------------------
1 files changed, 30 insertions(+), 59 deletions(-)


===================================================================



diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
--- a/drivers/input/serio/i8042.c 2004-10-21 02:13:12 -05:00
+++ b/drivers/input/serio/i8042.c 2004-10-21 02:13:12 -05:00
@@ -113,7 +113,6 @@
static unsigned char i8042_ctr;
static unsigned char i8042_mux_open;
static unsigned char i8042_mux_present;
-static struct pm_dev *i8042_pm_dev;
static struct timer_list i8042_timer;
static struct platform_device *i8042_platform_device;

@@ -826,13 +825,36 @@


/*
+ * We need to reset the 8042 back to original mode on system shutdown,
+ * because otherwise BIOSes will be confused.
+ */
+
+static int i8042_notify_sys(struct notifier_block *this, unsigned long code,
+ void *unused)
+{
+ if (code == SYS_DOWN || code == SYS_HALT)
+ i8042_controller_cleanup();
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block i8042_notifier =
+{
+ i8042_notify_sys,
+ NULL,
+ 0
+};
+
+
+/*
* Here we try to restore the original BIOS settings
*/

-static int i8042_controller_suspend(void)
+static int i8042_suspend(struct device *dev, u32 state, u32 level)
{
- del_timer_sync(&i8042_timer);
- i8042_controller_reset();
+ if (level == SUSPEND_DISABLE) {
+ del_timer_sync(&i8042_timer);
+ i8042_controller_reset();
+ }

return 0;
}
@@ -842,10 +864,13 @@
* Here we try to reset everything back to a state in which suspended
*/

-static int i8042_controller_resume(void)
+static int i8042_resume(struct device *dev, u32 level)
{
int i;

+ if (level != RESUME_ENABLE)
+ return 0;
+
if (i8042_controller_init()) {
printk(KERN_ERR "i8042: resume failed\n");
return -1;
@@ -876,40 +901,7 @@
mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD);

return 0;
-}
-
-
-/*
- * We need to reset the 8042 back to original mode on system shutdown,
- * because otherwise BIOSes will be confused.
- */

-static int i8042_notify_sys(struct notifier_block *this, unsigned long code,
- void *unused)
-{
- if (code == SYS_DOWN || code == SYS_HALT)
- i8042_controller_cleanup();
- return NOTIFY_DONE;
-}
-
-static struct notifier_block i8042_notifier =
-{
- i8042_notify_sys,
- NULL,
- 0
-};
-
-/*
- * Suspend/resume handlers for the new PM scheme (driver model)
- */
-static int i8042_suspend(struct device *dev, u32 state, u32 level)
-{
- return level == SUSPEND_DISABLE ? i8042_controller_suspend() : 0;
-}
-
-static int i8042_resume(struct device *dev, u32 level)
-{
- return level == RESUME_ENABLE ? i8042_controller_resume() : 0;
}

static void i8042_shutdown(struct device *dev)
@@ -925,22 +917,6 @@
.shutdown = i8042_shutdown,
};

-/*
- * Suspend/resume handler for the old PM scheme (APM)
- */
-static int i8042_pm_callback(struct pm_dev *dev, pm_request_t request, void *dummy)
-{
- switch (request) {
- case PM_SUSPEND:
- return i8042_controller_suspend();
-
- case PM_RESUME:
- return i8042_controller_resume();
- }
-
- return 0;
-}
-
static struct serio * __init i8042_allocate_kbd_port(void)
{
struct serio *serio;
@@ -1055,8 +1031,6 @@

mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD);

- i8042_pm_dev = pm_register(PM_SYS_DEV, PM_SYS_UNKNOWN, i8042_pm_callback);
-
register_reboot_notifier(&i8042_notifier);

return 0;
@@ -1067,9 +1041,6 @@
int i;

unregister_reboot_notifier(&i8042_notifier);
-
- if (i8042_pm_dev)
- pm_unregister(i8042_pm_dev);

i8042_controller_cleanup();

2004-10-21 07:47:52

by Dmitry Torokhov

[permalink] [raw]
Subject: [PATCH 4/7] Input: i8042 runtime debug switch


===================================================================


[email protected], 2004-10-19 00:49:51-05:00, [email protected]
Input: i8042 - allow turning debugging on and off "on-fly"
so people do not have to recompile their kernels to
provide debug info.

Adds new parameter i8042.debug also accessible through
sysfs.

Signed-off-by: Dmitry Torokhov <[email protected]>


i8042.c | 8 +++++++-
i8042.h | 8 ++++++--
2 files changed, 13 insertions(+), 3 deletions(-)


===================================================================



diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
--- a/drivers/input/serio/i8042.c 2004-10-21 02:10:38 -05:00
+++ b/drivers/input/serio/i8042.c 2004-10-21 02:10:38 -05:00
@@ -63,6 +63,13 @@
MODULE_PARM_DESC(noacpi, "Do not use ACPI to detect controller settings");
#endif

+#define DEBUG
+#ifdef DEBUG
+static int i8042_debug;
+module_param_named(debug, i8042_debug, bool, 600);
+MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off");
+#endif
+
__obsolete_setup("i8042_noaux");
__obsolete_setup("i8042_nomux");
__obsolete_setup("i8042_unlock");
@@ -70,7 +77,6 @@
__obsolete_setup("i8042_direct");
__obsolete_setup("i8042_dumbkbd");

-#undef DEBUG
#include "i8042.h"

spinlock_t i8042_lock = SPIN_LOCK_UNLOCKED;
diff -Nru a/drivers/input/serio/i8042.h b/drivers/input/serio/i8042.h
--- a/drivers/input/serio/i8042.h 2004-10-21 02:10:38 -05:00
+++ b/drivers/input/serio/i8042.h 2004-10-21 02:10:38 -05:00
@@ -119,8 +119,12 @@
#ifdef DEBUG
static unsigned long i8042_start;
#define dbg_init() do { i8042_start = jiffies; } while (0)
-#define dbg(format, arg...) printk(KERN_DEBUG __FILE__ ": " format " [%d]\n" ,\
- ## arg, (int) (jiffies - i8042_start))
+#define dbg(format, arg...) \
+ do { \
+ if (i8042_debug) \
+ printk(KERN_DEBUG __FILE__ ": " format " [%d]\n" , \
+ ## arg, (int) (jiffies - i8042_start)); \
+ } while (0)
#else
#define dbg_init() do { } while (0)
#define dbg(format, arg...) do {} while (0)

2004-10-21 07:47:52

by Dmitry Torokhov

[permalink] [raw]
Subject: [PATCH 3/7] Input: link input_dev and serio (sysfs)


===================================================================


[email protected], 2004-10-13 01:15:51-05:00, [email protected]
Input: when creating input devices for hardware attached to
a serio port properly set input_device->dev pointer
so when corresponding class device is created it will
show proper links to parent device and driver in sysfs
hierarchy.

Signed-off-by: Dmitry Torokhov <[email protected]>


joystick/iforce/iforce-main.c | 16 +++++++++++++++-
joystick/magellan.c | 1 +
joystick/spaceball.c | 1 +
joystick/spaceorb.c | 1 +
joystick/stinger.c | 1 +
joystick/twidjoy.c | 1 +
joystick/warrior.c | 1 +
keyboard/atkbd.c | 1 +
keyboard/lkkbd.c | 1 +
keyboard/newtonkbd.c | 1 +
keyboard/sunkbd.c | 1 +
keyboard/xtkbd.c | 1 +
mouse/psmouse-base.c | 1 +
mouse/sermouse.c | 1 +
mouse/vsxxxaa.c | 1 +
15 files changed, 29 insertions(+), 1 deletion(-)


===================================================================



diff -Nru a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c
--- a/drivers/input/joystick/iforce/iforce-main.c 2004-10-21 02:09:49 -05:00
+++ b/drivers/input/joystick/iforce/iforce-main.c 2004-10-21 02:09:49 -05:00
@@ -352,7 +352,21 @@
* Input device fields.
*/

- iforce->dev.id.bustype = BUS_USB;
+ switch (iforce->bus) {
+#ifdef CONFIG_JOYSTICK_IFORCE_USB
+ case IFORCE_USB:
+ iforce->dev.id.bustype = BUS_USB;
+ iforce->dev.dev = &iforce->usbdev->dev;
+ break;
+#endif
+#ifdef CONFIG_JOYSTICK_IFORCE_232
+ case IFORCE_232:
+ iforce->dev.id.bustype = BUS_RS232;
+ iforce->dev.dev = &iforce->serio->dev;
+ break;
+#endif
+ }
+
iforce->dev.private = iforce;
iforce->dev.name = "Unknown I-Force device";
iforce->dev.open = iforce_open;
diff -Nru a/drivers/input/joystick/magellan.c b/drivers/input/joystick/magellan.c
--- a/drivers/input/joystick/magellan.c 2004-10-21 02:09:49 -05:00
+++ b/drivers/input/joystick/magellan.c 2004-10-21 02:09:49 -05:00
@@ -183,6 +183,7 @@
magellan->dev.id.vendor = SERIO_MAGELLAN;
magellan->dev.id.product = 0x0001;
magellan->dev.id.version = 0x0100;
+ magellan->dev.dev = &serio->dev;

serio->private = magellan;

diff -Nru a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c
--- a/drivers/input/joystick/spaceball.c 2004-10-21 02:09:49 -05:00
+++ b/drivers/input/joystick/spaceball.c 2004-10-21 02:09:49 -05:00
@@ -253,6 +253,7 @@
spaceball->dev.id.vendor = SERIO_SPACEBALL;
spaceball->dev.id.product = id;
spaceball->dev.id.version = 0x0100;
+ spaceball->dev.dev = &serio->dev;

serio->private = spaceball;

diff -Nru a/drivers/input/joystick/spaceorb.c b/drivers/input/joystick/spaceorb.c
--- a/drivers/input/joystick/spaceorb.c 2004-10-21 02:09:49 -05:00
+++ b/drivers/input/joystick/spaceorb.c 2004-10-21 02:09:49 -05:00
@@ -200,6 +200,7 @@
spaceorb->dev.id.vendor = SERIO_SPACEORB;
spaceorb->dev.id.product = 0x0001;
spaceorb->dev.id.version = 0x0100;
+ spaceorb->dev.dev = &serio->dev;

serio->private = spaceorb;

diff -Nru a/drivers/input/joystick/stinger.c b/drivers/input/joystick/stinger.c
--- a/drivers/input/joystick/stinger.c 2004-10-21 02:09:49 -05:00
+++ b/drivers/input/joystick/stinger.c 2004-10-21 02:09:49 -05:00
@@ -164,6 +164,7 @@
stinger->dev.id.vendor = SERIO_STINGER;
stinger->dev.id.product = 0x0001;
stinger->dev.id.version = 0x0100;
+ stinger->dev.dev = &serio->dev;

for (i = 0; i < 2; i++) {
stinger->dev.absmax[ABS_X+i] = 64;
diff -Nru a/drivers/input/joystick/twidjoy.c b/drivers/input/joystick/twidjoy.c
--- a/drivers/input/joystick/twidjoy.c 2004-10-21 02:09:49 -05:00
+++ b/drivers/input/joystick/twidjoy.c 2004-10-21 02:09:49 -05:00
@@ -210,6 +210,7 @@
twidjoy->dev.id.vendor = SERIO_TWIDJOY;
twidjoy->dev.id.product = 0x0001;
twidjoy->dev.id.version = 0x0100;
+ twidjoy->dev.dev = &serio->dev;

twidjoy->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);

diff -Nru a/drivers/input/joystick/warrior.c b/drivers/input/joystick/warrior.c
--- a/drivers/input/joystick/warrior.c 2004-10-21 02:09:49 -05:00
+++ b/drivers/input/joystick/warrior.c 2004-10-21 02:09:49 -05:00
@@ -168,6 +168,7 @@
warrior->dev.id.vendor = SERIO_WARRIOR;
warrior->dev.id.product = 0x0001;
warrior->dev.id.version = 0x0100;
+ warrior->dev.dev = &serio->dev;

for (i = 0; i < 2; i++) {
warrior->dev.absmax[ABS_X+i] = -64;
diff -Nru a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
--- a/drivers/input/keyboard/atkbd.c 2004-10-21 02:09:49 -05:00
+++ b/drivers/input/keyboard/atkbd.c 2004-10-21 02:09:49 -05:00
@@ -727,6 +727,7 @@
atkbd->dev.id.version = atkbd->id;
atkbd->dev.event = atkbd_event;
atkbd->dev.private = atkbd;
+ atkbd->dev.dev = &atkbd->ps2dev.serio->dev;

atkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_MSC);

diff -Nru a/drivers/input/keyboard/lkkbd.c b/drivers/input/keyboard/lkkbd.c
--- a/drivers/input/keyboard/lkkbd.c 2004-10-21 02:09:49 -05:00
+++ b/drivers/input/keyboard/lkkbd.c 2004-10-21 02:09:49 -05:00
@@ -685,6 +685,7 @@
lk->dev.id.vendor = SERIO_LKKBD;
lk->dev.id.product = 0;
lk->dev.id.version = 0x0100;
+ lk->dev.dev = &serio->dev;

input_register_device (&lk->dev);

diff -Nru a/drivers/input/keyboard/newtonkbd.c b/drivers/input/keyboard/newtonkbd.c
--- a/drivers/input/keyboard/newtonkbd.c 2004-10-21 02:09:49 -05:00
+++ b/drivers/input/keyboard/newtonkbd.c 2004-10-21 02:09:49 -05:00
@@ -126,6 +126,7 @@
nkbd->dev.id.vendor = SERIO_NEWTON;
nkbd->dev.id.product = 0x0001;
nkbd->dev.id.version = 0x0100;
+ nkbd->dev.dev = &serio->dev;

input_register_device(&nkbd->dev);

diff -Nru a/drivers/input/keyboard/sunkbd.c b/drivers/input/keyboard/sunkbd.c
--- a/drivers/input/keyboard/sunkbd.c 2004-10-21 02:09:49 -05:00
+++ b/drivers/input/keyboard/sunkbd.c 2004-10-21 02:09:49 -05:00
@@ -285,6 +285,7 @@
sunkbd->dev.id.vendor = SERIO_SUNKBD;
sunkbd->dev.id.product = sunkbd->type;
sunkbd->dev.id.version = 0x0100;
+ sunkbd->dev.dev = &serio->dev;

input_register_device(&sunkbd->dev);

diff -Nru a/drivers/input/keyboard/xtkbd.c b/drivers/input/keyboard/xtkbd.c
--- a/drivers/input/keyboard/xtkbd.c 2004-10-21 02:09:49 -05:00
+++ b/drivers/input/keyboard/xtkbd.c 2004-10-21 02:09:49 -05:00
@@ -131,6 +131,7 @@
xtkbd->dev.id.vendor = 0x0001;
xtkbd->dev.id.product = 0x0001;
xtkbd->dev.id.version = 0x0100;
+ xtkbd->dev.dev = &serio->dev;

input_register_device(&xtkbd->dev);

diff -Nru a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
--- a/drivers/input/mouse/psmouse-base.c 2004-10-21 02:09:49 -05:00
+++ b/drivers/input/mouse/psmouse-base.c 2004-10-21 02:09:49 -05:00
@@ -699,6 +699,7 @@
psmouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);
psmouse->dev.private = psmouse;
+ psmouse->dev.dev = &serio->dev;
psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);

serio->private = psmouse;
diff -Nru a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c
--- a/drivers/input/mouse/sermouse.c 2004-10-21 02:09:49 -05:00
+++ b/drivers/input/mouse/sermouse.c 2004-10-21 02:09:49 -05:00
@@ -280,6 +280,7 @@
sermouse->dev.id.vendor = sermouse->type;
sermouse->dev.id.product = c;
sermouse->dev.id.version = 0x0100;
+ sermouse->dev.dev = &serio->dev;

if (serio_open(serio, drv)) {
kfree(sermouse);
diff -Nru a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c
--- a/drivers/input/mouse/vsxxxaa.c 2004-10-21 02:09:49 -05:00
+++ b/drivers/input/mouse/vsxxxaa.c 2004-10-21 02:09:49 -05:00
@@ -529,6 +529,7 @@
mouse->dev.name = mouse->name;
mouse->dev.phys = mouse->phys;
mouse->dev.id.bustype = BUS_RS232;
+ mouse->dev.dev = &serio->dev;
mouse->serio = serio;

if (serio_open (serio, drv)) {

2004-10-21 07:47:51

by Dmitry Torokhov

[permalink] [raw]
Subject: [PATCH 2/7] Input: remove class devices on disconnect


===================================================================


[email protected], 2004-10-13 01:05:47-05:00, [email protected]
Input: evdev, joydev, mousedev, tsdev - remove class device and devfs
entry when hardware driver disconnects instead of waiting for
the last user to drop off. This way hardware drivers can be
unloaded at any time.

Signed-off-by: Dmitry Torokhov <[email protected]>


evdev.c | 4 ++--
joydev.c | 4 ++--
mousedev.c | 4 ++--
tsdev.c | 10 +++++-----
4 files changed, 11 insertions(+), 11 deletions(-)


===================================================================



diff -Nru a/drivers/input/evdev.c b/drivers/input/evdev.c
--- a/drivers/input/evdev.c 2004-10-21 02:08:42 -05:00
+++ b/drivers/input/evdev.c 2004-10-21 02:08:42 -05:00
@@ -91,8 +91,6 @@

static void evdev_free(struct evdev *evdev)
{
- devfs_remove("input/event%d", evdev->minor);
- class_simple_device_remove(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor));
evdev_table[evdev->minor] = NULL;
kfree(evdev);
}
@@ -441,6 +439,8 @@
{
struct evdev *evdev = handle->private;

+ class_simple_device_remove(MKDEV(INPUT_MAJOR, EVDEV_MINOR_BASE + evdev->minor));
+ devfs_remove("input/event%d", evdev->minor);
evdev->exist = 0;

if (evdev->open) {
diff -Nru a/drivers/input/joydev.c b/drivers/input/joydev.c
--- a/drivers/input/joydev.c 2004-10-21 02:08:42 -05:00
+++ b/drivers/input/joydev.c 2004-10-21 02:08:42 -05:00
@@ -143,9 +143,7 @@

static void joydev_free(struct joydev *joydev)
{
- devfs_remove("input/js%d", joydev->minor);
joydev_table[joydev->minor] = NULL;
- class_simple_device_remove(MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor));
kfree(joydev);
}

@@ -466,6 +464,8 @@
{
struct joydev *joydev = handle->private;

+ class_simple_device_remove(MKDEV(INPUT_MAJOR, JOYDEV_MINOR_BASE + joydev->minor));
+ devfs_remove("input/js%d", joydev->minor);
joydev->exist = 0;

if (joydev->open)
diff -Nru a/drivers/input/mousedev.c b/drivers/input/mousedev.c
--- a/drivers/input/mousedev.c 2004-10-21 02:08:42 -05:00
+++ b/drivers/input/mousedev.c 2004-10-21 02:08:42 -05:00
@@ -335,8 +335,6 @@

static void mousedev_free(struct mousedev *mousedev)
{
- devfs_remove("input/mouse%d", mousedev->minor);
- class_simple_device_remove(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor));
mousedev_table[mousedev->minor] = NULL;
kfree(mousedev);
}
@@ -646,6 +644,8 @@
{
struct mousedev *mousedev = handle->private;

+ class_simple_device_remove(MKDEV(INPUT_MAJOR, MOUSEDEV_MINOR_BASE + mousedev->minor));
+ devfs_remove("input/mouse%d", mousedev->minor);
mousedev->exist = 0;

if (mousedev->open) {
diff -Nru a/drivers/input/tsdev.c b/drivers/input/tsdev.c
--- a/drivers/input/tsdev.c 2004-10-21 02:08:42 -05:00
+++ b/drivers/input/tsdev.c 2004-10-21 02:08:42 -05:00
@@ -1,7 +1,7 @@
/*
* $Id: tsdev.c,v 1.15 2002/04/10 16:50:19 jsimmons Exp $
*
- * Copyright (c) 2001 "Crazy" james Simmons
+ * Copyright (c) 2001 "Crazy" james Simmons
*
* Compaq touchscreen protocol driver. The protocol emulated by this driver
* is obsolete; for new programs use the tslib library which can read directly
@@ -177,8 +177,6 @@

static void tsdev_free(struct tsdev *tsdev)
{
- devfs_remove("input/ts%d", tsdev->minor);
- class_simple_device_remove(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor));
tsdev_table[tsdev->minor] = NULL;
kfree(tsdev);
}
@@ -418,7 +416,7 @@
S_IFCHR|S_IRUGO|S_IWUSR, "input/ts%d", minor);
devfs_mk_cdev(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor + TSDEV_MINORS/2),
S_IFCHR|S_IRUGO|S_IWUSR, "input/tsraw%d", minor);
- class_simple_device_add(input_class,
+ class_simple_device_add(input_class,
MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + minor),
dev->dev, "ts%d", minor);

@@ -429,6 +427,9 @@
{
struct tsdev *tsdev = handle->private;

+ class_simple_device_remove(MKDEV(INPUT_MAJOR, TSDEV_MINOR_BASE + tsdev->minor));
+ devfs_remove("input/ts%d", tsdev->minor);
+ devfs_remove("input/tsraw%d", tsdev->minor);
tsdev->exist = 0;

if (tsdev->open) {
@@ -436,7 +437,6 @@
wake_up_interruptible(&tsdev->wait);
} else
tsdev_free(tsdev);
- devfs_remove("input/tsraw%d", tsdev->minor);
}

static struct input_device_id tsdev_ids[] = {

2004-10-21 07:38:44

by Dmitry Torokhov

[permalink] [raw]
Subject: [PATCH 7/7] Input: remove pm_dev from core


===================================================================


[email protected], 2004-10-20 00:57:45-05:00, [email protected]
Input: get rid of pm_dev in input core as it is deprecated and
nothing uses it anyway.

Signed-off-by: Dmitry Torokhov <[email protected]>


drivers/input/input.c | 4 ----
drivers/input/touchscreen/h3600_ts_input.c | 5 +++--
include/linux/input.h | 1 -
3 files changed, 3 insertions(+), 7 deletions(-)


===================================================================



diff -Nru a/drivers/input/input.c b/drivers/input/input.c
--- a/drivers/input/input.c 2004-10-21 02:14:33 -05:00
+++ b/drivers/input/input.c 2004-10-21 02:14:33 -05:00
@@ -17,7 +17,6 @@
#include <linux/module.h>
#include <linux/random.h>
#include <linux/major.h>
-#include <linux/pm.h>
#include <linux/proc_fs.h>
#include <linux/kmod.h>
#include <linux/interrupt.h>
@@ -460,9 +459,6 @@
struct list_head * node, * next;

if (!dev) return;
-
- if (dev->pm_dev)
- pm_unregister(dev->pm_dev);

del_timer_sync(&dev->timer);

diff -Nru a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c
--- a/drivers/input/touchscreen/h3600_ts_input.c 2004-10-21 02:14:33 -05:00
+++ b/drivers/input/touchscreen/h3600_ts_input.c 2004-10-21 02:14:33 -05:00
@@ -100,6 +100,7 @@
*/
struct h3600_dev {
struct input_dev dev;
+ struct pm_dev *pm_dev;
struct serio *serio;
unsigned char event; /* event ID from packet */
unsigned char chksum;
@@ -452,8 +453,8 @@

//h3600_flite_control(1, 25); /* default brightness */
#ifdef CONFIG_PM
- ts->dev.pm_dev = pm_register(PM_ILLUMINATION_DEV, PM_SYS_LIGHT,
- h3600ts_pm_callback);
+ ts->pm_dev = pm_register(PM_ILLUMINATION_DEV, PM_SYS_LIGHT,
+ h3600ts_pm_callback);
printk("registered pm callback\n");
#endif
input_register_device(&ts->dev);
diff -Nru a/include/linux/input.h b/include/linux/input.h
--- a/include/linux/input.h 2004-10-21 02:14:33 -05:00
+++ b/include/linux/input.h 2004-10-21 02:14:33 -05:00
@@ -806,7 +806,6 @@
unsigned int repeat_key;
struct timer_list timer;

- struct pm_dev *pm_dev;
struct pt_regs *regs;
int state;

2004-10-21 07:38:44

by Dmitry Torokhov

[permalink] [raw]
Subject: [PATCH 6/7] Input: i8042 remove reboot notifier


===================================================================


[email protected], 2004-10-20 00:53:53-05:00, [email protected]
Input: i8042 - get rid of reboot notifier as suspend method
should do the job.

Signed-off-by: Dmitry Torokhov <[email protected]>


i8042.c | 33 +++++----------------------------
1 files changed, 5 insertions(+), 28 deletions(-)


===================================================================



diff -Nru a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
--- a/drivers/input/serio/i8042.c 2004-10-21 02:14:01 -05:00
+++ b/drivers/input/serio/i8042.c 2004-10-21 02:14:01 -05:00
@@ -16,10 +16,7 @@
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/config.h>
-#include <linux/reboot.h>
#include <linux/init.h>
-#include <linux/sysdev.h>
-#include <linux/pm.h>
#include <linux/serio.h>
#include <linux/err.h>

@@ -825,27 +822,6 @@


/*
- * We need to reset the 8042 back to original mode on system shutdown,
- * because otherwise BIOSes will be confused.
- */
-
-static int i8042_notify_sys(struct notifier_block *this, unsigned long code,
- void *unused)
-{
- if (code == SYS_DOWN || code == SYS_HALT)
- i8042_controller_cleanup();
- return NOTIFY_DONE;
-}
-
-static struct notifier_block i8042_notifier =
-{
- i8042_notify_sys,
- NULL,
- 0
-};
-
-
-/*
* Here we try to restore the original BIOS settings
*/

@@ -904,6 +880,11 @@

}

+/*
+ * We need to reset the 8042 back to original mode on system shutdown,
+ * because otherwise BIOSes will be confused.
+ */
+
static void i8042_shutdown(struct device *dev)
{
i8042_controller_cleanup();
@@ -1031,16 +1012,12 @@

mod_timer(&i8042_timer, jiffies + I8042_POLL_PERIOD);

- register_reboot_notifier(&i8042_notifier);
-
return 0;
}

void __exit i8042_exit(void)
{
int i;
-
- unregister_reboot_notifier(&i8042_notifier);

i8042_controller_cleanup();

2004-10-21 09:16:05

by Russell King

[permalink] [raw]
Subject: Re: [PATCH 7/7] Input: remove pm_dev from core

On Thu, Oct 21, 2004 at 02:30:02AM -0500, Dmitry Torokhov wrote:
> [email protected], 2004-10-20 00:57:45-05:00, [email protected]
> Input: get rid of pm_dev in input core as it is deprecated and
> nothing uses it anyway.

You might as well remove it completely - anything which uses the
driver model PM implementation will never call these methods, and
ARM uses the driver model PM implementation.

Therefore, any driver using the obsolete pm_register() functions
won't receive any PM events.

Same is true on x86 btw.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core

2004-10-21 13:33:04

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH 7/7] Input: remove pm_dev from core

On Thursday 21 October 2004 04:13 am, Russell King wrote:
> On Thu, Oct 21, 2004 at 02:30:02AM -0500, Dmitry Torokhov wrote:
> > [email protected], 2004-10-20 00:57:45-05:00, [email protected]
> > Input: get rid of pm_dev in input core as it is deprecated and
> > nothing uses it anyway.
>
> You might as well remove it completely - anything which uses the
> driver model PM implementation will never call these methods, and
> ARM uses the driver model PM implementation.
>
> Therefore, any driver using the obsolete pm_register() functions
> won't receive any PM events.
>
> Same is true on x86 btw.
>

Hmm, I admit I missed arm case but for x86 should work actually:

in arch/i386/kernel/apm.c:
static int suspend(int vetoable)
{
int err;
struct apm_user *as;

if (pm_send_all(PM_SUSPEND, (void *)3)) {
/* Vetoed */
if (vetoable) {
if (apm_info.connection_version > 0x100)
set_system_power_state(APM_STATE_REJECT);
err = -EBUSY;
ignore_sys_suspend = 0;
printk(KERN_WARNING "apm: suspend was vetoed.\n");
goto out;
}
printk(KERN_CRIT "apm: suspend was vetoed, but suspending anyway.\n");
}

device_suspend(3);
device_power_down(3);
...

but since you say arm does not care I think we'll proceed with the patch.

--
Dmitry

2004-10-23 20:52:26

by Russell King

[permalink] [raw]
Subject: Re: [PATCH 7/7] Input: remove pm_dev from core

On Thu, Oct 21, 2004 at 08:25:00AM -0500, Dmitry Torokhov wrote:
> On Thursday 21 October 2004 04:13 am, Russell King wrote:
> > On Thu, Oct 21, 2004 at 02:30:02AM -0500, Dmitry Torokhov wrote:
> > > [email protected], 2004-10-20 00:57:45-05:00, [email protected]
> > > Input: get rid of pm_dev in input core as it is deprecated and
> > > nothing uses it anyway.
> >
> > You might as well remove it completely - anything which uses the
> > driver model PM implementation will never call these methods, and
> > ARM uses the driver model PM implementation.
> >
> > Therefore, any driver using the obsolete pm_register() functions
> > won't receive any PM events.
> >
> > Same is true on x86 btw.
> >
>
> Hmm, I admit I missed arm case but for x86 should work actually:
>
> in arch/i386/kernel/apm.c:
> static int suspend(int vetoable)
> {
> int err;
> struct apm_user *as;
>
> if (pm_send_all(PM_SUSPEND, (void *)3)) {
> /* Vetoed */
> if (vetoable) {
> if (apm_info.connection_version > 0x100)
> set_system_power_state(APM_STATE_REJECT);
> err = -EBUSY;
> ignore_sys_suspend = 0;
> printk(KERN_WARNING "apm: suspend was vetoed.\n");
> goto out;
> }
> printk(KERN_CRIT "apm: suspend was vetoed, but suspending anyway.\n");
> }
>
> device_suspend(3);
> device_power_down(3);
> ...
>
> but since you say arm does not care I think we'll proceed with the patch.

Sure, it works for x86 using APM. Don't forget there's ACPI and the
device model PM implementation (and swsusp). The latter two did not
call the old interfaces last time I checked.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core