patch-2.4.8 linux/drivers/usb/rio500.c
Next file: linux/drivers/usb/scanner.c
Previous file: linux/drivers/usb/ov511.c
Back to the patch index
Back to the overall index
- Lines: 107
- Date:
Wed Jul 25 14:12:03 2001
- Orig file:
v2.4.7/linux/drivers/usb/rio500.c
- Orig date:
Tue Jul 3 17:08:21 2001
diff -u --recursive --new-file v2.4.7/linux/drivers/usb/rio500.c linux/drivers/usb/rio500.c
@@ -38,13 +38,14 @@
#include <linux/spinlock.h>
#include <linux/usb.h>
#include <linux/smp_lock.h>
+#include <linux/devfs_fs_kernel.h>
#include "rio500_usb.h"
/*
* Version Information
*/
-#define DRIVER_VERSION "v1.0.0"
+#define DRIVER_VERSION "v1.1"
#define DRIVER_AUTHOR "Cesar Miquel <miquel@df.uba.ar>"
#define DRIVER_DESC "USB Rio 500 driver"
@@ -60,6 +61,7 @@
struct rio_usb_data {
struct usb_device *rio_dev; /* init: probe_rio */
+ devfs_handle_t devfs; /* devfs device */
unsigned int ifnum; /* Interface number of the USB device */
int isopen; /* nz if open */
int present; /* Device is present on the bus */
@@ -69,6 +71,8 @@
struct semaphore lock; /* general race avoidance */
};
+extern devfs_handle_t usb_devfs_handle; /* /dev/usb dir. */
+
static struct rio_usb_data rio_instance;
static int open_rio(struct inode *inode, struct file *file)
@@ -350,7 +354,7 @@
int this_read;
int result;
int maxretry = 10;
- char *ibuf = rio->ibuf;
+ char *ibuf;
/* Sanity check to make sure rio is connected, powered, etc */
if ( rio == NULL ||
@@ -358,6 +362,8 @@
rio->rio_dev == NULL )
return -1;
+ ibuf = rio->ibuf;
+
read_count = 0;
down(&(rio->lock));
@@ -416,6 +422,15 @@
return read_count;
}
+static struct
+file_operations usb_rio_fops = {
+ read: read_rio,
+ write: write_rio,
+ ioctl: ioctl_rio,
+ open: open_rio,
+ release: close_rio,
+};
+
static void *probe_rio(struct usb_device *dev, unsigned int ifnum,
const struct usb_device_id *id)
{
@@ -439,6 +454,14 @@
}
dbg("probe_rio: ibuf address:%p", rio->ibuf);
+ rio->devfs = devfs_register(usb_devfs_handle, "rio500",
+ DEVFS_FL_DEFAULT, USB_MAJOR,
+ RIO_MINOR,
+ S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP |
+ S_IWGRP, &usb_rio_fops, NULL);
+ if (rio->devfs == NULL)
+ dbg("probe_rio: device node registration failed");
+
init_MUTEX(&(rio->lock));
return rio;
@@ -448,6 +471,8 @@
{
struct rio_usb_data *rio = (struct rio_usb_data *) ptr;
+ devfs_unregister(rio->devfs);
+
if (rio->isopen) {
rio->isopen = 0;
/* better let it finish - the release will do whats needed */
@@ -461,15 +486,6 @@
rio->present = 0;
}
-
-static struct
-file_operations usb_rio_fops = {
- read: read_rio,
- write: write_rio,
- ioctl: ioctl_rio,
- open: open_rio,
- release: close_rio,
-};
static struct usb_device_id rio_table [] = {
{ USB_DEVICE(0x0841, 1) }, /* Rio 500 */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)