patch-2.1.126 linux/drivers/char/joystick/joy-console.c
Next file: linux/drivers/char/joystick/joy-db9.c
Previous file: linux/drivers/char/joystick/joy-assasin.c
Back to the patch index
Back to the overall index
- Lines: 88
- Date:
Wed Oct 21 08:43:33 1998
- Orig file:
v2.1.125/linux/drivers/char/joystick/joy-console.c
- Orig date:
Fri Oct 9 13:27:08 1998
diff -u --recursive --new-file v2.1.125/linux/drivers/char/joystick/joy-console.c linux/drivers/char/joystick/joy-console.c
@@ -1,5 +1,5 @@
/*
- * joy-console.c Version 0.10
+ * joy-console.c Version 0.11V
*
* Copyright (c) 1998 Andree Borrmann
*/
@@ -57,8 +57,6 @@
struct js_console_info {
#ifdef USE_PARPORT
struct pardevice *port; /* parport device */
- int use; /* use count */
- int wanted; /* parport wanted */
#else
int port; /* hw port */
#endif
@@ -345,19 +343,11 @@
int js_console_open(struct js_dev *dev)
{
- MOD_INC_USE_COUNT;
-
#ifdef USE_PARPORT
- {
- struct js_console_info *info = dev->port->info;
- if (!info->use && parport_claim(info->port)) {
- printk(KERN_WARNING "joy-console: parport busy!\n"); /* port currently not available ... */
- info->wanted++; /* we'll claim it on wakeup */
- return 0;
- }
- info->use++;
- }
+ struct js_console_info *info = dev->port->info;
+ if (!MOD_IN_USE && parport_claim(info->port)) return -EBUSY;
#endif
+ MOD_INC_USE_COUNT;
return 0;
}
@@ -369,32 +359,13 @@
{
#ifdef USE_PARPORT
struct js_console_info *info = dev->port->info;
-
- if (!--info->use)
- parport_release(info->port);
#endif
MOD_DEC_USE_COUNT;
-
- return 0;
-}
-
-/*
- * parport wakeup callback: claim the port!
- */
-
#ifdef USE_PARPORT
-static void js_console_wakeup(void *v)
-{
- struct js_console_info *info = js_console_port->info; /* FIXME! We can have more than 1 port! */
-
- if (!info->use && info->wanted)
- {
- parport_claim(info->port);
- info->use++;
- info->wanted--;
- }
-}
+ if (!MOD_IN_USE) parport_release(info->port);
#endif
+ return 0;
+}
#ifdef MODULE
void cleanup_module(void)
@@ -466,9 +437,9 @@
return port;
}
- info.port = parport_register_device(pp, "joystick (console)", NULL, js_console_wakeup, NULL, 0, NULL);
- info.wanted = 0;
- info.use = 0;
+ info.port = parport_register_device(pp, "joystick (console)", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
+ if (!info.port)
+ return port;
}
if (parport_claim(info.port))
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov