Messages in this thread Patch in this message |  | | Date | Sun, 24 Jun 2001 17:37:11 -0500 | | From | "Gregory T. Norris" <> | | Subject | Re: [patch] rio500 devfs support |
| |
Here's an updated version of the patch - the only real difference is that rio500.c will printk an error message if devfs_register() fails. I left that out originally because devfs logs the error, but it's probably a good idea to indicate which driver made the request.
Cheers!
On Tue, Jun 19, 2001 at 05:52:24PM -0500, Gregory T. Norris wrote: > The attached diff adds devfs support to the rio500 driver, so that > /dev/usb/rio500 gets created automagically. It was generated against > 2.4.5, but probably applies fine against any recent kernel. Comments > are welcome (but be gentle, this is my first attempt at a kernel > patch :-). > > Cheers! diff -urN linux-2.4.5.orig/drivers/usb/rio500.c linux-2.4.5/drivers/usb/rio500.c --- linux-2.4.5.orig/drivers/usb/rio500.c Sun Jun 24 16:29:35 2001 +++ linux-2.4.5/drivers/usb/rio500.c Sun Jun 24 16:45:08 2001 @@ -38,6 +38,7 @@ #include <linux/spinlock.h> #include <linux/usb.h> #include <linux/smp_lock.h> +#include <linux/devfs_fs_kernel.h> #include "rio500_usb.h" @@ -70,6 +71,7 @@ }; static struct rio_usb_data rio_instance; +static devfs_handle_t rio500_devfs_handle; static int open_rio(struct inode *inode, struct file *file) { @@ -492,6 +494,14 @@ if (usb_register(&rio_driver) < 0) return -1; + rio500_devfs_handle = devfs_register(NULL, "usb/rio500", + DEVFS_FL_DEFAULT, + USB_MAJOR, RIO_MINOR, + S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, + &usb_rio_fops, NULL); + if (rio500_devfs_handle == NULL) + printk(KERN_WARNING __FILE__ ": unable to register /dev/usb/rio500 with devfs\n"); + info(DRIVER_VERSION " " DRIVER_AUTHOR); info(DRIVER_DESC); @@ -506,6 +516,8 @@ rio->present = 0; usb_deregister(&rio_driver); + if (rio500_devfs_handle != NULL) + devfs_unregister(rio500_devfs_handle); } [unhandled content-type:application/pgp-signature] |  |