[patch] Input - handle return values from interface_register() [10/13]

Vojtech Pavlik (vojtech@suse.cz)
Fri, 15 Nov 2002 09:15:32 +0100


You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.
'bk pull bk://linux-input.bkbits.net/linux-input' should work as well.

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

ChangeSet@1.798.1.3, 2002-11-09 11:00:34+01:00, mikal@stillhq.com
Handle return values from interface_register() and misc_register()
in the input drivers.

evbug.c | 9 +++++++--
evdev.c | 9 +++++++--
joydev.c | 7 ++++++-
mousedev.c | 14 +++++++++++---
4 files changed, 31 insertions(+), 8 deletions(-)

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

diff -Nru a/drivers/input/evbug.c b/drivers/input/evbug.c
--- a/drivers/input/evbug.c Fri Nov 15 08:30:48 2002
+++ b/drivers/input/evbug.c Fri Nov 15 08:30:48 2002
@@ -95,7 +95,12 @@

int __init evbug_init(void)
{
- interface_register(&evbug_intf);
+ int retval;
+
+ retval = interface_register(&evbug_intf);
+ if(retval < 0)
+ return retval;
+
input_register_handler(&evbug_handler);
return 0;
}
@@ -103,7 +108,7 @@
void __exit evbug_exit(void)
{
input_unregister_handler(&evbug_handler);
- interface_register(&evbug_intf);
+ interface_unregister(&evbug_intf);
}

module_init(evbug_init);
diff -Nru a/drivers/input/evdev.c b/drivers/input/evdev.c
--- a/drivers/input/evdev.c Fri Nov 15 08:30:48 2002
+++ b/drivers/input/evdev.c Fri Nov 15 08:30:48 2002
@@ -442,7 +442,12 @@

static int __init evdev_init(void)
{
- interface_register(&evdev_intf);
+ int retval;
+
+ retval = interface_register(&evdev_intf);
+ if(retval < 0)
+ return retval;
+
input_register_handler(&evdev_handler);
return 0;
}
@@ -450,7 +455,7 @@
static void __exit evdev_exit(void)
{
input_unregister_handler(&evdev_handler);
- interface_register(&evdev_intf);
+ interface_unregister(&evdev_intf);
}

module_init(evdev_init);
diff -Nru a/drivers/input/joydev.c b/drivers/input/joydev.c
--- a/drivers/input/joydev.c Fri Nov 15 08:30:48 2002
+++ b/drivers/input/joydev.c Fri Nov 15 08:30:48 2002
@@ -499,7 +499,12 @@

static int __init joydev_init(void)
{
- interface_register(&joydev_intf);
+ int retval;
+
+ retval = interface_register(&joydev_intf);
+ if(retval < 0)
+ return retval;
+
input_register_handler(&joydev_handler);
return 0;
}
diff -Nru a/drivers/input/mousedev.c b/drivers/input/mousedev.c
--- a/drivers/input/mousedev.c Fri Nov 15 08:30:48 2002
+++ b/drivers/input/mousedev.c Fri Nov 15 08:30:48 2002
@@ -41,6 +41,7 @@
int exist;
int open;
int minor;
+ int misc;
char name[16];
wait_queue_head_t wait;
struct list_head list;
@@ -489,7 +490,11 @@

static int __init mousedev_init(void)
{
- interface_register(&mousedev_intf);
+ int retval;
+
+ if((retval = interface_register(&mousedev_intf)) < 0)
+ return retval;
+
input_register_handler(&mousedev_handler);

memset(&mousedev_mix, 0, sizeof(struct mousedev));
@@ -499,8 +504,10 @@
mousedev_mix.exist = 1;
mousedev_mix.minor = MOUSEDEV_MIX;
mousedev_mix.devfs = input_register_minor("mice", MOUSEDEV_MIX, MOUSEDEV_MINOR_BASE);
+
#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
- misc_register(&psaux_mouse);
+ if (!(mousedev_mix.misc = !misc_register(&psaux_mouse)))
+ printk(KERN_WARNING "mice: could not misc_register the device\n");
#endif

printk(KERN_INFO "mice: PS/2 mouse device common for all mice\n");
@@ -511,7 +518,8 @@
static void __exit mousedev_exit(void)
{
#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
- misc_deregister(&psaux_mouse);
+ if (mousedev_mix.misc)
+ misc_deregister(&psaux_mouse);
#endif
input_unregister_minor(mousedev_mix.devfs);
input_unregister_handler(&mousedev_handler);

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

This BitKeeper patch contains the following changesets:
1.798.1.3
## Wrapped with gzip_uu ##

begin 664 bkpatch16321
M'XL(`*BBU#T``]5776_:2!1]9G[%M)4J4(6Y,QY_D665;E.U4:LT8E7M2Z1H
ML,?@QMBI/TB[\H_?.S8$$@BLV3YD`3&V&9][?.?<<X=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<__5V?'%^\8&^G$>^&E(_+>.`)FGQ,,7UCA+#X)RKY"56
MQYG%1$T&AR69+2HZ5(T2J-UD=KGO<E>@R^?7[TG(//5G*CY-\R`VTFRZ#\K%
MBF&`FQ*]5W";_PK6_[2]ZQW5@>9>/_DQ?NNY6@?XW;JU8\@VK9V!K2,UPY.M
<?0/T_B\HKKE_DY?SD0W@.*'@Y!\-Y5#L[PX`````
`
end
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/