# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#                  ChangeSet    1.531.1.3 -> 1.531.1.4
#       drivers/usb/image/mdc800.c      1.15    -> 1.16   
#       drivers/usb/core/drivers.c      1.6     -> 1.7    
#       drivers/usb/misc/rio500.c       1.10    -> 1.11   
#       drivers/usb/class/printer.c     1.19    -> 1.20   
#       drivers/usb/image/scanner.c     1.17    -> 1.18   
#       drivers/usb/media/dsbr100.c     1.10    -> 1.11   
#       drivers/usb/misc/auerswald.c    1.9     -> 1.10   
#       drivers/usb/input/hiddev.c      1.9     -> 1.10   
#        include/linux/usb.h    1.27    -> 1.28   
#       drivers/usb/usb-skeleton.c      1.9     -> 1.10   
#       drivers/usb/core/usb.c  1.43    -> 1.44   
#       drivers/usb/media/dabusb.c      1.13    -> 1.14   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/04/19      [EMAIL PROTECTED]  1.531.1.4
# USB core
# 
# Took out the limitation that drivers had to take up 16 minors.  Now
# they can use only 1 if they want to.
# --------------------------------------------
#
diff -Nru a/drivers/usb/class/printer.c b/drivers/usb/class/printer.c
--- a/drivers/usb/class/printer.c       Fri Apr 19 09:30:46 2002
+++ b/drivers/usb/class/printer.c       Fri Apr 19 09:30:46 2002
@@ -1090,6 +1090,7 @@
        disconnect:     usblp_disconnect,
        fops:           &usblp_fops,
        minor:          USBLP_MINOR_BASE,
+       num_minors:     USBLP_MINORS,
        id_table:       usblp_ids,
 };
 
diff -Nru a/drivers/usb/core/drivers.c b/drivers/usb/core/drivers.c
--- a/drivers/usb/core/drivers.c        Fri Apr 19 09:30:46 2002
+++ b/drivers/usb/core/drivers.c        Fri Apr 19 09:30:46 2002
@@ -71,8 +71,10 @@
                int minor = driver->fops ? driver->minor : -1;
                if (minor == -1)
                        start += sprintf (start, "         %s\n", driver->name);
+               else if (driver->num_minors == 1)
+                       start += sprintf (start, "    %3d: %s\n", minor, driver->name);
                else
