aboutsummaryrefslogtreecommitdiffstats
path: root/usb
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2005-12-22 15:22:26 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2005-12-22 15:22:26 -0800
commitd0e4f6d13b33c4e463a4fb91cfecc4d87fa48c94 (patch)
treeb53ae35248e09c94cbd6c6831262625b58012700 /usb
parent87c5263ad6176dc271c0d2f03ffadfe215aa426b (diff)
downloadpatches-d0e4f6d13b33c4e463a4fb91cfecc4d87fa48c94.tar.gz
usb and other stuff
Diffstat (limited to 'usb')
-rw-r--r--usb/usb-fix-buffer-size-limiting-in-skeleton-driver.patch28
-rw-r--r--usb/usb-fix-usb_find_interface-for-ppc64.patch66
-rw-r--r--usb/usb-ioctl-compat-for-usblp.c.patch48
-rw-r--r--usb/usb-make-bias-writeable-in-libusual.patch128
4 files changed, 270 insertions, 0 deletions
diff --git a/usb/usb-fix-buffer-size-limiting-in-skeleton-driver.patch b/usb/usb-fix-buffer-size-limiting-in-skeleton-driver.patch
new file mode 100644
index 0000000000000..21a260b5ac170
--- /dev/null
+++ b/usb/usb-fix-buffer-size-limiting-in-skeleton-driver.patch
@@ -0,0 +1,28 @@
+From ok@artecdesign.ee Thu Dec 22 02:49:16 2005
+Date: Thu, 22 Dec 2005 12:44:52 +0200 (EET)
+From: Olav Kongas <ok@artecdesign.ee>
+To: Greg KH <greg@kroah.com>
+cc: Oliver Neukum <oliver@neukum.org>
+Subject: USB: fix buffer size limiting in skeleton driver
+Message-ID: <Pine.LNX.4.63.0512221242160.15800@pcy.artec.ee>
+
+Fix buffer size limiting.
+
+Signed-off-by: Olav Kongas <ok@artecdesign.ee>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/usb-skeleton.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- gregkh-2.6.orig/drivers/usb/usb-skeleton.c
++++ gregkh-2.6/drivers/usb/usb-skeleton.c
+@@ -166,7 +166,7 @@ static ssize_t skel_write(struct file *f
+ int retval = 0;
+ struct urb *urb = NULL;
+ char *buf = NULL;
+- size_t writesize = max(count, MAX_TRANSFER);
++ size_t writesize = min(count, MAX_TRANSFER);
+
+ dev = (struct usb_skel *)file->private_data;
+
diff --git a/usb/usb-fix-usb_find_interface-for-ppc64.patch b/usb/usb-fix-usb_find_interface-for-ppc64.patch
new file mode 100644
index 0000000000000..4c7e5b64d0ac7
--- /dev/null
+++ b/usb/usb-fix-usb_find_interface-for-ppc64.patch
@@ -0,0 +1,66 @@
+From zaitcev@redhat.com Wed Dec 21 17:27:15 2005
+Date: Wed, 21 Dec 2005 17:24:54 -0800
+From: Pete Zaitcev <zaitcev@redhat.com>
+To: greg@kroah.com
+Subject: usb: fix usb_find_interface for ppc64
+Message-Id: <20051221172454.6cb3d841.zaitcev@redhat.com>
+
+Fix usb_find_interface. You cannot case pointers to int and long on
+a big-endian 64-bitter without consequences.
+
+Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/core/usb.c | 23 +++++++++++++----------
+ 1 file changed, 13 insertions(+), 10 deletions(-)
+
+--- gregkh-2.6.orig/drivers/usb/core/usb.c
++++ gregkh-2.6/drivers/usb/core/usb.c
+@@ -192,20 +192,23 @@ void usb_driver_release_interface(struct
+ iface->condition = USB_INTERFACE_UNBOUND;
+ mark_quiesced(iface);
+ }
++struct find_interface_arg {
++ int minor;
++ struct usb_interface *interface;
++};
+
+ static int __find_interface(struct device * dev, void * data)
+ {
+- struct usb_interface ** ret = (struct usb_interface **)data;
+- struct usb_interface * intf = *ret;
+- int *minor = (int *)data;
++ struct find_interface_arg *arg = data;
++ struct usb_interface *intf;
+
+ /* can't look at usb devices, only interfaces */
+ if (dev->driver == &usb_generic_driver)
+ return 0;
+
+ intf = to_usb_interface(dev);
+- if (intf->minor != -1 && intf->minor == *minor) {
+- *ret = intf;
++ if (intf->minor != -1 && intf->minor == arg->minor) {
++ arg->interface = intf;
+ return 1;
+ }
+ return 0;
+@@ -222,12 +225,12 @@ static int __find_interface(struct devic
+ */
+ struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor)
+ {
+- struct usb_interface *intf = (struct usb_interface *)(long)minor;
+- int ret;
+-
+- ret = driver_for_each_device(&drv->driver, NULL, &intf, __find_interface);
++ struct find_interface_arg argb;
+
+- return ret ? intf : NULL;
++ argb.minor = minor;
++ argb.interface = NULL;
++ driver_for_each_device(&drv->driver, NULL, &argb, __find_interface);
++ return argb.interface;
+ }
+
+ #ifdef CONFIG_HOTPLUG
diff --git a/usb/usb-ioctl-compat-for-usblp.c.patch b/usb/usb-ioctl-compat-for-usblp.c.patch
new file mode 100644
index 0000000000000..6975cae888e69
--- /dev/null
+++ b/usb/usb-ioctl-compat-for-usblp.c.patch
@@ -0,0 +1,48 @@
+From zaitcev@redhat.com Wed Dec 21 17:06:26 2005
+Date: Wed, 21 Dec 2005 17:03:24 -0800
+From: Pete Zaitcev <zaitcev@redhat.com>
+Cc: zaitcev@redhat.com, greg@kroah.com
+Subject: usb: ioctl compat for usblp.c
+Message-Id: <20051221170324.21c57242.zaitcev@redhat.com>
+
+From: David Woodhouse <dwmw2>
+
+David has a G5 with a printer. I am quite surprised that nobody else noticed
+this before. Linus has a G5. Hackers hate printing in general, maybe.
+
+We do not use BKL anymore, because one of code paths had a sleeping call,
+so we had to use a semaphore. I am sure it's safe to use unlocked_ioctl.
+
+The new ioctls return long and retval is int. It looks completely fine to me.
+We never want these extra bits, and the sign extension ought to work right.
+
+Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+--
+
+---
+ drivers/usb/class/usblp.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- gregkh-2.6.orig/drivers/usb/class/usblp.c
++++ gregkh-2.6/drivers/usb/class/usblp.c
+@@ -438,7 +438,7 @@ static unsigned int usblp_poll(struct fi
+ | (!usblp->wcomplete ? 0 : POLLOUT | POLLWRNORM);
+ }
+
+-static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
++static long usblp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+ {
+ struct usblp *usblp = file->private_data;
+ int length, err, i;
+@@ -838,7 +838,8 @@ static struct file_operations usblp_fops
+ .read = usblp_read,
+ .write = usblp_write,
+ .poll = usblp_poll,
+- .ioctl = usblp_ioctl,
++ .unlocked_ioctl = usblp_ioctl,
++ .compat_ioctl = usblp_ioctl,
+ .open = usblp_open,
+ .release = usblp_release,
+ };
diff --git a/usb/usb-make-bias-writeable-in-libusual.patch b/usb/usb-make-bias-writeable-in-libusual.patch
new file mode 100644
index 0000000000000..01ccf1185d555
--- /dev/null
+++ b/usb/usb-make-bias-writeable-in-libusual.patch
@@ -0,0 +1,128 @@
+From zaitcev@redhat.com Fri Dec 16 00:43:58 2005
+Date: Fri, 16 Dec 2005 00:39:36 -0800
+From: Pete Zaitcev <zaitcev@redhat.com>
+To: greg@kroah.com
+Subject: usb: make bias writeable in libusual
+Message-Id: <20051216003936.226e6543.zaitcev@redhat.com>
+
+Make the bias parameter writeable. Writing the parameter does not trigger
+a rebind of currently attached storage devices.
+
+Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/storage/libusual.c | 53 ++++++++++++++++++++---------------------
+ 1 file changed, 27 insertions(+), 26 deletions(-)
+
+--- gregkh-2.6.orig/drivers/usb/storage/libusual.c
++++ gregkh-2.6/drivers/usb/storage/libusual.c
+@@ -24,10 +24,9 @@ static DEFINE_SPINLOCK(usu_lock);
+ /*
+ */
+ #define USB_US_DEFAULT_BIAS USB_US_TYPE_STOR
++static atomic_t usu_bias = ATOMIC_INIT(USB_US_DEFAULT_BIAS);
+
+ #define BIAS_NAME_SIZE (sizeof("usb-storage"))
+-static char bias[BIAS_NAME_SIZE];
+-static int usb_usual_bias;
+ static const char *bias_names[3] = { "none", "usb-storage", "ub" };
+
+ static DECLARE_MUTEX_LOCKED(usu_init_notify);
+@@ -35,7 +34,6 @@ static DECLARE_COMPLETION(usu_end_notify
+ static atomic_t total_threads = ATOMIC_INIT(0);
+
+ static int usu_probe_thread(void *arg);
+-static int parse_bias(const char *bias_s);
+
+ /*
+ * The table.
+@@ -107,7 +105,7 @@ int usb_usual_check_type(const struct us
+ if (id_type == caller_type)
+ return 0;
+ /* Drivers grab devices biased to them */
+- if (id_type == USB_US_TYPE_NONE && caller_type == usb_usual_bias)
++ if (id_type == USB_US_TYPE_NONE && caller_type == atomic_read(&usu_bias))
+ return 0;
+ return -ENODEV;
+ }
+@@ -124,7 +122,7 @@ static int usu_probe(struct usb_interfac
+
+ type = USB_US_TYPE(id->driver_info);
+ if (type == 0)
+- type = usb_usual_bias;
++ type = atomic_read(&usu_bias);
+
+ spin_lock_irqsave(&usu_lock, flags);
+ if ((stat[type].fls & (USU_MOD_FL_THREAD|USU_MOD_FL_PRESENT)) != 0) {
+@@ -205,9 +203,6 @@ static int __init usb_usual_init(void)
+ {
+ int rc;
+
+- bias[BIAS_NAME_SIZE-1] = 0;
+- usb_usual_bias = parse_bias(bias);
+-
+ rc = usb_register(&usu_driver);
+ up(&usu_init_notify);
+ return rc;
+@@ -230,36 +225,42 @@ static void __exit usb_usual_exit(void)
+
+ /*
+ * Validate and accept the bias parameter.
+- * Maybe make an sysfs method later. XXX
+ */
+-static int parse_bias(const char *bias_s)
++static int usu_set_bias(const char *bias_s, struct kernel_param *kp)
+ {
+ int i;
++ int len;
+ int bias_n = 0;
+
+- if (bias_s[0] == 0 || bias_s[0] == ' ') {
+- bias_n = USB_US_DEFAULT_BIAS;
+- } else {
+- for (i = 1; i < 3; i++) {
+- if (strcmp(bias_s, bias_names[i]) == 0) {
+- bias_n = i;
+- break;
+- }
+- }
+- if (bias_n == 0) {
+- bias_n = USB_US_DEFAULT_BIAS;
+- printk(KERN_INFO
+- "libusual: unknown bias \"%s\", using \"%s\"\n",
+- bias_s, bias_names[bias_n]);
++ len = strlen(bias_s);
++ if (len == 0)
++ return -EDOM;
++ if (bias_s[len-1] == '\n')
++ --len;
++
++ for (i = 1; i < 3; i++) {
++ if (strncmp(bias_s, bias_names[i], len) == 0) {
++ bias_n = i;
++ break;
+ }
+ }
+- return bias_n;
++ if (bias_n == 0)
++ return -EINVAL;
++
++ atomic_set(&usu_bias, bias_n);
++ return 0;
++}
++
++static int usu_get_bias(char *buffer, struct kernel_param *kp)
++{
++ return strlen(strcpy(buffer, bias_names[atomic_read(&usu_bias)]));
+ }
+
+ module_init(usb_usual_init);
+ module_exit(usb_usual_exit);
+
+-module_param_string(bias, bias, BIAS_NAME_SIZE, S_IRUGO|S_IWUSR);
++module_param_call(bias, usu_set_bias, usu_get_bias, NULL, S_IRUGO|S_IWUSR);
++__MODULE_PARM_TYPE(bias, "string");
+ MODULE_PARM_DESC(bias, "Bias to usb-storage or ub");
+
+ MODULE_LICENSE("GPL");