patch-2.3.46 linux/drivers/char/joystick/joystick.c
Next file: linux/drivers/char/keyboard.c
Previous file: linux/drivers/char/istallion.c
Back to the patch index
Back to the overall index
- Lines: 73
- Date:
Wed Feb 16 15:42:05 2000
- Orig file:
v2.3.45/linux/drivers/char/joystick/joystick.c
- Orig date:
Wed Dec 8 14:11:26 1999
diff -u --recursive --new-file v2.3.45/linux/drivers/char/joystick/joystick.c linux/drivers/char/joystick/joystick.c
@@ -38,6 +38,7 @@
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/joystick.h>
+#include <linux/devfs_fs_kernel.h>
#include <linux/kernel.h>
#include <linux/major.h>
#include <linux/malloc.h>
@@ -694,6 +695,10 @@
return prev;
}
+extern struct file_operations js_fops;
+
+static devfs_handle_t devfs_handle = NULL;
+
int js_register_device(struct js_port *port, int number, int axes, int buttons, char *name,
js_ops_func open, js_ops_func close)
{
@@ -702,6 +707,7 @@
void *all;
int i = 0;
unsigned long flags;
+ char devfs_name[8];
if (!(all = kmalloc(sizeof(struct js_dev) + 2 * axes * sizeof(int) +
2 * (((buttons - 1) >> 5) + 1) * sizeof(int) +
@@ -732,6 +738,12 @@
curd->name = all += axes * sizeof(struct js_corr);
strcpy(curd->name, name);
+ sprintf (devfs_name, "analogue%d", number);
+ curd->devfs_handle = devfs_register (devfs_handle, devfs_name, 0,
+ DEVFS_FL_DEFAULT,
+ JOYSTICK_MAJOR, number,
+ S_IFCHR | S_IRUGO | S_IWUSR, 0, 0,
+ &js_fops, NULL);
port->devs[number] = curd;
port->axes[number] = curd->new.axes;
@@ -760,6 +772,7 @@
spin_unlock_irqrestore(&js_lock, flags);
+ devfs_unregister (dev->devfs_handle);
kfree(dev);
}
@@ -788,10 +801,11 @@
#endif
{
- if (register_chrdev(JOYSTICK_MAJOR, "js", &js_fops)) {
+ if (devfs_register_chrdev(JOYSTICK_MAJOR, "js", &js_fops)) {
printk(KERN_ERR "js: unable to get major %d for joystick\n", JOYSTICK_MAJOR);
return -EBUSY;
}
+ devfs_handle = devfs_mk_dir (NULL, "joysticks", 9, NULL);
printk(KERN_INFO "js: Joystick driver v%d.%d.%d (c) 1999 Vojtech Pavlik <vojtech@suse.cz>\n",
JS_VERSION >> 16 & 0xff, JS_VERSION >> 8 & 0xff, JS_VERSION & 0xff);
@@ -871,8 +885,9 @@
void cleanup_module(void)
{
del_timer(&js_timer);
- if (unregister_chrdev(JOYSTICK_MAJOR, "js"))
- printk(KERN_ERR "js: can't unregister device\n");
+ devfs_unregister (devfs_handle);
+ if (devfs_unregister_chrdev(JOYSTICK_MAJOR, "js"))
+ printk(KERN_ERR "js: can't unregister device\n");
}
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)