-                       start += sprintf (start, "%3d-%3d: %s\n", minor, minor + 15, 
driver->name);
+                       start += sprintf (start, "%3d-%3d: %s\n", minor, minor + 
+driver->num_minors - 1, driver->name);
                if (start > end) {
                        start += sprintf(start, "(truncated)\n");
                        break;
diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c    Fri Apr 19 09:30:47 2002
+++ b/drivers/usb/core/usb.c    Fri Apr 19 09:30:47 2002
@@ -59,7 +59,7 @@
 
 devfs_handle_t usb_devfs_handle;       /* /dev/usb dir. */
 
-static struct usb_driver *usb_minors[16];
+static struct usb_driver *usb_minors[256];
 
 /**
  *     usb_register - register a USB driver
@@ -72,12 +72,17 @@
  */
 int usb_register(struct usb_driver *new_driver)
 {
+       int i;
+
        if (new_driver->fops != NULL) {
-               if (usb_minors[new_driver->minor/16]) {
-                        err("error registering %s driver", new_driver->name);
-                       return -EINVAL;
+               for (i = new_driver->minor; i < new_driver->minor + 
+new_driver->num_minors; ++i) {
+                       if (usb_minors[i]) {
+                               err("error registering %s driver", new_driver->name);
+                               return -EINVAL;
+                       }
                }
-               usb_minors[new_driver->minor/16] = new_driver;
+               for (i = new_driver->minor; i < new_driver->minor + 
+new_driver->num_minors; ++i)
+                       usb_minors[i] = new_driver;
        }
 
        info("registered new driver %s", new_driver->name);
@@ -172,10 +177,12 @@
 void usb_deregister(struct usb_driver *driver)
 {
        struct list_head *tmp;
+       int i;
 
        info("deregistering driver %s", driver->name);
        if (driver->fops != NULL)
-               usb_minors[driver->minor/16] = NULL;
+               for (i = driver->minor; i < driver->minor + driver->num_minors; ++i)
+                       usb_minors[i] = NULL;
 
        /*
         * first we remove the driver, to be sure it doesn't get used by
@@ -2517,7 +2524,7 @@
 static int usb_open(struct inode * inode, struct file * file)
 {
        int minor = minor(inode->i_rdev);
-       struct usb_driver *c = usb_minors[minor/16];
+       struct usb_driver *c = usb_minors[minor];
        int err = -ENODEV;
        struct file_operations *old_fops, *new_fops = NULL;
 
diff -Nru a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c
--- a/drivers/usb/image/mdc800.c        Fri Apr 19 09:30:46 2002
+++ b/drivers/usb/image/mdc800.c        Fri Apr 19 09:30:46 2002
@@ -933,6 +933,7 @@
        disconnect:     mdc800_usb_disconnect,
        fops:           &mdc800_device_ops,
        minor:          MDC800_DEVICE_MINOR_BASE,
+       num_minors:     1,
        id_table:       mdc800_table
 };
 
diff -Nru a/drivers/usb/image/scanner.c b/drivers/usb/image/scanner.c
--- a/drivers/usb/image/scanner.c       Fri Apr 19 09:30:47 2002
+++ b/drivers/usb/image/scanner.c       Fri Apr 19 09:30:47 2002
@@ -1100,6 +1100,7 @@
        disconnect:     disconnect_scanner,
        fops:           &usb_scanner_fops,
        minor:          SCN_BASE_MNR,
+       num_minors:     SCN_MAX_MNR,
        id_table:       NULL, /* This would be scanner_device_ids, but we
                                 need to check every USB device, in case
                                 we match a user defined vendor/product ID. */
diff -Nru a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c
--- a/drivers/usb/input/hiddev.c        Fri Apr 19 09:30:47 2002
+++ b/drivers/usb/input/hiddev.c        Fri Apr 19 09:30:47 2002
@@ -678,10 +678,11 @@
 
 
 static /* const */ struct usb_driver hiddev_driver = {
-       name:   "hiddev",
-       probe:  hiddev_usbd_probe,
-       fops:   &hiddev_fops,
-       minor:  HIDDEV_MINOR_BASE
+       name:           "hiddev",
+       probe:          hiddev_usbd_probe,
+       fops:           &hiddev_fops,
+       minor:          HIDDEV_MINOR_BASE,
+       num_minors:     HIDDEV_MINORS,
 };
 
 int __init hiddev_init(void)
diff -Nru a/drivers/usb/media/dabusb.c b/drivers/usb/media/dabusb.c
--- a/drivers/usb/media/dabusb.c        Fri Apr 19 09:30:47 2002
+++ b/drivers/usb/media/dabusb.c        Fri Apr 19 09:30:47 2002
@@ -801,6 +801,7 @@
        disconnect:     dabusb_disconnect,
        fops:           &dabusb_fops,
        minor:          DABUSB_MINOR,
+       num_minors:     NRDABUSB,
        id_table:       dabusb_ids,
 };
 
diff -Nru a/drivers/usb/media/dsbr100.c b/drivers/usb/media/dsbr100.c
--- a/drivers/usb/media/dsbr100.c       Fri Apr 19 09:30:47 2002
+++ b/drivers/usb/media/dsbr100.c       Fri Apr 19 09:30:47 2002
@@ -128,8 +128,6 @@
        name:           "dsbr100",
        probe:          usb_dsbr100_probe,
        disconnect:     usb_dsbr100_disconnect,
-       fops:           NULL,
-       minor:          0,
        id_table:       usb_dsbr100_table,
 };
 
diff -Nru a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
--- a/drivers/usb/misc/auerswald.c      Fri Apr 19 09:30:47 2002
+++ b/drivers/usb/misc/auerswald.c      Fri Apr 19 09:30:47 2002
@@ -2138,6 +2138,7 @@
        disconnect:     auerswald_disconnect,
        fops:           &auerswald_fops,
        minor:          AUER_MINOR_BASE,
+       num_minors:     AUER_MAX_DEVICES,
        id_table:       auerswald_ids,
 };
 
diff -Nru a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c
--- a/drivers/usb/misc/rio500.c Fri Apr 19 09:30:46 2002
+++ b/drivers/usb/misc/rio500.c Fri Apr 19 09:30:46 2002
@@ -517,6 +517,7 @@
        disconnect:     disconnect_rio,
        fops:           &usb_rio_fops,
        minor:          RIO_MINOR,
+       num_minors:     1,
        id_table:       rio_table,
 };
 
diff -Nru a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
--- a/drivers/usb/usb-skeleton.c        Fri Apr 19 09:30:47 2002
+++ b/drivers/usb/usb-skeleton.c        Fri Apr 19 09:30:47 2002
@@ -187,6 +187,7 @@
        disconnect:     skel_disconnect,
        fops:           &skel_fops,
        minor:          USB_SKEL_MINOR_BASE,
+       num_minors:     MAX_DEVICES,
        id_table:       skel_table,
 };
 
diff -Nru a/include/linux/usb.h b/include/linux/usb.h
--- a/include/linux/usb.h       Fri Apr 19 09:30:47 2002
+++ b/include/linux/usb.h       Fri Apr 19 09:30:47 2002
@@ -493,6 +493,8 @@
  * @minor: Used with fops to simplify creating USB character devices.
  *     Such drivers have sixteen character devices, using the USB
  *     major number and starting with this minor number.
+ * @num_minors: Used with minor to specify how many minors are used by
+ *     this driver.
  * @ioctl: Used for drivers that want to talk to userspace through
  *     the "usbfs" filesystem.  This lets devices provide ways to
  *     expose information to user space regardless of where they
@@ -534,6 +536,7 @@
 
        struct file_operations *fops;
        int minor;
+       int num_minors;
 
        struct semaphore serialize;
 

_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to