Commit 36a674f3 authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] devfs: usb

parent cdc053a0
......@@ -130,7 +130,6 @@ MFG:HEWLETT-PACKARD;MDL:DESKJET 970C;CMD:MLC,PCL,PML;CLASS:PRINTER;DESCRIPTION:H
struct usblp {
struct usb_device *dev; /* USB device */
devfs_handle_t devfs; /* devfs device */
struct semaphore sem; /* locks this struct, especially "dev" */
char *writebuf; /* write transfer_buffer */
char *readbuf; /* read transfer_buffer */
......@@ -163,7 +162,6 @@ static void usblp_dump(struct usblp *usblp) {
dbg("usblp=0x%p", usblp);
dbg("dev=0x%p", usblp->dev);
dbg("devfs=0x%p", usblp->devfs);
dbg("buf=0x%p", usblp->buf);
dbg("readcount=%d", usblp->readcount);
dbg("ifnum=%d", usblp->ifnum);
......@@ -382,7 +380,7 @@ static int usblp_open(struct inode *inode, struct file *file)
static void usblp_cleanup (struct usblp *usblp)
{
devfs_unregister (usblp->devfs);
devfs_remove ("usb/lp%d", usblp->minor);
usb_deregister_dev (1, usblp->minor);
info("usblp%d: removed", usblp->minor);
......@@ -908,8 +906,7 @@ static int usblp_probe(struct usb_interface *intf,
/* If we have devfs, create with perms=660. */
sprintf(name, "usb/lp%d", usblp->minor);
usblp->devfs = devfs_register(NULL, name,
DEVFS_FL_DEFAULT, USB_MAJOR,
devfs_register(NULL, name, 0, USB_MAJOR,
usblp->minor,
S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP |
S_IWGRP, &usblp_fops, NULL);
......
......@@ -28,8 +28,6 @@
#endif
#include <linux/usb.h>
static devfs_handle_t usb_devfs_handle; /* /dev/usb dir. */
#define MAX_USB_MINORS 256
static struct file_operations *usb_minors[MAX_USB_MINORS];
static spinlock_t minor_lock = SPIN_LOCK_UNLOCKED;
......@@ -75,14 +73,13 @@ int usb_major_init(void)
return -EBUSY;
}
usb_devfs_handle = devfs_mk_dir("usb");
devfs_mk_dir("usb");
return 0;
}
void usb_major_cleanup(void)
{
devfs_unregister(usb_devfs_handle);
devfs_remove("usb");
unregister_chrdev(USB_MAJOR, "usb");
}
......
......@@ -397,6 +397,7 @@
*/
#include <linux/devfs_fs_kernel.h>
#include <asm/byteorder.h>
/*
......@@ -843,7 +844,7 @@ static void destroy_scanner (struct kobject *kobj)
kfree(scn->obuf);
dbg("%s: De-allocating minor:%d", __FUNCTION__, scn->scn_minor);
devfs_unregister(scn->devfs);
devfs_remove("usb/scanner%d", scn->scn_minor - SCN_BASE_MNR);
usb_deregister_dev(1, scn->scn_minor);
usb_free_urb(scn->scn_irq);
usb_put_dev(scn->scn_dev);
......@@ -1105,13 +1106,11 @@ probe_scanner(struct usb_interface *intf,
sprintf(name, "usb/scanner%d", scn->scn_minor - SCN_BASE_MNR);
scn->devfs = devfs_register(NULL, name,
devfs_register(NULL, name,
DEVFS_FL_DEFAULT, USB_MAJOR,
scn->scn_minor,
S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP |
S_IWGRP | S_IROTH | S_IWOTH, &usb_scanner_fops, NULL);
if (scn->devfs == NULL)
dbg("scanner%d: device node registration failed", scn_minor);
info ("USB scanner device (0x%04x/0x%04x) now attached to %s",
dev->descriptor.idVendor, dev->descriptor.idProduct, name);
......
......@@ -40,7 +40,6 @@
#include <linux/ioctl.h>
#include <linux/sched.h>
#include <linux/smp_lock.h>
#include <linux/devfs_fs_kernel.h>
// #define DEBUG
......@@ -336,7 +335,6 @@ static DECLARE_MUTEX (scn_mutex); /* Initializes to unlocked */
struct scn_usb_data {
struct usb_device *scn_dev;
devfs_handle_t devfs; /* devfs device */
struct urb *scn_irq;
unsigned int ifnum; /* Interface number of the USB device */
int scn_minor; /* Scanner minor - used in disconnect() */
......
......@@ -50,7 +50,6 @@ struct hiddev {
int open;
int minor;
wait_queue_head_t wait;
devfs_handle_t devfs;
struct hid_device *hid;
struct hiddev_list *list;
};
......@@ -66,7 +65,6 @@ struct hiddev_list {
};
static struct hiddev *hiddev_table[HIDDEV_MINORS];
static devfs_handle_t hiddev_devfs_handle;
/* forward reference to make our lives easier */
extern struct usb_driver hiddev_driver;
......@@ -229,7 +227,7 @@ static int hiddev_fasync(int fd, struct file *file, int on)
*/
static void hiddev_cleanup(struct hiddev *hiddev)
{
devfs_unregister(hiddev->devfs);
devfs_remove("usb/hid/hiddev%d", hiddev->minor);
usb_deregister_dev(1, hiddev->minor);
hiddev_table[hiddev->minor] = NULL;
kfree(hiddev);
......@@ -716,8 +714,8 @@ int hiddev_connect(struct hid_device *hid)
hiddev->exist = 1;
sprintf(devfs_name, "usb/hid/hiddev%d", minor);
hiddev->devfs = devfs_register(NULL, devfs_name,
DEVFS_FL_DEFAULT, USB_MAJOR, minor + HIDDEV_MINOR_BASE,
devfs_register(NULL, devfs_name, 0,
USB_MAJOR, minor + HIDDEV_MINOR_BASE,
S_IFCHR | S_IRUGO | S_IWUSR, &hiddev_fops, NULL);
hid->minor = minor;
hid->hiddev = hiddev;
......@@ -774,7 +772,7 @@ static /* const */ struct usb_driver hiddev_driver = {
int __init hiddev_init(void)
{
hiddev_devfs_handle = devfs_mk_dir("usb/hid");
devfs_mk_dir("usb/hid");
usb_register(&hiddev_driver);
return 0;
}
......
......@@ -242,7 +242,6 @@ typedef struct
struct semaphore mutex; /* protection in user context */
char name[20]; /* name of the /dev/usb entry */
unsigned int dtindex; /* index in the device table */
devfs_handle_t devfs; /* devfs device node */
struct usb_device * usbdev; /* USB device handle */
int open_count; /* count the number of open character channels */
char dev_desc[AUSI_DLEN];/* for storing a textual description */
......@@ -1972,7 +1971,7 @@ static int auerswald_probe (struct usb_interface *intf,
up (&dev_table_mutex);
/* initialize the devfs node for this device and register it */
cp->devfs = devfs_register(NULL, cp->name, 0, USB_MAJOR,
devfs_register(NULL, cp->name, 0, USB_MAJOR,
AUER_MINOR_BASE + dtindex,
S_IFCHR | S_IRUGO | S_IWUGO,
&auerswald_fops, NULL);
......@@ -2092,7 +2091,7 @@ static void auerswald_disconnect (struct usb_interface *intf)
/* remove our devfs node */
/* Nobody can see this device any more */
devfs_unregister (cp->devfs);
devfs_remove(cp->name);
/* give back our USB minor number */
usb_deregister_dev (1, cp->dtindex);
......
......@@ -156,7 +156,6 @@ struct brlvger_priv {
struct usb_device *dev; /* USB device handle */
struct usb_endpoint_descriptor *in_interrupt;
struct urb *intr_urb;
devfs_handle_t devfs;
int subminor; /* which minor dev #? */
......@@ -374,16 +373,11 @@ brlvger_probe (struct usb_interface *intf,
dbg("Display length: %d", priv->plength);
sprintf(devfs_name, "usb/brlvger%d", priv->subminor);
priv->devfs = devfs_register(NULL, devfs_name,
devfs_register(NULL, devfs_name,
DEVFS_FL_DEFAULT, USB_MAJOR,
BRLVGER_MINOR+priv->subminor,
S_IFCHR |S_IRUSR|S_IWUSR |S_IRGRP|S_IWGRP,
&brlvger_fops, NULL);
if (!priv->devfs) {
#ifdef CONFIG_DEVFS_FS
err("devfs node registration failed");
#endif
}
display_table[i] = priv;
......@@ -420,7 +414,7 @@ brlvger_disconnect(struct usb_interface *intf)
if(priv){
info("Display %d disconnecting", priv->subminor);
devfs_unregister(priv->devfs);
devfs_remove("usb/brlvger%d", priv->subminor);
usb_deregister_dev(1, priv->subminor);
down(&disconnect_sem);
......
......@@ -65,7 +65,6 @@
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 */
......@@ -476,13 +475,11 @@ static int probe_rio(struct usb_interface *intf,
}
dbg("probe_rio: ibuf address:%p", rio->ibuf);
rio->devfs = devfs_register(NULL, "usb/rio500",
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 (rio->devfs == NULL)
dbg("probe_rio: device node registration failed");
init_MUTEX(&(rio->lock));
......@@ -496,7 +493,7 @@ static void disconnect_rio(struct usb_interface *intf)
usb_set_intfdata (intf, NULL);
if (rio) {
devfs_unregister(rio->devfs);
devfs_remove("usb/rio500");
usb_deregister_dev(1, rio->minor);
down(&(rio->lock));
......
......@@ -98,7 +98,6 @@ MODULE_DEVICE_TABLE (usb, skel_table);
struct usb_skel {
struct usb_device * udev; /* save off the usb device pointer */
struct usb_interface * interface; /* the interface for this device */
devfs_handle_t devfs; /* devfs device node */
unsigned char minor; /* the starting minor number for this device */
unsigned char num_ports; /* the number of ports this device has */
char num_interrupt_in; /* number of interrupt in endpoints we have */
......@@ -610,7 +609,7 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i
/* initialize the devfs node for this device and register it */
sprintf(name, "usb/skel%d", dev->minor);
dev->devfs = devfs_register(NULL, name,
devfs = devfs_register(NULL, name,
DEVFS_FL_DEFAULT, USB_MAJOR,
dev->minor,
S_IFCHR | S_IRUSR | S_IWUSR |
......@@ -674,7 +673,7 @@ static void skel_disconnect(struct usb_interface *interface)
minor = dev->minor;
/* remove our devfs node */
devfs_unregister (dev->devfs);
devfs_remove("usb/skel%d", dev->minor);
/* give back our dynamic minor */
usb_deregister_dev (1, minor);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment