diff options
| author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-05-08 20:49:51 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-05-08 20:49:51 -0700 |
| commit | 6e532e159cc2fbb3a7ee024f4c2a35c7a150d40c (patch) | |
| tree | 64c5aea0eabf3933ff38f85dce5b7b8feb9846ce /usb.current | |
| parent | e8593fcdd1bd4fc1992f065951ae4545cf7e6cd5 (diff) | |
| download | patches-6e532e159cc2fbb3a7ee024f4c2a35c7a150d40c.tar.gz | |
rename driver-core.next -> driver-core.current and the same thing for usb.next
Diffstat (limited to 'usb.current')
19 files changed, 2536 insertions, 0 deletions
diff --git a/usb.current/usb-add-association.h.patch b/usb.current/usb-add-association.h.patch new file mode 100644 index 00000000000000..28875baa051382 --- /dev/null +++ b/usb.current/usb-add-association.h.patch @@ -0,0 +1,173 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Fri, 25 Apr 2008 19:23:16 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: add association.h + +This will be used by the wireless usb code, as well as potentially other +USB code. + +Originally based on some .c code written by Inaky Perez-Gonzalez +<inaky.perez-gonzalez@intel.com> + +Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> +Cc: David Brownell <david-b@pacbell.net> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + include/linux/usb/association.h | 150 ++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 150 insertions(+) + +--- /dev/null ++++ b/include/linux/usb/association.h +@@ -0,0 +1,150 @@ ++/* ++ * Wireless USB - Cable Based Association ++ * ++ * Copyright (C) 2006 Intel Corporation ++ * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License version ++ * 2 as published by the Free Software Foundation. ++ * ++ */ ++#ifndef __LINUX_USB_ASSOCIATION_H ++#define __LINUX_USB_ASSOCIATION_H ++ ++ ++/* ++ * Association attributes ++ * ++ * Association Models Supplement to WUSB 1.0 T[3-1] ++ * ++ * Each field in the structures has it's ID, it's length and then the ++ * value. This is the actual definition of the field's ID and its ++ * length. ++ */ ++struct wusb_am_attr { ++ __u8 id; ++ __u8 len; ++}; ++ ++/* Different fields defined by the spec */ ++#define WUSB_AR_AssociationTypeId { .id = 0x0000, .len = 2 } ++#define WUSB_AR_AssociationSubTypeId { .id = 0x0001, .len = 2 } ++#define WUSB_AR_Length { .id = 0x0002, .len = 4 } ++#define WUSB_AR_AssociationStatus { .id = 0x0004, .len = 4 } ++#define WUSB_AR_LangID { .id = 0x0008, .len = 2 } ++#define WUSB_AR_DeviceFriendlyName { .id = 0x000b, .len = 64 } /* max */ ++#define WUSB_AR_HostFriendlyName { .id = 0x000c, .len = 64 } /* max */ ++#define WUSB_AR_CHID { .id = 0x1000, .len = 16 } ++#define WUSB_AR_CDID { .id = 0x1001, .len = 16 } ++#define WUSB_AR_ConnectionContext { .id = 0x1002, .len = 48 } ++#define WUSB_AR_BandGroups { .id = 0x1004, .len = 2 } ++ ++/* CBAF Control Requests (AMS1.0[T4-1] */ ++enum { ++ CBAF_REQ_GET_ASSOCIATION_INFORMATION = 0x01, ++ CBAF_REQ_GET_ASSOCIATION_REQUEST, ++ CBAF_REQ_SET_ASSOCIATION_RESPONSE ++}; ++ ++/* ++ * CBAF USB-interface defitions ++ * ++ * No altsettings, one optional interrupt endpoint. ++ */ ++enum { ++ CBAF_IFACECLASS = 0xef, ++ CBAF_IFACESUBCLASS = 0x03, ++ CBAF_IFACEPROTOCOL = 0x01, ++}; ++ ++/* Association Information (AMS1.0[T4-3]) */ ++struct wusb_cbaf_assoc_info { ++ __le16 Length; ++ __u8 NumAssociationRequests; ++ __le16 Flags; ++ __u8 AssociationRequestsArray[]; ++} __attribute__((packed)); ++ ++/* Association Request (AMS1.0[T4-4]) */ ++struct wusb_cbaf_assoc_request { ++ __u8 AssociationDataIndex; ++ __u8 Reserved; ++ __le16 AssociationTypeId; ++ __le16 AssociationSubTypeId; ++ __le32 AssociationTypeInfoSize; ++} __attribute__((packed)); ++ ++enum { ++ AR_TYPE_WUSB = 0x0001, ++ AR_TYPE_WUSB_RETRIEVE_HOST_INFO = 0x0000, ++ AR_TYPE_WUSB_ASSOCIATE = 0x0001, ++}; ++ ++/* Association Attribute header (AMS1.0[3.8]) */ ++struct wusb_cbaf_attr_hdr { ++ __le16 id; ++ __le16 len; ++} __attribute__((packed)); ++ ++/* Host Info (AMS1.0[T4-7]) (yeah, more headers and fields...) */ ++struct wusb_cbaf_host_info { ++ struct wusb_cbaf_attr_hdr AssociationTypeId_hdr; ++ __le16 AssociationTypeId; ++ struct wusb_cbaf_attr_hdr AssociationSubTypeId_hdr; ++ __le16 AssociationSubTypeId; ++ struct wusb_cbaf_attr_hdr CHID_hdr; ++ struct wusb_ckhdid CHID; ++ struct wusb_cbaf_attr_hdr LangID_hdr; ++ __le16 LangID; ++ struct wusb_cbaf_attr_hdr HostFriendlyName_hdr; ++ __u8 HostFriendlyName[]; ++} __attribute__((packed)); ++ ++/* Device Info (AMS1.0[T4-8]) ++ * ++ * I still don't get this tag'n'header stuff for each goddamn ++ * field... ++ */ ++struct wusb_cbaf_device_info { ++ struct wusb_cbaf_attr_hdr Length_hdr; ++ __le32 Length; ++ struct wusb_cbaf_attr_hdr CDID_hdr; ++ struct wusb_ckhdid CDID; ++ struct wusb_cbaf_attr_hdr BandGroups_hdr; ++ __le16 BandGroups; ++ struct wusb_cbaf_attr_hdr LangID_hdr; ++ __le16 LangID; ++ struct wusb_cbaf_attr_hdr DeviceFriendlyName_hdr; ++ __u8 DeviceFriendlyName[]; ++} __attribute__((packed)); ++ ++/* Connection Context; CC_DATA - Success case (AMS1.0[T4-9]) */ ++struct wusb_cbaf_cc_data { ++ struct wusb_cbaf_attr_hdr AssociationTypeId_hdr; ++ __le16 AssociationTypeId; ++ struct wusb_cbaf_attr_hdr AssociationSubTypeId_hdr; ++ __le16 AssociationSubTypeId; ++ struct wusb_cbaf_attr_hdr Length_hdr; ++ __le32 Length; ++ struct wusb_cbaf_attr_hdr ConnectionContext_hdr; ++ struct wusb_ckhdid CHID; ++ struct wusb_ckhdid CDID; ++ struct wusb_ckhdid CK; ++ struct wusb_cbaf_attr_hdr BandGroups_hdr; ++ __le16 BandGroups; ++} __attribute__((packed)); ++ ++/* CC_DATA - Failure case (AMS1.0[T4-10]) */ ++struct wusb_cbaf_cc_data_fail { ++ struct wusb_cbaf_attr_hdr AssociationTypeId_hdr; ++ __le16 AssociationTypeId; ++ struct wusb_cbaf_attr_hdr AssociationSubTypeId_hdr; ++ __le16 AssociationSubTypeId; ++ struct wusb_cbaf_attr_hdr Length_hdr; ++ __le16 Length; ++ struct wusb_cbaf_attr_hdr AssociationStatus_hdr; ++ __u32 AssociationStatus; ++} __attribute__((packed)); ++ ++#endif /* __LINUX_USB_ASSOCIATION_H */ diff --git a/usb.current/usb-add-new-moto_modem-driver-for-some-morotola-phones.patch b/usb.current/usb-add-new-moto_modem-driver-for-some-morotola-phones.patch new file mode 100644 index 00000000000000..37aada3ff7fd7b --- /dev/null +++ b/usb.current/usb-add-new-moto_modem-driver-for-some-morotola-phones.patch @@ -0,0 +1,120 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Fri, 2 May 2008 12:02:20 -0700 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: add new moto_modem driver for some Morotola phones + +This should work on a KRZR K1m, and some other Motorola phones that do +not use the "standard" cdc ACM protocol to talk to USB hosts. + +Tested-by: Jeff Garzik <jeff@garzik.org> +Cc: Jiang Dejun <a5652c@motorola.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/Kconfig | 9 +++++ + drivers/usb/serial/Makefile | 1 + drivers/usb/serial/moto_modem.c | 70 ++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 80 insertions(+) + +--- a/drivers/usb/serial/Kconfig ++++ b/drivers/usb/serial/Kconfig +@@ -447,6 +447,15 @@ config USB_SERIAL_MOS7840 + To compile this driver as a module, choose M here: the + module will be called mos7840. If unsure, choose N. + ++config USB_SERIAL_MOTOROLA ++ tristate "USB Motorola Phone modem driver" ++ ---help--- ++ Say Y here if you want to use a Motorola phone with a USB ++ connector as a modem link. ++ ++ To compile this driver as a module, choose M here: the ++ module will be called moto_modem. If unsure, choose N. ++ + config USB_SERIAL_NAVMAN + tristate "USB Navman GPS device" + help +--- a/drivers/usb/serial/Makefile ++++ b/drivers/usb/serial/Makefile +@@ -39,6 +39,7 @@ obj-$(CONFIG_USB_SERIAL_KOBIL_SCT) += k + obj-$(CONFIG_USB_SERIAL_MCT_U232) += mct_u232.o + obj-$(CONFIG_USB_SERIAL_MOS7720) += mos7720.o + obj-$(CONFIG_USB_SERIAL_MOS7840) += mos7840.o ++obj-$(CONFIG_USB_SERIAL_MOTOROLA) += moto_modem.o + obj-$(CONFIG_USB_SERIAL_NAVMAN) += navman.o + obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o + obj-$(CONFIG_USB_SERIAL_OPTION) += option.o +--- /dev/null ++++ b/drivers/usb/serial/moto_modem.c +@@ -0,0 +1,70 @@ ++/* ++ * Motorola USB Phone driver ++ * ++ * Copyright (C) 2008 Greg Kroah-Hartman <greg@kroah.com> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * {sigh} ++ * Mororola should be using the CDC ACM USB spec, but instead ++ * they try to just "do their own thing"... This driver should handle a ++ * few phones in which a basic "dumb serial connection" is needed to be ++ * able to get a connection through to them. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/init.h> ++#include <linux/tty.h> ++#include <linux/module.h> ++#include <linux/usb.h> ++#include <linux/usb/serial.h> ++ ++static struct usb_device_id id_table [] = { ++ { USB_DEVICE(0x05c6, 0x3197) }, /* unknown Motorola phone */ ++ { USB_DEVICE(0x0c44, 0x0022) }, /* unknown Mororola phone */ ++ { USB_DEVICE(0x22b8, 0x2a64) }, /* Motorola KRZR K1m */ ++ { }, ++}; ++MODULE_DEVICE_TABLE(usb, id_table); ++ ++static struct usb_driver moto_driver = { ++ .name = "moto-modem", ++ .probe = usb_serial_probe, ++ .disconnect = usb_serial_disconnect, ++ .id_table = id_table, ++ .no_dynamic_id = 1, ++}; ++ ++static struct usb_serial_driver moto_device = { ++ .driver = { ++ .owner = THIS_MODULE, ++ .name = "moto-modem", ++ }, ++ .id_table = id_table, ++ .num_ports = 1, ++}; ++ ++static int __init moto_init(void) ++{ ++ int retval; ++ ++ retval = usb_serial_register(&moto_device); ++ if (retval) ++ return retval; ++ retval = usb_register(&moto_driver); ++ if (retval) ++ usb_serial_deregister(&moto_device); ++ return retval; ++} ++ ++static void __exit moto_exit(void) ++{ ++ usb_deregister(&moto_driver); ++ usb_serial_deregister(&moto_device); ++} ++ ++module_init(moto_init); ++module_exit(moto_exit); ++MODULE_LICENSE("GPL"); diff --git a/usb.current/usb-add-telstra-nextg-cdma-id-to-option-driver.patch b/usb.current/usb-add-telstra-nextg-cdma-id-to-option-driver.patch new file mode 100644 index 00000000000000..b4fab931b0103e --- /dev/null +++ b/usb.current/usb-add-telstra-nextg-cdma-id-to-option-driver.patch @@ -0,0 +1,25 @@ +From foo@baz Tue Apr 9 12:12:43 2002 +Date: Thu, 08 May 2008 23:03:04 +0200 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: USB: add Telstra NextG CDMA id to option driver + +As reported by Magnus Boman <captain.magnus@opensuse.org> + +Cc: Magnus Boman <captain.magnus@opensuse.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/option.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -301,6 +301,7 @@ static struct usb_device_id option_ids[] + { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, + { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ + { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */ ++ { USB_DEVICE(0x19d2, 0x0001) }, /* Telstra NextG CDMA */ + { } /* Terminating entry */ + }; + MODULE_DEVICE_TABLE(usb, option_ids); diff --git a/usb.current/usb-add-zoom-telephonics-model-3095f-v.92-usb-mini-external-modem-to-cdc-acm.patch b/usb.current/usb-add-zoom-telephonics-model-3095f-v.92-usb-mini-external-modem-to-cdc-acm.patch new file mode 100644 index 00000000000000..ff622c37260883 --- /dev/null +++ b/usb.current/usb-add-zoom-telephonics-model-3095f-v.92-usb-mini-external-modem-to-cdc-acm.patch @@ -0,0 +1,38 @@ +From linux-usb-owner@vger.kernel.org Sat May 3 16:25:09 2008 +From: Iain McFarlane <iain@imcfarla.homelinux.net> +Date: Sun, 4 May 2008 00:13:49 +0100 +Subject: USB: add Zoom Telephonics Model 3095F V.92 USB Mini External modem to cdc-acm +To: oliver@neukum.name +Cc: linux-usb@vger.kernel.org +Message-ID: <200805040013.49271.iain@imcfarla.homelinux.net> +Content-Disposition: inline + + +The patch below is a necessary workaround to support the Zoom Telephonics Model 3095F V.92 USB Mini External modem, which fails to initialise properly during normal probing thus: + +May 3 22:53:00 imcfarla kernel: drivers/usb/class/cdc-acm.c: Zero length descriptor references +May 3 22:53:00 imcfarla kernel: cdc_acm: probe of 5-2:1.0 failed with error -22 + +Adding the patch below causes the probing section to be skipped, and the modem +then initialises correctly. + +Signed-off-by: Iain McFarlane <iain@imcfarla.homelinux.net> +Acked-by: Oliver Neukum <oneukum@suse.de> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/class/cdc-acm.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/usb/class/cdc-acm.c ++++ b/drivers/usb/class/cdc-acm.c +@@ -1248,6 +1248,9 @@ static struct usb_device_id acm_ids[] = + { USB_DEVICE(0x22b8, 0x7000), /* Motorola Q Phone */ + .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ + }, ++ { USB_DEVICE(0x0803, 0x3095), /* Zoom Telephonics Model 3095F USB MODEM */ ++ .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ ++ }, + + /* control interfaces with various AT-command sets */ + { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, diff --git a/usb.current/usb-c67x00-build-fix.patch b/usb.current/usb-c67x00-build-fix.patch new file mode 100644 index 00000000000000..50d87f201804fa --- /dev/null +++ b/usb.current/usb-c67x00-build-fix.patch @@ -0,0 +1,31 @@ +From linux-usb-owner@vger.kernel.org Sun May 4 14:38:01 2008 +From: maximilian attems <max@stro.at> +Date: Sun, 4 May 2008 23:36:03 +0200 +Subject: USB: c67x00 build fix +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: Peter Korsgaard <jacmet@sunsite.dk>, linux-usb@vger.kernel.org, maximilian attems <max@stro.at> +Message-ID: <1209936963-17600-1-git-send-email-max@stro.at> + + +drivers/usb/c67x00/c67x00-ll-hpi.c: In function `ll_recv_msg': +drivers/usb/c67x00/c67x00-ll-hpi.c:243: error: `HZ' undeclared (first use in this function) + +Signed-off-by: maximilian attems <max@stro.at> +Acked-by: Peter Korsgaard <jacmet@sunsite.dk> +Cc: Toralf Förster <toralf.foerster@gmx.de> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/c67x00/c67x00-ll-hpi.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/usb/c67x00/c67x00-ll-hpi.c ++++ b/drivers/usb/c67x00/c67x00-ll-hpi.c +@@ -24,6 +24,7 @@ + #include <asm/byteorder.h> + #include <linux/io.h> + #include <linux/usb/c67x00.h> ++#include <linux/jiffies.h> + #include "c67x00.h" + + #define COMM_REGS 14 diff --git a/usb.current/usb-create-attributes-before-sending-uevent.patch b/usb.current/usb-create-attributes-before-sending-uevent.patch new file mode 100644 index 00000000000000..8887d5ddbce424 --- /dev/null +++ b/usb.current/usb-create-attributes-before-sending-uevent.patch @@ -0,0 +1,329 @@ +From stern+48120c40@rowland.harvard.edu Tue May 6 23:27:50 2008 +From: Alan Stern <stern@rowland.harvard.edu> +Date: Wed, 30 Apr 2008 15:37:19 -0400 (EDT) +Subject: USB: create attributes before sending uevent +To: Greg KH <greg@kroah.com> +Cc: Kay Sievers <kay.sievers@vrfy.org>, USB list <linux-usb@vger.kernel.org> +Message-ID: <Pine.LNX.4.44L0.0804301535210.3004-100000@iolanthe.rowland.org> + + +This patch (as1087d) fixes a long-standing problem in usbcore: Device, +interface, and endpoint attributes aren't added until _after_ the +creation uevent has already been broadcast. + +Unfortunately there are a few attributes which cannot be created that +early. The "descriptors" attribute is binary and so must be created +separately. The power-management attributes can't be created until +the dev/power/ group exists. And the interface string can vary from +one altsetting to another, so it has to be created dynamically. + +Signed-off-by: Alan Stern <stern@rowland.harvard.edu> +Cc: Kay Sievers <kay.sievers@vrfy.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/core/endpoint.c | 11 +-- + drivers/usb/core/message.c | 1 + drivers/usb/core/sysfs.c | 137 +++++++++++++++++++++++++++----------------- + drivers/usb/core/usb.c | 1 + drivers/usb/core/usb.h | 4 + + 5 files changed, 96 insertions(+), 58 deletions(-) + +--- a/drivers/usb/core/endpoint.c ++++ b/drivers/usb/core/endpoint.c +@@ -156,6 +156,10 @@ static struct attribute *ep_dev_attrs[] + static struct attribute_group ep_dev_attr_grp = { + .attrs = ep_dev_attrs, + }; ++static struct attribute_group *ep_dev_groups[] = { ++ &ep_dev_attr_grp, ++ NULL ++}; + + static int usb_endpoint_major_init(void) + { +@@ -298,6 +302,7 @@ int usb_create_ep_files(struct device *p + + ep_dev->desc = &endpoint->desc; + ep_dev->udev = udev; ++ ep_dev->dev.groups = ep_dev_groups; + ep_dev->dev.devt = MKDEV(usb_endpoint_major, ep_dev->minor); + ep_dev->dev.class = ep_class->class; + ep_dev->dev.parent = parent; +@@ -309,9 +314,6 @@ int usb_create_ep_files(struct device *p + retval = device_register(&ep_dev->dev); + if (retval) + goto error_chrdev; +- retval = sysfs_create_group(&ep_dev->dev.kobj, &ep_dev_attr_grp); +- if (retval) +- goto error_group; + + /* create the symlink to the old-style "ep_XX" directory */ + sprintf(name, "ep_%02x", endpoint->desc.bEndpointAddress); +@@ -322,8 +324,6 @@ int usb_create_ep_files(struct device *p + return retval; + + error_link: +- sysfs_remove_group(&ep_dev->dev.kobj, &ep_dev_attr_grp); +-error_group: + device_unregister(&ep_dev->dev); + destroy_endpoint_class(); + return retval; +@@ -348,7 +348,6 @@ void usb_remove_ep_files(struct usb_host + + sprintf(name, "ep_%02x", endpoint->desc.bEndpointAddress); + sysfs_remove_link(&ep_dev->dev.parent->kobj, name); +- sysfs_remove_group(&ep_dev->dev.kobj, &ep_dev_attr_grp); + device_unregister(&ep_dev->dev); + endpoint->ep_dev = NULL; + destroy_endpoint_class(); +--- a/drivers/usb/core/message.c ++++ b/drivers/usb/core/message.c +@@ -1607,6 +1607,7 @@ free_interfaces: + intf->dev.driver = NULL; + intf->dev.bus = &usb_bus_type; + intf->dev.type = &usb_if_device_type; ++ intf->dev.groups = usb_interface_groups; + intf->dev.dma_mask = dev->dev.dma_mask; + device_initialize(&intf->dev); + mark_quiesced(intf); +--- a/drivers/usb/core/sysfs.c ++++ b/drivers/usb/core/sysfs.c +@@ -538,6 +538,46 @@ static struct attribute_group dev_attr_g + .attrs = dev_attrs, + }; + ++/* When modifying this list, be sure to modify dev_string_attrs_are_visible() ++ * accordingly. ++ */ ++static struct attribute *dev_string_attrs[] = { ++ &dev_attr_manufacturer.attr, ++ &dev_attr_product.attr, ++ &dev_attr_serial.attr, ++ NULL ++}; ++ ++static mode_t dev_string_attrs_are_visible(struct kobject *kobj, ++ struct attribute *a, int n) ++{ ++ struct usb_device *udev = to_usb_device( ++ container_of(kobj, struct device, kobj)); ++ ++ if (a == &dev_attr_manufacturer.attr) { ++ if (udev->manufacturer == NULL) ++ return 0; ++ } else if (a == &dev_attr_product.attr) { ++ if (udev->product == NULL) ++ return 0; ++ } else if (a == &dev_attr_serial.attr) { ++ if (udev->serial == NULL) ++ return 0; ++ } ++ return a->mode; ++} ++ ++static struct attribute_group dev_string_attr_grp = { ++ .attrs = dev_string_attrs, ++ .is_visible = dev_string_attrs_are_visible, ++}; ++ ++struct attribute_group *usb_device_groups[] = { ++ &dev_attr_grp, ++ &dev_string_attr_grp, ++ NULL ++}; ++ + /* Binary descriptors */ + + static ssize_t +@@ -591,10 +631,9 @@ int usb_create_sysfs_dev_files(struct us + struct device *dev = &udev->dev; + int retval; + +- retval = sysfs_create_group(&dev->kobj, &dev_attr_grp); +- if (retval) +- return retval; +- ++ /* Unforunately these attributes cannot be created before ++ * the uevent is broadcast. ++ */ + retval = device_create_bin_file(dev, &dev_bin_attr_descriptors); + if (retval) + goto error; +@@ -607,21 +646,6 @@ int usb_create_sysfs_dev_files(struct us + if (retval) + goto error; + +- if (udev->manufacturer) { +- retval = device_create_file(dev, &dev_attr_manufacturer); +- if (retval) +- goto error; +- } +- if (udev->product) { +- retval = device_create_file(dev, &dev_attr_product); +- if (retval) +- goto error; +- } +- if (udev->serial) { +- retval = device_create_file(dev, &dev_attr_serial); +- if (retval) +- goto error; +- } + retval = usb_create_ep_files(dev, &udev->ep0, udev); + if (retval) + goto error; +@@ -636,13 +660,9 @@ void usb_remove_sysfs_dev_files(struct u + struct device *dev = &udev->dev; + + usb_remove_ep_files(&udev->ep0); +- device_remove_file(dev, &dev_attr_manufacturer); +- device_remove_file(dev, &dev_attr_product); +- device_remove_file(dev, &dev_attr_serial); + remove_power_attributes(dev); + remove_persist_attributes(dev); + device_remove_bin_file(dev, &dev_bin_attr_descriptors); +- sysfs_remove_group(&dev->kobj, &dev_attr_grp); + } + + /* Interface Accociation Descriptor fields */ +@@ -688,17 +708,15 @@ static ssize_t show_interface_string(str + struct device_attribute *attr, char *buf) + { + struct usb_interface *intf; +- struct usb_device *udev; +- int len; ++ char *string; + + intf = to_usb_interface(dev); +- udev = interface_to_usbdev(intf); +- len = snprintf(buf, 256, "%s", intf->cur_altsetting->string); +- if (len < 0) ++ string = intf->cur_altsetting->string; ++ barrier(); /* The altsetting might change! */ ++ ++ if (!string) + return 0; +- buf[len] = '\n'; +- buf[len+1] = 0; +- return len+1; ++ return sprintf(buf, "%s\n", string); + } + static DEVICE_ATTR(interface, S_IRUGO, show_interface_string, NULL); + +@@ -727,18 +745,6 @@ static ssize_t show_modalias(struct devi + } + static DEVICE_ATTR(modalias, S_IRUGO, show_modalias, NULL); + +-static struct attribute *intf_assoc_attrs[] = { +- &dev_attr_iad_bFirstInterface.attr, +- &dev_attr_iad_bInterfaceCount.attr, +- &dev_attr_iad_bFunctionClass.attr, +- &dev_attr_iad_bFunctionSubClass.attr, +- &dev_attr_iad_bFunctionProtocol.attr, +- NULL, +-}; +-static struct attribute_group intf_assoc_attr_grp = { +- .attrs = intf_assoc_attrs, +-}; +- + static struct attribute *intf_attrs[] = { + &dev_attr_bInterfaceNumber.attr, + &dev_attr_bAlternateSetting.attr, +@@ -753,6 +759,37 @@ static struct attribute_group intf_attr_ + .attrs = intf_attrs, + }; + ++static struct attribute *intf_assoc_attrs[] = { ++ &dev_attr_iad_bFirstInterface.attr, ++ &dev_attr_iad_bInterfaceCount.attr, ++ &dev_attr_iad_bFunctionClass.attr, ++ &dev_attr_iad_bFunctionSubClass.attr, ++ &dev_attr_iad_bFunctionProtocol.attr, ++ NULL, ++}; ++ ++static mode_t intf_assoc_attrs_are_visible(struct kobject *kobj, ++ struct attribute *a, int n) ++{ ++ struct usb_interface *intf = to_usb_interface( ++ container_of(kobj, struct device, kobj)); ++ ++ if (intf->intf_assoc == NULL) ++ return 0; ++ return a->mode; ++} ++ ++static struct attribute_group intf_assoc_attr_grp = { ++ .attrs = intf_assoc_attrs, ++ .is_visible = intf_assoc_attrs_are_visible, ++}; ++ ++struct attribute_group *usb_interface_groups[] = { ++ &intf_attr_grp, ++ &intf_assoc_attr_grp, ++ NULL ++}; ++ + static inline void usb_create_intf_ep_files(struct usb_interface *intf, + struct usb_device *udev) + { +@@ -777,23 +814,21 @@ static inline void usb_remove_intf_ep_fi + + int usb_create_sysfs_intf_files(struct usb_interface *intf) + { +- struct device *dev = &intf->dev; + struct usb_device *udev = interface_to_usbdev(intf); + struct usb_host_interface *alt = intf->cur_altsetting; + int retval; + + if (intf->sysfs_files_created) + return 0; +- retval = sysfs_create_group(&dev->kobj, &intf_attr_grp); +- if (retval) +- return retval; + ++ /* The interface string may be present in some altsettings ++ * and missing in others. Hence its attribute cannot be created ++ * before the uevent is broadcast. ++ */ + if (alt->string == NULL) + alt->string = usb_cache_string(udev, alt->desc.iInterface); + if (alt->string) +- retval = device_create_file(dev, &dev_attr_interface); +- if (intf->intf_assoc) +- retval = sysfs_create_group(&dev->kobj, &intf_assoc_attr_grp); ++ retval = device_create_file(&intf->dev, &dev_attr_interface); + usb_create_intf_ep_files(intf, udev); + intf->sysfs_files_created = 1; + return 0; +@@ -807,7 +842,5 @@ void usb_remove_sysfs_intf_files(struct + return; + usb_remove_intf_ep_files(intf); + device_remove_file(dev, &dev_attr_interface); +- sysfs_remove_group(&dev->kobj, &intf_attr_grp); +- sysfs_remove_group(&intf->dev.kobj, &intf_assoc_attr_grp); + intf->sysfs_files_created = 0; + } +--- a/drivers/usb/core/usb.c ++++ b/drivers/usb/core/usb.c +@@ -291,6 +291,7 @@ struct usb_device *usb_alloc_dev(struct + device_initialize(&dev->dev); + dev->dev.bus = &usb_bus_type; + dev->dev.type = &usb_device_type; ++ dev->dev.groups = usb_device_groups; + dev->dev.dma_mask = bus->controller->dma_mask; + set_dev_node(&dev->dev, dev_to_node(bus->controller)); + dev->state = USB_STATE_ATTACHED; +--- a/drivers/usb/core/usb.h ++++ b/drivers/usb/core/usb.h +@@ -130,6 +130,10 @@ static inline int is_active(const struct + /* for labeling diagnostics */ + extern const char *usbcore_name; + ++/* sysfs stuff */ ++extern struct attribute_group *usb_device_groups[]; ++extern struct attribute_group *usb_interface_groups[]; ++ + /* usbfs stuff */ + extern struct mutex usbfs_mutex; + extern struct usb_driver usbfs_driver; diff --git a/usb.current/usb-do-not-handle-device-1410-5010-in-option-driver.patch b/usb.current/usb-do-not-handle-device-1410-5010-in-option-driver.patch new file mode 100644 index 00000000000000..c66be39c05da7d --- /dev/null +++ b/usb.current/usb-do-not-handle-device-1410-5010-in-option-driver.patch @@ -0,0 +1,52 @@ +From linux-usb-owner@vger.kernel.org Sun May 4 16:32:16 2008 +From: Eugeniy Meshcheryakov <eugen@debian.org> +Date: Mon, 5 May 2008 01:24:38 +0200 +Subject: USB: do not handle device 1410:5010 in 'option' driver +To: linux-usb@vger.kernel.org +Message-ID: <20080504232438.GA6262@localhost.localdomain> +Content-Disposition: inline + + +This device is not a serial port, but a virtual CD-ROM device. For +example with my Novatel MC950D: + +lsusb -v -d 1410:5010 | grep InterfaceClass + bInterfaceClass 8 Mass Storage + +After some time (ca. 5min) or if virtual CD is ejected, device id +changes to 1410:4400: + +% lsusb -v -d 1410:4400 | grep InterfaceClass + bInterfaceClass 255 Vendor Specific Class + bInterfaceClass 255 Vendor Specific Class + +Variable name says that 0x5010 is a Novatel U727, but searching in +internet shows, that this device also provides virtual CD that should be +ejected before use. Product id for serial port in this case is 0x4100. + +Signed-off-by: Eugeniy Meshcheryakov <eugen@debian.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/option.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -154,8 +154,6 @@ static int option_send_setup(struct usb + #define NOVATELWIRELESS_PRODUCT_MC727 0x4100 + #define NOVATELWIRELESS_PRODUCT_MC950D 0x4400 + +-#define NOVATELWIRELESS_PRODUCT_U727 0x5010 +- + /* FUTURE NOVATEL PRODUCTS */ + #define NOVATELWIRELESS_PRODUCT_EVDO_1 0x6000 + #define NOVATELWIRELESS_PRODUCT_HSPA_1 0x7000 +@@ -272,7 +270,6 @@ static struct usb_device_id option_ids[] + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU870D) }, /* Novatel EU850D/EU860D/EU870D */ + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC950D) }, /* Novatel MC930D/MC950D */ + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */ +- { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U727) }, /* Novatel U727 */ + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_1) }, /* Novatel EVDO product */ + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_1) }, /* Novatel HSPA product */ + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_1) }, /* Novatel Embedded product */ diff --git a/usb.current/usb-fix-compile-warning-in-isp1760.patch b/usb.current/usb-fix-compile-warning-in-isp1760.patch new file mode 100644 index 00000000000000..2e5d5474f14a5a --- /dev/null +++ b/usb.current/usb-fix-compile-warning-in-isp1760.patch @@ -0,0 +1,32 @@ +From linux-usb-owner@vger.kernel.org Mon May 5 00:33:35 2008 +From: Sebastian Siewior <linux-usb@ml.breakpoint.cc> +Date: Mon, 5 May 2008 09:31:50 +0200 +Subject: usb: fix compile warning in isp1760 +To: Greg Kroah-Hartman <gregkh@suse.de> +Cc: linux-usb@vger.kernel.org +Message-ID: <20080505073150.GA21003@Chamillionaire.breakpoint.cc> +Content-Disposition: inline + + +From: Sebastian Siewior <bigeasy@linutronix.de> + +drivers/usb/host/isp1760-if.c:275: warning: 'ret' is used uninitialized in this function + +Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/host/isp1760-if.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/host/isp1760-if.c ++++ b/drivers/usb/host/isp1760-if.c +@@ -256,7 +256,7 @@ static struct pci_driver isp1761_pci_dri + + static int __init isp1760_init(void) + { +- int ret; ++ int ret = -ENODEV; + + init_kmem_once(); + diff --git a/usb.current/usb-fix-integer-as-null-pointer-warnings-found-by-sparse.patch b/usb.current/usb-fix-integer-as-null-pointer-warnings-found-by-sparse.patch new file mode 100644 index 00000000000000..6b780491fbd3b0 --- /dev/null +++ b/usb.current/usb-fix-integer-as-null-pointer-warnings-found-by-sparse.patch @@ -0,0 +1,82 @@ +From harvey.harrison@gmail.com Wed Apr 30 15:03:34 2008 +From: Harvey Harrison <harvey.harrison@gmail.com> +Date: Wed, 30 Apr 2008 15:03:41 -0700 +Subject: usb: fix integer as NULL pointer warnings found by sparse +To: Andrew Morton <akpm@linux-foundation.org> +Cc: Greg KH <gregkh@suse.de>, LKML <linux-kernel@vger.kernel.org> +Message-ID: <1209593021.24729.113.camel@brick> + + +drivers/usb/host/ohci-sm501.c:93:24: warning: Using plain integer as NULL pointer +drivers/usb/gadget/amd5536udc.c:3254:9: warning: Using plain integer as NULL pointer +drivers/usb/gadget/amd5536udc.c:3267:9: warning: Using plain integer as NULL pointer +drivers/usb/gadget/amd5536udc.c:3277:9: warning: Using plain integer as NULL pointer +drivers/usb/gadget/amd5536udc.c:3285:9: warning: Using plain integer as NULL pointer +drivers/usb/gadget/amd5536udc.c:3293:9: warning: Using plain integer as NULL pointer + +Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/gadget/amd5536udc.c | 10 +++++----- + drivers/usb/host/ohci-sm501.c | 2 +- + 2 files changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/usb/gadget/amd5536udc.c ++++ b/drivers/usb/gadget/amd5536udc.c +@@ -3251,7 +3251,7 @@ static int udc_pci_probe( + /* pci setup */ + if (pci_enable_device(pdev) < 0) { + kfree(dev); +- dev = 0; ++ dev = NULL; + retval = -ENODEV; + goto finished; + } +@@ -3264,7 +3264,7 @@ static int udc_pci_probe( + if (!request_mem_region(resource, len, name)) { + dev_dbg(&pdev->dev, "pci device used already\n"); + kfree(dev); +- dev = 0; ++ dev = NULL; + retval = -EBUSY; + goto finished; + } +@@ -3274,7 +3274,7 @@ static int udc_pci_probe( + if (dev->virt_addr == NULL) { + dev_dbg(&pdev->dev, "start address cannot be mapped\n"); + kfree(dev); +- dev = 0; ++ dev = NULL; + retval = -EFAULT; + goto finished; + } +@@ -3282,7 +3282,7 @@ static int udc_pci_probe( + if (!pdev->irq) { + dev_err(&dev->pdev->dev, "irq not set\n"); + kfree(dev); +- dev = 0; ++ dev = NULL; + retval = -ENODEV; + goto finished; + } +@@ -3290,7 +3290,7 @@ static int udc_pci_probe( + if (request_irq(pdev->irq, udc_irq, IRQF_SHARED, name, dev) != 0) { + dev_dbg(&dev->pdev->dev, "request_irq(%d) fail\n", pdev->irq); + kfree(dev); +- dev = 0; ++ dev = NULL; + retval = -EBUSY; + goto finished; + } +--- a/drivers/usb/host/ohci-sm501.c ++++ b/drivers/usb/host/ohci-sm501.c +@@ -90,7 +90,7 @@ static int ohci_hcd_sm501_drv_probe(stru + struct device *dev = &pdev->dev; + struct resource *res, *mem; + int retval, irq; +- struct usb_hcd *hcd = 0; ++ struct usb_hcd *hcd = NULL; + + irq = retval = platform_get_irq(pdev, 0); + if (retval < 0) diff --git a/usb.current/usb-fix-unusual_devs.h-ordering.patch b/usb.current/usb-fix-unusual_devs.h-ordering.patch new file mode 100644 index 00000000000000..5e72ebf8e52835 --- /dev/null +++ b/usb.current/usb-fix-unusual_devs.h-ordering.patch @@ -0,0 +1,111 @@ +From phil@ipom.com Sat May 3 18:04:53 2008 +From: Phil Dibowitz <phil@ipom.com> +Date: Sat, 03 May 2008 18:04:30 -0700 +Subject: USB: Fix unusual_devs.h ordering +To: USB Dev <linux-usb@vger.kernel.org>, USB Storage list <usb-storage@lists.one-eyed-alien.net>, Greg KH <greg@kroah.com> +Message-ID: <481D0B9E.4080603@ipom.com> + +This patch fixes ordering problems with entries in unusual_devs.h. + +Signed-off-by: Phil Dibowitz <phil@ipom.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/storage/unusual_devs.h | 51 ++++++++++++++++++------------------- + 1 file changed, 25 insertions(+), 26 deletions(-) + +--- a/drivers/usb/storage/unusual_devs.h ++++ b/drivers/usb/storage/unusual_devs.h +@@ -401,6 +401,14 @@ UNUSUAL_DEV( 0x04a5, 0x3010, 0x0100, 0x + US_SC_DEVICE, US_PR_DEVICE, NULL, + US_FL_IGNORE_RESIDUE ), + ++#ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB ++UNUSUAL_DEV( 0x04b4, 0x6830, 0x0000, 0x9999, ++ "Cypress", ++ "Cypress AT2LP", ++ US_SC_CYP_ATACB, US_PR_BULK, NULL, ++ 0), ++#endif ++ + /* Reported by Simon Levitt <simon@whattf.com> + * This entry needs Sub and Proto fields */ + UNUSUAL_DEV( 0x04b8, 0x0601, 0x0100, 0x0100, +@@ -539,17 +547,6 @@ UNUSUAL_DEV( 0x04e6, 0x0101, 0x0200, 0x + "CD-RW Device", + US_SC_8020, US_PR_CB, NULL, 0), + +-/* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. +- * Device uses standards-violating 32-byte Bulk Command Block Wrappers and +- * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. +- */ +- +-UNUSUAL_DEV( 0x04fc, 0x80c2, 0x0100, 0x0100, +- "Kobian Mercury", +- "Binocam DCB-132", +- US_SC_DEVICE, US_PR_DEVICE, NULL, +- US_FL_BULK32), +- + #ifdef CONFIG_USB_STORAGE_USBAT + UNUSUAL_DEV( 0x04e6, 0x1010, 0x0000, 0x9999, + "Shuttle/SCM", +@@ -565,6 +562,16 @@ UNUSUAL_DEV( 0x04e8, 0x507c, 0x0220, 0x + US_SC_DEVICE, US_PR_DEVICE, NULL, + US_FL_MAX_SECTORS_64), + ++/* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>. ++ * Device uses standards-violating 32-byte Bulk Command Block Wrappers and ++ * reports itself as "Proprietary SCSI Bulk." Cf. device entry 0x084d:0x0011. ++ */ ++UNUSUAL_DEV( 0x04fc, 0x80c2, 0x0100, 0x0100, ++ "Kobian Mercury", ++ "Binocam DCB-132", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ US_FL_BULK32), ++ + /* Reported by Bob Sass <rls@vectordb.com> -- only rev 1.33 tested */ + UNUSUAL_DEV( 0x050d, 0x0115, 0x0133, 0x0133, + "Belkin", +@@ -1361,13 +1368,6 @@ UNUSUAL_DEV( 0x0d96, 0x410a, 0x0001, 0xf + US_SC_DEVICE, US_PR_DEVICE, NULL, + US_FL_FIX_INQUIRY), + +-/* Reported by Rohan Hart <rohan.hart17@gmail.com> */ +-UNUSUAL_DEV( 0x2770, 0x915d, 0x0010, 0x0010, +- "INTOVA", +- "Pixtreme", +- US_SC_DEVICE, US_PR_DEVICE, NULL, +- US_FL_FIX_CAPACITY ), +- + /* + * Entry for Jenoptik JD 5200z3 + * +@@ -1731,6 +1731,13 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x + US_SC_DEVICE, US_PR_DEVICE, NULL, + US_FL_GO_SLOW ), + ++/* Reported by Rohan Hart <rohan.hart17@gmail.com> */ ++UNUSUAL_DEV( 0x2770, 0x915d, 0x0010, 0x0010, ++ "INTOVA", ++ "Pixtreme", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ US_FL_FIX_CAPACITY ), ++ + /* + * David Härdeman <david@2gen.com> + * The key makes the SCSI stack print confusing (but harmless) messages +@@ -1755,14 +1762,6 @@ UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x + US_SC_DEVICE, US_PR_DEVICE, NULL, + US_FL_CAPACITY_HEURISTICS), + +-#ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB +-UNUSUAL_DEV( 0x04b4, 0x6830, 0x0000, 0x9999, +- "Cypress", +- "Cypress AT2LP", +- US_SC_CYP_ATACB, US_PR_BULK, NULL, +- 0), +-#endif +- + /* Control/Bulk transport for all SubClass values */ + USUAL_DEV(US_SC_RBC, US_PR_CB, USB_US_TYPE_STOR), + USUAL_DEV(US_SC_8020, US_PR_CB, USB_US_TYPE_STOR), diff --git a/usb.current/usb-isp1760-fix-printk-format.patch b/usb.current/usb-isp1760-fix-printk-format.patch new file mode 100644 index 00000000000000..bf11090f111296 --- /dev/null +++ b/usb.current/usb-isp1760-fix-printk-format.patch @@ -0,0 +1,43 @@ +From linux-usb-owner@vger.kernel.org Wed Apr 30 13:55:18 2008 +From: Randy Dunlap <randy.dunlap@oracle.com> +Date: Wed, 30 Apr 2008 13:53:54 -0700 +Subject: USB: isp1760: fix printk format +To: lud <linux-usb@vger.kernel.org>, linux-next@vger.kernel.org +Cc: gregkh <greg@kroah.com>, akpm <akpm@linux-foundation.org> +Message-ID: <20080430135354.2b385574.randy.dunlap@oracle.com> + + +From: Randy Dunlap <randy.dunlap@oracle.com> + +Fix printk format warnings in isp1760 (in linux-next): + +next-20080430/drivers/usb/host/isp1760-hcd.c:994: warning: format '%d' expects type 'int', but argument 6 has type 'size_t' +next-20080430/drivers/usb/host/isp1760-hcd.c:1092: warning: format '%d' expects type 'int', but argument 3 has type 'size_t' + +Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/host/isp1760-hcd.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/usb/host/isp1760-hcd.c ++++ b/drivers/usb/host/isp1760-hcd.c +@@ -988,7 +988,7 @@ static void do_atl_int(struct usb_hcd *u + * This did not trigger for a long time now. + */ + printk(KERN_ERR "Reloading ptd %p/%p... qh %p readed: " +- "%d of %d done: %08x cur: %08x\n", qtd, ++ "%d of %zu done: %08x cur: %08x\n", qtd, + urb, qh, PTD_XFERRED_LENGTH(dw3), + qtd->length, done_map, + (1 << queue_entry)); +@@ -1088,7 +1088,7 @@ static void do_atl_int(struct usb_hcd *u + } else if (usb_pipebulk(urb->pipe) && (length < qtd->length)) { + /* short BULK received */ + +- printk(KERN_ERR "short bulk, %d instead %d\n", length, ++ printk(KERN_ERR "short bulk, %d instead %zu\n", length, + qtd->length); + if (urb->transfer_flags & URB_SHORT_NOT_OK) { + urb->status = -EREMOTEIO; diff --git a/usb.current/usb-serial-gadget-cleanup-reorg.patch b/usb.current/usb-serial-gadget-cleanup-reorg.patch new file mode 100644 index 00000000000000..641353010dd942 --- /dev/null +++ b/usb.current/usb-serial-gadget-cleanup-reorg.patch @@ -0,0 +1,783 @@ +From linux-usb-owner@vger.kernel.org Wed May 7 16:02:19 2008 +From: David Brownell <david-b@pacbell.net> +Date: Wed, 7 May 2008 16:00:36 -0700 +Subject: USB: serial gadget: cleanup/reorg +To: Alan Cox <alan@lxorguk.ukuu.org.uk> +Cc: Greg KH <greg@kroah.com>, linux-usb@vger.kernel.org, Al Borchers <alborchers@steinerpoint.com> +Message-ID: <200805071600.37154.david-b@pacbell.net> +Content-Disposition: inline + + +Some cleanup/reorg of g_serial ... simplifying it, and disentangling +its structure so morphing it into a "function" driver (combinable with +other interfaces) should be less painful. + + - Remove most forward declarations + * put tty and gadget driver structs after their contents + * snug module init/exit decls next to their functions + * reordered some functions + + - Other cleanup: + * convert a funky macro to an inline function + * snug up module params next to their declarations + * add missing driver.owner + * add separator lines between major driver sections + + - Add comments re potential parameter/#define changes: + * only supports one port (shrank GS_NUM_PORTS) + * changing from 9600-8-N-1 affects multiple sites + + - Remove net2280-specific optimization ... it was being done + way too late, can be done by net2280 module options, and in + any case doesn't matter at any sane serial data rates. + +There are no behavioral changes, but the macro thing saves I-space. + +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Cc: Al Borchers <alborchers@steinerpoint.com> +Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + + +--- + drivers/usb/gadget/serial.c | 553 ++++++++++++++++++++------------------------ + 1 file changed, 263 insertions(+), 290 deletions(-) + +--- a/drivers/usb/gadget/serial.c ++++ b/drivers/usb/gadget/serial.c +@@ -14,7 +14,6 @@ + * This software is distributed under the terms of the GNU General + * Public License ("GPL") as published by the Free Software Foundation, + * either version 2 of that License or (at your option) any later version. +- * + */ + + #include <linux/kernel.h> +@@ -41,7 +40,11 @@ + #define GS_MAJOR 127 + #define GS_MINOR_START 0 + +-#define GS_NUM_PORTS 16 ++/* REVISIT only one port is supported for now; ++ * see gs_{send,recv}_packet() ... no multiplexing, ++ * and no support for multiple ACM devices. ++ */ ++#define GS_NUM_PORTS 1 + + #define GS_NUM_CONFIGS 1 + #define GS_NO_CONFIG_ID 0 +@@ -65,6 +68,9 @@ + + #define GS_DEFAULT_USE_ACM 0 + ++/* 9600-8-N-1 ... matches init_termios.c_cflag and defaults ++ * expected by "usbser.sys" on MS-Windows. ++ */ + #define GS_DEFAULT_DTE_RATE 9600 + #define GS_DEFAULT_DATA_BITS 8 + #define GS_DEFAULT_PARITY USB_CDC_NO_PARITY +@@ -107,10 +113,6 @@ static int debug = 1; + #define GS_NOTIFY_MAXPACKET 8 + + +-/* Structures */ +- +-struct gs_dev; +- + /* circular buffer */ + struct gs_buf { + unsigned int buf_size; +@@ -164,26 +166,7 @@ struct gs_dev { + + /* Functions */ + +-/* module */ +-static int __init gs_module_init(void); +-static void __exit gs_module_exit(void); +- +-/* tty driver */ +-static int gs_open(struct tty_struct *tty, struct file *file); +-static void gs_close(struct tty_struct *tty, struct file *file); +-static int gs_write(struct tty_struct *tty, +- const unsigned char *buf, int count); +-static int gs_put_char(struct tty_struct *tty, unsigned char ch); +-static void gs_flush_chars(struct tty_struct *tty); +-static int gs_write_room(struct tty_struct *tty); +-static int gs_chars_in_buffer(struct tty_struct *tty); +-static void gs_throttle(struct tty_struct * tty); +-static void gs_unthrottle(struct tty_struct * tty); +-static void gs_break(struct tty_struct *tty, int break_state); +-static int gs_ioctl(struct tty_struct *tty, struct file *file, +- unsigned int cmd, unsigned long arg); +-static void gs_set_termios(struct tty_struct *tty, struct ktermios *old); +- ++/* tty driver internals */ + static int gs_send(struct gs_dev *dev); + static int gs_send_packet(struct gs_dev *dev, char *packet, + unsigned int size); +@@ -192,19 +175,7 @@ static int gs_recv_packet(struct gs_dev + static void gs_read_complete(struct usb_ep *ep, struct usb_request *req); + static void gs_write_complete(struct usb_ep *ep, struct usb_request *req); + +-/* gadget driver */ +-static int gs_bind(struct usb_gadget *gadget); +-static void gs_unbind(struct usb_gadget *gadget); +-static int gs_setup(struct usb_gadget *gadget, +- const struct usb_ctrlrequest *ctrl); +-static int gs_setup_standard(struct usb_gadget *gadget, +- const struct usb_ctrlrequest *ctrl); +-static int gs_setup_class(struct usb_gadget *gadget, +- const struct usb_ctrlrequest *ctrl); +-static void gs_setup_complete(struct usb_ep *ep, struct usb_request *req); +-static void gs_setup_complete_set_line_coding(struct usb_ep *ep, +- struct usb_request *req); +-static void gs_disconnect(struct usb_gadget *gadget); ++/* gadget driver internals */ + static int gs_set_config(struct gs_dev *dev, unsigned config); + static void gs_reset_config(struct gs_dev *dev); + static int gs_build_config_buf(u8 *buf, struct usb_gadget *g, +@@ -232,9 +203,6 @@ static unsigned int gs_buf_put(struct gs + static unsigned int gs_buf_get(struct gs_buf *gb, char *buf, + unsigned int count); + +-/* external functions */ +-extern int net2280_set_fifo_mode(struct usb_gadget *gadget, int mode); +- + + /* Globals */ + +@@ -246,48 +214,8 @@ static const char *EP_NOTIFY_NAME; + + static struct mutex gs_open_close_lock[GS_NUM_PORTS]; + +-static unsigned int read_q_size = GS_DEFAULT_READ_Q_SIZE; +-static unsigned int write_q_size = GS_DEFAULT_WRITE_Q_SIZE; +- +-static unsigned int write_buf_size = GS_DEFAULT_WRITE_BUF_SIZE; +- +-static unsigned int use_acm = GS_DEFAULT_USE_ACM; +- +- +-/* tty driver struct */ +-static const struct tty_operations gs_tty_ops = { +- .open = gs_open, +- .close = gs_close, +- .write = gs_write, +- .put_char = gs_put_char, +- .flush_chars = gs_flush_chars, +- .write_room = gs_write_room, +- .ioctl = gs_ioctl, +- .set_termios = gs_set_termios, +- .throttle = gs_throttle, +- .unthrottle = gs_unthrottle, +- .break_ctl = gs_break, +- .chars_in_buffer = gs_chars_in_buffer, +-}; +-static struct tty_driver *gs_tty_driver; +- +-/* gadget driver struct */ +-static struct usb_gadget_driver gs_gadget_driver = { +-#ifdef CONFIG_USB_GADGET_DUALSPEED +- .speed = USB_SPEED_HIGH, +-#else +- .speed = USB_SPEED_FULL, +-#endif /* CONFIG_USB_GADGET_DUALSPEED */ +- .function = GS_LONG_NAME, +- .bind = gs_bind, +- .unbind = gs_unbind, +- .setup = gs_setup, +- .disconnect = gs_disconnect, +- .driver = { +- .name = GS_SHORT_NAME, +- }, +-}; + ++/*-------------------------------------------------------------------------*/ + + /* USB descriptors */ + +@@ -521,6 +449,8 @@ static const struct usb_descriptor_heade + }; + + ++/*-------------------------------------------------------------------------*/ ++ + /* Module */ + MODULE_DESCRIPTION(GS_LONG_NAME); + MODULE_AUTHOR("Al Borchers"); +@@ -531,84 +461,23 @@ module_param(debug, int, S_IRUGO|S_IWUSR + MODULE_PARM_DESC(debug, "Enable debugging, 0=off, 1=on"); + #endif + ++static unsigned int read_q_size = GS_DEFAULT_READ_Q_SIZE; + module_param(read_q_size, uint, S_IRUGO); + MODULE_PARM_DESC(read_q_size, "Read request queue size, default=32"); + ++static unsigned int write_q_size = GS_DEFAULT_WRITE_Q_SIZE; + module_param(write_q_size, uint, S_IRUGO); + MODULE_PARM_DESC(write_q_size, "Write request queue size, default=32"); + ++static unsigned int write_buf_size = GS_DEFAULT_WRITE_BUF_SIZE; + module_param(write_buf_size, uint, S_IRUGO); + MODULE_PARM_DESC(write_buf_size, "Write buffer size, default=8192"); + ++static unsigned int use_acm = GS_DEFAULT_USE_ACM; + module_param(use_acm, uint, S_IRUGO); + MODULE_PARM_DESC(use_acm, "Use CDC ACM, 0=no, 1=yes, default=no"); + +-module_init(gs_module_init); +-module_exit(gs_module_exit); +- +-/* +-* gs_module_init +-* +-* Register as a USB gadget driver and a tty driver. +-*/ +-static int __init gs_module_init(void) +-{ +- int i; +- int retval; +- +- retval = usb_gadget_register_driver(&gs_gadget_driver); +- if (retval) { +- pr_err("gs_module_init: cannot register gadget driver, " +- "ret=%d\n", retval); +- return retval; +- } +- +- gs_tty_driver = alloc_tty_driver(GS_NUM_PORTS); +- if (!gs_tty_driver) +- return -ENOMEM; +- gs_tty_driver->owner = THIS_MODULE; +- gs_tty_driver->driver_name = GS_SHORT_NAME; +- gs_tty_driver->name = "ttygs"; +- gs_tty_driver->major = GS_MAJOR; +- gs_tty_driver->minor_start = GS_MINOR_START; +- gs_tty_driver->type = TTY_DRIVER_TYPE_SERIAL; +- gs_tty_driver->subtype = SERIAL_TYPE_NORMAL; +- gs_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; +- gs_tty_driver->init_termios = tty_std_termios; +- gs_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; +- tty_set_operations(gs_tty_driver, &gs_tty_ops); +- +- for (i=0; i < GS_NUM_PORTS; i++) +- mutex_init(&gs_open_close_lock[i]); +- +- retval = tty_register_driver(gs_tty_driver); +- if (retval) { +- usb_gadget_unregister_driver(&gs_gadget_driver); +- put_tty_driver(gs_tty_driver); +- pr_err("gs_module_init: cannot register tty driver, " +- "ret=%d\n", retval); +- return retval; +- } +- +- pr_info("gs_module_init: %s %s loaded\n", +- GS_LONG_NAME, GS_VERSION_STR); +- return 0; +-} +- +-/* +-* gs_module_exit +-* +-* Unregister as a tty driver and a USB gadget driver. +-*/ +-static void __exit gs_module_exit(void) +-{ +- tty_unregister_driver(gs_tty_driver); +- put_tty_driver(gs_tty_driver); +- usb_gadget_unregister_driver(&gs_gadget_driver); +- +- pr_info("gs_module_exit: %s %s unloaded\n", +- GS_LONG_NAME, GS_VERSION_STR); +-} ++/*-------------------------------------------------------------------------*/ + + /* TTY Driver */ + +@@ -753,15 +622,15 @@ exit_unlock_dev: + * gs_close + */ + +-#define GS_WRITE_FINISHED_EVENT_SAFELY(p) \ +-({ \ +- int cond; \ +- \ +- spin_lock_irq(&(p)->port_lock); \ +- cond = !(p)->port_dev || !gs_buf_data_avail((p)->port_write_buf); \ +- spin_unlock_irq(&(p)->port_lock); \ +- cond; \ +-}) ++static int gs_write_finished_event_safely(struct gs_port *p) ++{ ++ int cond; ++ ++ spin_lock_irq(&(p)->port_lock); ++ cond = !(p)->port_dev || !gs_buf_data_avail((p)->port_write_buf); ++ spin_unlock_irq(&(p)->port_lock); ++ return cond; ++} + + static void gs_close(struct tty_struct *tty, struct file *file) + { +@@ -807,7 +676,7 @@ static void gs_close(struct tty_struct * + if (gs_buf_data_avail(port->port_write_buf) > 0) { + spin_unlock_irq(&port->port_lock); + wait_event_interruptible_timeout(port->port_write_wait, +- GS_WRITE_FINISHED_EVENT_SAFELY(port), ++ gs_write_finished_event_safely(port), + GS_CLOSE_TIMEOUT * HZ); + spin_lock_irq(&port->port_lock); + } +@@ -1065,6 +934,23 @@ static void gs_set_termios(struct tty_st + { + } + ++static const struct tty_operations gs_tty_ops = { ++ .open = gs_open, ++ .close = gs_close, ++ .write = gs_write, ++ .put_char = gs_put_char, ++ .flush_chars = gs_flush_chars, ++ .write_room = gs_write_room, ++ .ioctl = gs_ioctl, ++ .set_termios = gs_set_termios, ++ .throttle = gs_throttle, ++ .unthrottle = gs_unthrottle, ++ .break_ctl = gs_break, ++ .chars_in_buffer = gs_chars_in_buffer, ++}; ++ ++/*-------------------------------------------------------------------------*/ ++ + /* + * gs_send + * +@@ -1328,9 +1214,44 @@ requeue: + } + } + ++/*-------------------------------------------------------------------------*/ ++ + /* Gadget Driver */ + + /* ++ * gs_unbind ++ * ++ * Called on module unload. Frees the control request and device ++ * structure. ++ */ ++static void /* __init_or_exit */ gs_unbind(struct usb_gadget *gadget) ++{ ++ struct gs_dev *dev = get_gadget_data(gadget); ++ ++ gs_device = NULL; ++ ++ /* read/write requests already freed, only control request remains */ ++ if (dev != NULL) { ++ if (dev->dev_ctrl_req != NULL) { ++ gs_free_req(gadget->ep0, dev->dev_ctrl_req); ++ dev->dev_ctrl_req = NULL; ++ } ++ gs_free_ports(dev); ++ if (dev->dev_notify_ep) ++ usb_ep_disable(dev->dev_notify_ep); ++ if (dev->dev_in_ep) ++ usb_ep_disable(dev->dev_in_ep); ++ if (dev->dev_out_ep) ++ usb_ep_disable(dev->dev_out_ep); ++ kfree(dev); ++ set_gadget_data(gadget, NULL); ++ } ++ ++ pr_info("gs_unbind: %s %s unbound\n", GS_LONG_NAME, ++ GS_VERSION_STR); ++} ++ ++/* + * gs_bind + * + * Called on module load. Allocates and initializes the device +@@ -1441,8 +1362,6 @@ static int __init gs_bind(struct usb_gad + gs_unbind(gadget); + return -ENOMEM; + } +- dev->dev_ctrl_req->complete = gs_setup_complete; +- + gadget->ep0->driver_data = dev; + + pr_info("gs_bind: %s %s bound\n", +@@ -1455,95 +1374,6 @@ autoconf_fail: + return -ENODEV; + } + +-/* +- * gs_unbind +- * +- * Called on module unload. Frees the control request and device +- * structure. +- */ +-static void /* __init_or_exit */ gs_unbind(struct usb_gadget *gadget) +-{ +- struct gs_dev *dev = get_gadget_data(gadget); +- +- gs_device = NULL; +- +- /* read/write requests already freed, only control request remains */ +- if (dev != NULL) { +- if (dev->dev_ctrl_req != NULL) { +- gs_free_req(gadget->ep0, dev->dev_ctrl_req); +- dev->dev_ctrl_req = NULL; +- } +- gs_free_ports(dev); +- if (dev->dev_notify_ep) +- usb_ep_disable(dev->dev_notify_ep); +- if (dev->dev_in_ep) +- usb_ep_disable(dev->dev_in_ep); +- if (dev->dev_out_ep) +- usb_ep_disable(dev->dev_out_ep); +- kfree(dev); +- set_gadget_data(gadget, NULL); +- } +- +- pr_info("gs_unbind: %s %s unbound\n", GS_LONG_NAME, +- GS_VERSION_STR); +-} +- +-/* +- * gs_setup +- * +- * Implements all the control endpoint functionality that's not +- * handled in hardware or the hardware driver. +- * +- * Returns the size of the data sent to the host, or a negative +- * error number. +- */ +-static int gs_setup(struct usb_gadget *gadget, +- const struct usb_ctrlrequest *ctrl) +-{ +- int ret = -EOPNOTSUPP; +- struct gs_dev *dev = get_gadget_data(gadget); +- struct usb_request *req = dev->dev_ctrl_req; +- u16 wIndex = le16_to_cpu(ctrl->wIndex); +- u16 wValue = le16_to_cpu(ctrl->wValue); +- u16 wLength = le16_to_cpu(ctrl->wLength); +- +- req->complete = gs_setup_complete; +- +- switch (ctrl->bRequestType & USB_TYPE_MASK) { +- case USB_TYPE_STANDARD: +- ret = gs_setup_standard(gadget,ctrl); +- break; +- +- case USB_TYPE_CLASS: +- ret = gs_setup_class(gadget,ctrl); +- break; +- +- default: +- pr_err("gs_setup: unknown request, type=%02x, request=%02x, " +- "value=%04x, index=%04x, length=%d\n", +- ctrl->bRequestType, ctrl->bRequest, +- wValue, wIndex, wLength); +- break; +- } +- +- /* respond with data transfer before status phase? */ +- if (ret >= 0) { +- req->length = ret; +- req->zero = ret < wLength +- && (ret % gadget->ep0->maxpacket) == 0; +- ret = usb_ep_queue(gadget->ep0, req, GFP_ATOMIC); +- if (ret < 0) { +- pr_err("gs_setup: cannot queue response, ret=%d\n", +- ret); +- req->status = 0; +- gs_setup_complete(gadget->ep0, req); +- } +- } +- +- /* device either stalls (ret < 0) or reports success */ +- return ret; +-} +- + static int gs_setup_standard(struct usb_gadget *gadget, + const struct usb_ctrlrequest *ctrl) + { +@@ -1673,6 +1503,42 @@ set_interface_done: + return ret; + } + ++static void gs_setup_complete_set_line_coding(struct usb_ep *ep, ++ struct usb_request *req) ++{ ++ struct gs_dev *dev = ep->driver_data; ++ struct gs_port *port = dev->dev_port[0]; /* ACM only has one port */ ++ ++ switch (req->status) { ++ case 0: ++ /* normal completion */ ++ if (req->actual != sizeof(port->port_line_coding)) ++ usb_ep_set_halt(ep); ++ else if (port) { ++ struct usb_cdc_line_coding *value = req->buf; ++ ++ /* REVISIT: we currently just remember this data. ++ * If we change that, (a) validate it first, then ++ * (b) update whatever hardware needs updating. ++ */ ++ spin_lock(&port->port_lock); ++ port->port_line_coding = *value; ++ spin_unlock(&port->port_lock); ++ } ++ break; ++ ++ case -ESHUTDOWN: ++ /* disconnect */ ++ gs_free_req(ep, req); ++ break; ++ ++ default: ++ /* unexpected */ ++ break; ++ } ++ return; ++} ++ + static int gs_setup_class(struct usb_gadget *gadget, + const struct usb_ctrlrequest *ctrl) + { +@@ -1734,52 +1600,72 @@ static int gs_setup_class(struct usb_gad + return ret; + } + +-static void gs_setup_complete_set_line_coding(struct usb_ep *ep, +- struct usb_request *req) ++/* ++ * gs_setup_complete ++ */ ++static void gs_setup_complete(struct usb_ep *ep, struct usb_request *req) + { +- struct gs_dev *dev = ep->driver_data; +- struct gs_port *port = dev->dev_port[0]; /* ACM only has one port */ ++ if (req->status || req->actual != req->length) { ++ pr_err("gs_setup_complete: status error, status=%d, " ++ "actual=%d, length=%d\n", ++ req->status, req->actual, req->length); ++ } ++} + +- switch (req->status) { +- case 0: +- /* normal completion */ +- if (req->actual != sizeof(port->port_line_coding)) +- usb_ep_set_halt(ep); +- else if (port) { +- struct usb_cdc_line_coding *value = req->buf; ++/* ++ * gs_setup ++ * ++ * Implements all the control endpoint functionality that's not ++ * handled in hardware or the hardware driver. ++ * ++ * Returns the size of the data sent to the host, or a negative ++ * error number. ++ */ ++static int gs_setup(struct usb_gadget *gadget, ++ const struct usb_ctrlrequest *ctrl) ++{ ++ int ret = -EOPNOTSUPP; ++ struct gs_dev *dev = get_gadget_data(gadget); ++ struct usb_request *req = dev->dev_ctrl_req; ++ u16 wIndex = le16_to_cpu(ctrl->wIndex); ++ u16 wValue = le16_to_cpu(ctrl->wValue); ++ u16 wLength = le16_to_cpu(ctrl->wLength); + +- /* REVISIT: we currently just remember this data. +- * If we change that, (a) validate it first, then +- * (b) update whatever hardware needs updating. +- */ +- spin_lock(&port->port_lock); +- port->port_line_coding = *value; +- spin_unlock(&port->port_lock); +- } ++ req->complete = gs_setup_complete; ++ ++ switch (ctrl->bRequestType & USB_TYPE_MASK) { ++ case USB_TYPE_STANDARD: ++ ret = gs_setup_standard(gadget,ctrl); + break; + +- case -ESHUTDOWN: +- /* disconnect */ +- gs_free_req(ep, req); ++ case USB_TYPE_CLASS: ++ ret = gs_setup_class(gadget,ctrl); + break; + + default: +- /* unexpected */ ++ pr_err("gs_setup: unknown request, type=%02x, request=%02x, " ++ "value=%04x, index=%04x, length=%d\n", ++ ctrl->bRequestType, ctrl->bRequest, ++ wValue, wIndex, wLength); + break; + } +- return; +-} + +-/* +- * gs_setup_complete +- */ +-static void gs_setup_complete(struct usb_ep *ep, struct usb_request *req) +-{ +- if (req->status || req->actual != req->length) { +- pr_err("gs_setup_complete: status error, status=%d, " +- "actual=%d, length=%d\n", +- req->status, req->actual, req->length); ++ /* respond with data transfer before status phase? */ ++ if (ret >= 0) { ++ req->length = ret; ++ req->zero = ret < wLength ++ && (ret % gadget->ep0->maxpacket) == 0; ++ ret = usb_ep_queue(gadget->ep0, req, GFP_ATOMIC); ++ if (ret < 0) { ++ pr_err("gs_setup: cannot queue response, ret=%d\n", ++ ret); ++ req->status = 0; ++ gs_setup_complete(gadget->ep0, req); ++ } + } ++ ++ /* device either stalls (ret < 0) or reports success */ ++ return ret; + } + + /* +@@ -1811,6 +1697,23 @@ static void gs_disconnect(struct usb_gad + pr_info("gs_disconnect: %s disconnected\n", GS_LONG_NAME); + } + ++static struct usb_gadget_driver gs_gadget_driver = { ++#ifdef CONFIG_USB_GADGET_DUALSPEED ++ .speed = USB_SPEED_HIGH, ++#else ++ .speed = USB_SPEED_FULL, ++#endif /* CONFIG_USB_GADGET_DUALSPEED */ ++ .function = GS_LONG_NAME, ++ .bind = gs_bind, ++ .unbind = gs_unbind, ++ .setup = gs_setup, ++ .disconnect = gs_disconnect, ++ .driver = { ++ .name = GS_SHORT_NAME, ++ .owner = THIS_MODULE, ++ }, ++}; ++ + /* + * gs_set_config + * +@@ -1846,16 +1749,10 @@ static int gs_set_config(struct gs_dev * + case GS_BULK_CONFIG_ID: + if (use_acm) + return -EINVAL; +- /* device specific optimizations */ +- if (gadget_is_net2280(gadget)) +- net2280_set_fifo_mode(gadget, 1); + break; + case GS_ACM_CONFIG_ID: + if (!use_acm) + return -EINVAL; +- /* device specific optimizations */ +- if (gadget_is_net2280(gadget)) +- net2280_set_fifo_mode(gadget, 1); + break; + default: + return -EINVAL; +@@ -2233,6 +2130,8 @@ static void gs_free_ports(struct gs_dev + } + } + ++/*-------------------------------------------------------------------------*/ ++ + /* Circular Buffer */ + + /* +@@ -2393,3 +2292,77 @@ gs_buf_get(struct gs_buf *gb, char *buf, + + return count; + } ++ ++/*-------------------------------------------------------------------------*/ ++ ++static struct tty_driver *gs_tty_driver; ++ ++/* ++ * gs_module_init ++ * ++ * Register as a USB gadget driver and a tty driver. ++ */ ++static int __init gs_module_init(void) ++{ ++ int i; ++ int retval; ++ ++ retval = usb_gadget_register_driver(&gs_gadget_driver); ++ if (retval) { ++ pr_err("gs_module_init: cannot register gadget driver, " ++ "ret=%d\n", retval); ++ return retval; ++ } ++ ++ gs_tty_driver = alloc_tty_driver(GS_NUM_PORTS); ++ if (!gs_tty_driver) ++ return -ENOMEM; ++ gs_tty_driver->owner = THIS_MODULE; ++ gs_tty_driver->driver_name = GS_SHORT_NAME; ++ gs_tty_driver->name = "ttygs"; ++ gs_tty_driver->major = GS_MAJOR; ++ gs_tty_driver->minor_start = GS_MINOR_START; ++ gs_tty_driver->type = TTY_DRIVER_TYPE_SERIAL; ++ gs_tty_driver->subtype = SERIAL_TYPE_NORMAL; ++ gs_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; ++ gs_tty_driver->init_termios = tty_std_termios; ++ /* must match GS_DEFAULT_DTE_RATE and friends */ ++ gs_tty_driver->init_termios.c_cflag = ++ B9600 | CS8 | CREAD | HUPCL | CLOCAL; ++ gs_tty_driver->init_termios.c_ispeed = GS_DEFAULT_DTE_RATE; ++ gs_tty_driver->init_termios.c_ospeed = GS_DEFAULT_DTE_RATE; ++ tty_set_operations(gs_tty_driver, &gs_tty_ops); ++ ++ for (i = 0; i < GS_NUM_PORTS; i++) ++ mutex_init(&gs_open_close_lock[i]); ++ ++ retval = tty_register_driver(gs_tty_driver); ++ if (retval) { ++ usb_gadget_unregister_driver(&gs_gadget_driver); ++ put_tty_driver(gs_tty_driver); ++ pr_err("gs_module_init: cannot register tty driver, " ++ "ret=%d\n", retval); ++ return retval; ++ } ++ ++ pr_info("gs_module_init: %s %s loaded\n", ++ GS_LONG_NAME, GS_VERSION_STR); ++ return 0; ++} ++module_init(gs_module_init); ++ ++/* ++ * gs_module_exit ++ * ++ * Unregister as a tty driver and a USB gadget driver. ++ */ ++static void __exit gs_module_exit(void) ++{ ++ tty_unregister_driver(gs_tty_driver); ++ put_tty_driver(gs_tty_driver); ++ usb_gadget_unregister_driver(&gs_gadget_driver); ++ ++ pr_info("gs_module_exit: %s %s unloaded\n", ++ GS_LONG_NAME, GS_VERSION_STR); ++} ++module_exit(gs_module_exit); diff --git a/usb.current/usb-serial-gadget-descriptor-cleanup.patch b/usb.current/usb-serial-gadget-descriptor-cleanup.patch new file mode 100644 index 00000000000000..7c050eb1de6771 --- /dev/null +++ b/usb.current/usb-serial-gadget-descriptor-cleanup.patch @@ -0,0 +1,66 @@ +From linux-usb-owner@vger.kernel.org Wed May 7 14:45:49 2008 +From: David Brownell <david-b@pacbell.net> +Date: Wed, 7 May 2008 14:27:37 -0700 +Subject: USB: serial gadget: descriptor cleanup +To: Greg KH <greg@kroah.com> +Cc: linux-usb@vger.kernel.org, Al Borchers <alborchers@steinerpoint.com> +Message-ID: <200805071427.37610.david-b@pacbell.net> +Content-Disposition: inline + + +Bugfix some serial gadget descriptors: + + - Stop mangling the low bits (controller type ID) of bcdDevice; + just use the high bits for a driver revision code. + + - Serial numbers that aren't specific to individual devices + are useless; stop reporting "0" for this. + + - Since it's not part of a CDC-conformant function, the "bulk only" + configuration shouldn't be using "CDC Data" as its interface class. + Switch over to using CLASS_VENDOR_SPEC (different value, 0xff). + +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Cc: Al Borchers <alborchers@steinerpoint.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/gadget/serial.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +--- a/drivers/usb/gadget/serial.c ++++ b/drivers/usb/gadget/serial.c +@@ -32,7 +32,7 @@ + /* Defines */ + + #define GS_VERSION_STR "v2.2" +-#define GS_VERSION_NUM 0x0202 ++#define GS_VERSION_NUM 0x2200 + + #define GS_LONG_NAME "Gadget Serial" + #define GS_SHORT_NAME "g_serial" +@@ -218,7 +218,6 @@ static char manufacturer[50]; + static struct usb_string gs_strings[] = { + { GS_MANUFACTURER_STR_ID, manufacturer }, + { GS_PRODUCT_STR_ID, GS_LONG_NAME }, +- { GS_SERIAL_STR_ID, "0" }, + { GS_BULK_CONFIG_STR_ID, "Gadget Serial Bulk" }, + { GS_ACM_CONFIG_STR_ID, "Gadget Serial CDC ACM" }, + { GS_CONTROL_STR_ID, "Gadget Serial Control" }, +@@ -241,7 +240,6 @@ static struct usb_device_descriptor gs_d + .idProduct = __constant_cpu_to_le16(GS_PRODUCT_ID), + .iManufacturer = GS_MANUFACTURER_STR_ID, + .iProduct = GS_PRODUCT_STR_ID, +- .iSerialNumber = GS_SERIAL_STR_ID, + .bNumConfigurations = GS_NUM_CONFIGS, + }; + +@@ -278,7 +276,7 @@ static const struct usb_interface_descri + .bDescriptorType = USB_DT_INTERFACE, + .bInterfaceNumber = GS_BULK_INTERFACE_ID, + .bNumEndpoints = 2, +- .bInterfaceClass = USB_CLASS_CDC_DATA, ++ .bInterfaceClass = USB_CLASS_VENDOR_SPEC, + .bInterfaceSubClass = 0, + .bInterfaceProtocol = 0, + .iInterface = GS_DATA_STR_ID, diff --git a/usb.current/usb-serial-gadget-remove-needless-data-structure.patch b/usb.current/usb-serial-gadget-remove-needless-data-structure.patch new file mode 100644 index 00000000000000..1dd1e5550fe1ef --- /dev/null +++ b/usb.current/usb-serial-gadget-remove-needless-data-structure.patch @@ -0,0 +1,198 @@ +From linux-usb-owner@vger.kernel.org Wed May 7 14:45:49 2008 +From: David Brownell <david-b@pacbell.net> +Date: Wed, 7 May 2008 14:24:10 -0700 +Subject: USB: serial gadget: remove needless data structure +To: Greg KH <greg@kroah.com> +Cc: linux-usb@vger.kernel.org, Al Borchers <alborchers@steinerpoint.com> +Message-ID: <200805071424.10879.david-b@pacbell.net> +Content-Disposition: inline + + +This removes a needless data structure from the serial gadget code; +it's a small code shrink, and a larger data shrink. + +Since "struct usb_request" already has a "struct list_head" reserved +for use by gadget drivers, the serial gadget code doesn't need to +allocate wrapper structs to hold that list ... it can (and should!) +just use the list_head provided for that exact use. + +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Cc: Al Borchers <alborchers@steinerpoint.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/gadget/serial.c | 85 ++++++-------------------------------------- + 1 file changed, 13 insertions(+), 72 deletions(-) + +--- a/drivers/usb/gadget/serial.c ++++ b/drivers/usb/gadget/serial.c +@@ -121,12 +121,6 @@ struct gs_buf { + char *buf_put; + }; + +-/* list of requests */ +-struct gs_req_entry { +- struct list_head re_entry; +- struct usb_request *re_req; +-}; +- + /* the port structure holds info for each port, one for each minor number */ + struct gs_port { + struct gs_dev *port_dev; /* pointer to device struct */ +@@ -185,10 +179,6 @@ static struct usb_request *gs_alloc_req( + gfp_t kmalloc_flags); + static void gs_free_req(struct usb_ep *ep, struct usb_request *req); + +-static struct gs_req_entry *gs_alloc_req_entry(struct usb_ep *ep, unsigned len, +- gfp_t kmalloc_flags); +-static void gs_free_req_entry(struct usb_ep *ep, struct gs_req_entry *req); +- + static int gs_alloc_ports(struct gs_dev *dev, gfp_t kmalloc_flags); + static void gs_free_ports(struct gs_dev *dev); + +@@ -966,7 +956,6 @@ static int gs_send(struct gs_dev *dev) + unsigned long flags; + struct usb_ep *ep; + struct usb_request *req; +- struct gs_req_entry *req_entry; + + if (dev == NULL) { + pr_err("gs_send: NULL device pointer\n"); +@@ -979,10 +968,8 @@ static int gs_send(struct gs_dev *dev) + + while(!list_empty(&dev->dev_req_list)) { + +- req_entry = list_entry(dev->dev_req_list.next, +- struct gs_req_entry, re_entry); +- +- req = req_entry->re_req; ++ req = list_entry(dev->dev_req_list.next, ++ struct usb_request, list); + + len = gs_send_packet(dev, req->buf, ep->maxpacket); + +@@ -992,7 +979,7 @@ static int gs_send(struct gs_dev *dev) + *((unsigned char *)req->buf), + *((unsigned char *)req->buf+1), + *((unsigned char *)req->buf+2)); +- list_del(&req_entry->re_entry); ++ list_del(&req->list); + req->length = len; + spin_unlock_irqrestore(&dev->dev_lock, flags); + if ((ret=usb_ep_queue(ep, req, GFP_ATOMIC))) { +@@ -1175,7 +1162,6 @@ requeue: + static void gs_write_complete(struct usb_ep *ep, struct usb_request *req) + { + struct gs_dev *dev = ep->driver_data; +- struct gs_req_entry *gs_req = req->context; + + if (dev == NULL) { + pr_err("gs_write_complete: NULL device pointer\n"); +@@ -1186,13 +1172,8 @@ static void gs_write_complete(struct usb + case 0: + /* normal completion */ + requeue: +- if (gs_req == NULL) { +- pr_err("gs_write_complete: NULL request pointer\n"); +- return; +- } +- + spin_lock(&dev->dev_lock); +- list_add(&gs_req->re_entry, &dev->dev_req_list); ++ list_add(&req->list, &dev->dev_req_list); + spin_unlock(&dev->dev_lock); + + gs_send(dev); +@@ -1731,7 +1712,6 @@ static int gs_set_config(struct gs_dev * + struct usb_ep *ep; + struct usb_endpoint_descriptor *ep_desc; + struct usb_request *req; +- struct gs_req_entry *req_entry; + + if (dev == NULL) { + pr_err("gs_set_config: NULL device pointer\n"); +@@ -1843,9 +1823,10 @@ static int gs_set_config(struct gs_dev * + /* allocate write requests, and put on free list */ + ep = dev->dev_in_ep; + for (i=0; i<write_q_size; i++) { +- if ((req_entry=gs_alloc_req_entry(ep, ep->maxpacket, GFP_ATOMIC))) { +- req_entry->re_req->complete = gs_write_complete; +- list_add(&req_entry->re_entry, &dev->dev_req_list); ++ req = gs_alloc_req(ep, ep->maxpacket, GFP_ATOMIC); ++ if (req) { ++ req->complete = gs_write_complete; ++ list_add(&req->list, &dev->dev_req_list); + } else { + pr_err("gs_set_config: cannot allocate " + "write requests\n"); +@@ -1883,7 +1864,7 @@ exit_reset_config: + */ + static void gs_reset_config(struct gs_dev *dev) + { +- struct gs_req_entry *req_entry; ++ struct usb_request *req; + + if (dev == NULL) { + pr_err("gs_reset_config: NULL device pointer\n"); +@@ -1897,10 +1878,10 @@ static void gs_reset_config(struct gs_de + + /* free write requests on the free list */ + while(!list_empty(&dev->dev_req_list)) { +- req_entry = list_entry(dev->dev_req_list.next, +- struct gs_req_entry, re_entry); +- list_del(&req_entry->re_entry); +- gs_free_req_entry(dev->dev_in_ep, req_entry); ++ req = list_entry(dev->dev_req_list.next, ++ struct usb_request, list); ++ list_del(&req->list); ++ gs_free_req(dev->dev_in_ep, req); + } + + /* disable endpoints, forcing completion of pending i/o; */ +@@ -2010,46 +1991,6 @@ static void gs_free_req(struct usb_ep *e + } + + /* +- * gs_alloc_req_entry +- * +- * Allocates a request and its buffer, using the given +- * endpoint, buffer len, and kmalloc flags. +- */ +-static struct gs_req_entry * +-gs_alloc_req_entry(struct usb_ep *ep, unsigned len, gfp_t kmalloc_flags) +-{ +- struct gs_req_entry *req; +- +- req = kmalloc(sizeof(struct gs_req_entry), kmalloc_flags); +- if (req == NULL) +- return NULL; +- +- req->re_req = gs_alloc_req(ep, len, kmalloc_flags); +- if (req->re_req == NULL) { +- kfree(req); +- return NULL; +- } +- +- req->re_req->context = req; +- +- return req; +-} +- +-/* +- * gs_free_req_entry +- * +- * Frees a request and its buffer. +- */ +-static void gs_free_req_entry(struct usb_ep *ep, struct gs_req_entry *req) +-{ +- if (ep != NULL && req != NULL) { +- if (req->re_req != NULL) +- gs_free_req(ep, req->re_req); +- kfree(req); +- } +-} +- +-/* + * gs_alloc_ports + * + * Allocate all ports and set the gs_dev struct to point to them. diff --git a/usb.current/usb-serial-gadget-simplify-endpoint-handling.patch b/usb.current/usb-serial-gadget-simplify-endpoint-handling.patch new file mode 100644 index 00000000000000..7b98140c3beea0 --- /dev/null +++ b/usb.current/usb-serial-gadget-simplify-endpoint-handling.patch @@ -0,0 +1,254 @@ +From linux-usb-owner@vger.kernel.org Wed May 7 14:45:49 2008 +From: David Brownell <david-b@pacbell.net> +Date: Wed, 7 May 2008 14:25:24 -0700 +Subject: USB: serial gadget: simplify endpoint handling +To: Greg KH <greg@kroah.com> +Cc: linux-usb@vger.kernel.org, Al Borchers <alborchers@steinerpoint.com> +Message-ID: <200805071425.24929.david-b@pacbell.net> +Content-Disposition: inline + + +Switch serial gadget away from a *very* old idiom: just remember +the endpoints we'll be using, instead of looking them up by name +each time. This is a net code and data (globals) shrink. + +Also fix a small memory leak in the rmmod path, by working the +same as the disconnect code. + +Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> +Cc: Al Borchers <alborchers@steinerpoint.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/gadget/serial.c | 146 +++++++++++++++++--------------------------- + 1 file changed, 57 insertions(+), 89 deletions(-) + +--- a/drivers/usb/gadget/serial.c ++++ b/drivers/usb/gadget/serial.c +@@ -198,10 +198,6 @@ static unsigned int gs_buf_get(struct gs + + static struct gs_dev *gs_device; + +-static const char *EP_IN_NAME; +-static const char *EP_OUT_NAME; +-static const char *EP_NOTIFY_NAME; +- + static struct mutex gs_open_close_lock[GS_NUM_PORTS]; + + +@@ -1217,13 +1213,8 @@ static void /* __init_or_exit */ gs_unbi + gs_free_req(gadget->ep0, dev->dev_ctrl_req); + dev->dev_ctrl_req = NULL; + } ++ gs_reset_config(dev); + gs_free_ports(dev); +- if (dev->dev_notify_ep) +- usb_ep_disable(dev->dev_notify_ep); +- if (dev->dev_in_ep) +- usb_ep_disable(dev->dev_in_ep); +- if (dev->dev_out_ep) +- usb_ep_disable(dev->dev_out_ep); + kfree(dev); + set_gadget_data(gadget, NULL); + } +@@ -1264,19 +1255,23 @@ static int __init gs_bind(struct usb_gad + __constant_cpu_to_le16(GS_VERSION_NUM|0x0099); + } + ++ dev = kzalloc(sizeof(struct gs_dev), GFP_KERNEL); ++ if (dev == NULL) ++ return -ENOMEM; ++ + usb_ep_autoconfig_reset(gadget); + + ep = usb_ep_autoconfig(gadget, &gs_fullspeed_in_desc); + if (!ep) + goto autoconf_fail; +- EP_IN_NAME = ep->name; +- ep->driver_data = ep; /* claim the endpoint */ ++ dev->dev_in_ep = ep; ++ ep->driver_data = dev; /* claim the endpoint */ + + ep = usb_ep_autoconfig(gadget, &gs_fullspeed_out_desc); + if (!ep) + goto autoconf_fail; +- EP_OUT_NAME = ep->name; +- ep->driver_data = ep; /* claim the endpoint */ ++ dev->dev_out_ep = ep; ++ ep->driver_data = dev; /* claim the endpoint */ + + if (use_acm) { + ep = usb_ep_autoconfig(gadget, &gs_fullspeed_notify_desc); +@@ -1286,8 +1281,8 @@ static int __init gs_bind(struct usb_gad + } + gs_device_desc.idProduct = __constant_cpu_to_le16( + GS_CDC_PRODUCT_ID), +- EP_NOTIFY_NAME = ep->name; +- ep->driver_data = ep; /* claim the endpoint */ ++ dev->dev_notify_ep = ep; ++ ep->driver_data = dev; /* claim the endpoint */ + } + + gs_device_desc.bDeviceClass = use_acm +@@ -1317,9 +1312,7 @@ static int __init gs_bind(struct usb_gad + gs_acm_config_desc.bmAttributes |= USB_CONFIG_ATT_WAKEUP; + } + +- gs_device = dev = kzalloc(sizeof(struct gs_dev), GFP_KERNEL); +- if (dev == NULL) +- return -ENOMEM; ++ gs_device = dev; + + snprintf(manufacturer, sizeof(manufacturer), "%s %s with %s", + init_utsname()->sysname, init_utsname()->release, +@@ -1351,6 +1344,7 @@ static int __init gs_bind(struct usb_gad + return 0; + + autoconf_fail: ++ kfree(dev); + pr_err("gs_bind: cannot autoconfigure on %s\n", gadget->name); + return -ENODEV; + } +@@ -1710,7 +1704,7 @@ static int gs_set_config(struct gs_dev * + int ret = 0; + struct usb_gadget *gadget = dev->dev_gadget; + struct usb_ep *ep; +- struct usb_endpoint_descriptor *ep_desc; ++ struct usb_endpoint_descriptor *out, *in, *notify; + struct usb_request *req; + + if (dev == NULL) { +@@ -1738,71 +1732,53 @@ static int gs_set_config(struct gs_dev * + return -EINVAL; + } + +- dev->dev_config = config; +- +- gadget_for_each_ep(ep, gadget) { +- +- if (EP_NOTIFY_NAME +- && strcmp(ep->name, EP_NOTIFY_NAME) == 0) { +- ep_desc = choose_ep_desc(gadget, ++ in = choose_ep_desc(gadget, ++ &gs_highspeed_in_desc, ++ &gs_fullspeed_in_desc); ++ out = choose_ep_desc(gadget, ++ &gs_highspeed_out_desc, ++ &gs_fullspeed_out_desc); ++ notify = dev->dev_notify_ep ++ ? choose_ep_desc(gadget, + &gs_highspeed_notify_desc, +- &gs_fullspeed_notify_desc); +- ret = usb_ep_enable(ep,ep_desc); +- if (ret == 0) { +- ep->driver_data = dev; +- dev->dev_notify_ep = ep; +- dev->dev_notify_ep_desc = ep_desc; +- } else { +- pr_err("gs_set_config: cannot enable NOTIFY " +- "endpoint %s, ret=%d\n", +- ep->name, ret); +- goto exit_reset_config; +- } +- } ++ &gs_fullspeed_notify_desc) ++ : NULL; + +- else if (strcmp(ep->name, EP_IN_NAME) == 0) { +- ep_desc = choose_ep_desc(gadget, +- &gs_highspeed_in_desc, +- &gs_fullspeed_in_desc); +- ret = usb_ep_enable(ep,ep_desc); +- if (ret == 0) { +- ep->driver_data = dev; +- dev->dev_in_ep = ep; +- dev->dev_in_ep_desc = ep_desc; +- } else { +- pr_err("gs_set_config: cannot enable IN " +- "endpoint %s, ret=%d\n", +- ep->name, ret); +- goto exit_reset_config; +- } +- } +- +- else if (strcmp(ep->name, EP_OUT_NAME) == 0) { +- ep_desc = choose_ep_desc(gadget, +- &gs_highspeed_out_desc, +- &gs_fullspeed_out_desc); +- ret = usb_ep_enable(ep,ep_desc); +- if (ret == 0) { +- ep->driver_data = dev; +- dev->dev_out_ep = ep; +- dev->dev_out_ep_desc = ep_desc; +- } else { +- pr_err("gs_set_config: cannot enable OUT " +- "endpoint %s, ret=%d\n", +- ep->name, ret); +- goto exit_reset_config; +- } +- } ++ ret = usb_ep_enable(dev->dev_in_ep, in); ++ if (ret == 0) { ++ dev->dev_in_ep_desc = in; ++ } else { ++ pr_debug("%s: cannot enable %s %s, ret=%d\n", ++ __func__, "IN", dev->dev_in_ep->name, ret); ++ return ret; ++ } + ++ ret = usb_ep_enable(dev->dev_out_ep, out); ++ if (ret == 0) { ++ dev->dev_out_ep_desc = out; ++ } else { ++ pr_debug("%s: cannot enable %s %s, ret=%d\n", ++ __func__, "OUT", dev->dev_out_ep->name, ret); ++fail0: ++ usb_ep_disable(dev->dev_in_ep); ++ return ret; + } + +- if (dev->dev_in_ep == NULL || dev->dev_out_ep == NULL +- || (config != GS_BULK_CONFIG_ID && dev->dev_notify_ep == NULL)) { +- pr_err("gs_set_config: cannot find endpoints\n"); +- ret = -ENODEV; +- goto exit_reset_config; ++ if (notify) { ++ ret = usb_ep_enable(dev->dev_notify_ep, notify); ++ if (ret == 0) { ++ dev->dev_notify_ep_desc = notify; ++ } else { ++ pr_debug("%s: cannot enable %s %s, ret=%d\n", ++ __func__, "NOTIFY", ++ dev->dev_notify_ep->name, ret); ++ usb_ep_disable(dev->dev_out_ep); ++ goto fail0; ++ } + } + ++ dev->dev_config = config; ++ + /* allocate and queue read requests */ + ep = dev->dev_out_ep; + for (i=0; i<read_q_size && ret == 0; i++) { +@@ -1886,18 +1862,10 @@ static void gs_reset_config(struct gs_de + + /* disable endpoints, forcing completion of pending i/o; */ + /* completion handlers free their requests in this case */ +- if (dev->dev_notify_ep) { ++ if (dev->dev_notify_ep) + usb_ep_disable(dev->dev_notify_ep); +- dev->dev_notify_ep = NULL; +- } +- if (dev->dev_in_ep) { +- usb_ep_disable(dev->dev_in_ep); +- dev->dev_in_ep = NULL; +- } +- if (dev->dev_out_ep) { +- usb_ep_disable(dev->dev_out_ep); +- dev->dev_out_ep = NULL; +- } ++ usb_ep_disable(dev->dev_in_ep); ++ usb_ep_disable(dev->dev_out_ep); + } + + /* diff --git a/usb.current/usb-support-for-the-et502hs-hdspa-modem-in-option-driver.patch b/usb.current/usb-support-for-the-et502hs-hdspa-modem-in-option-driver.patch new file mode 100644 index 00000000000000..8d18d7ee7d12dd --- /dev/null +++ b/usb.current/usb-support-for-the-et502hs-hdspa-modem-in-option-driver.patch @@ -0,0 +1,41 @@ +From andreoli@samba.ing.unimo.it Thu May 1 08:28:25 2008 +From: andreoli@samba.ing.unimo.it +Date: Thu, 1 May 2008 19:26:16 +0200 (CEST) +Subject: USB: Support for the ET502HS HDSPA modem in option driver +To: smurf@smurf.noris.de +Cc: linux-usb@vger.kernel.org, greg@kroah.com, stern@rowland.harvard.edu +Message-ID: <34161.217.201.68.121.1209662776.squirrel@weblab.ing.unimo.it> + + +the proposed patch allows the ET502HS HDSPA modem to be handled by the +"option" driver. It has been tested for 1 month and works reliably (no +oopses, no hangs, 300KB/s throughput). + +Signed-off-by: Mauro Andreolini <andreoli@weblab.ing.unimo.it> +Signed-off-by: Matthias Urlichs <matthias@urlichs.de> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/option.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -184,6 +184,9 @@ static int option_send_setup(struct usb + #define AXESSTEL_VENDOR_ID 0x1726 + #define AXESSTEL_PRODUCT_MV110H 0x1000 + ++#define ONDA_VENDOR_ID 0x19d2 ++#define ONDA_PRODUCT_ET502HS 0x0002 ++ + #define BANDRICH_VENDOR_ID 0x1A8D + #define BANDRICH_PRODUCT_C100_1 0x1002 + #define BANDRICH_PRODUCT_C100_2 0x1003 +@@ -296,6 +299,7 @@ static struct usb_device_id option_ids[] + { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, + { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, + { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) }, ++ { USB_DEVICE(ONDA_VENDOR_ID, ONDA_PRODUCT_ET502HS) }, + { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_1) }, + { USB_DEVICE(BANDRICH_VENDOR_ID, BANDRICH_PRODUCT_C100_2) }, + { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, diff --git a/usb.current/usb-support-for-the-et502hs-hdspa-modem.patch b/usb.current/usb-support-for-the-et502hs-hdspa-modem.patch new file mode 100644 index 00000000000000..f40e08c9a6e307 --- /dev/null +++ b/usb.current/usb-support-for-the-et502hs-hdspa-modem.patch @@ -0,0 +1,38 @@ +From linux-usb-owner@vger.kernel.org Thu May 1 08:22:18 2008 +From: andreoli@samba.ing.unimo.it +Date: Thu, 1 May 2008 19:17:28 +0200 (CEST) +Subject: USB: Support for the ET502HS HDSPA modem +To: stern@rowland.harvard.edu +Cc: linux-usb@vger.kernel.org, greg@kroah.com, usb-storage@lists.one-eyed-alien.net +Message-ID: <57812.217.201.68.121.1209662248.squirrel@weblab.ing.unimo.it> + +The attached patch allows to bypass the ZeroCD mechanism for the ET502HS +HDSPA modem, so that it can be mounted as a network device. + +Signed-off-by: Mauro Andreolini <andreoli@weblab.ing.unimo.it> +Acked-by: Alan Stern <stern@rowland.harvard.edu> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/storage/unusual_devs.h | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/usb/storage/unusual_devs.h ++++ b/drivers/usb/storage/unusual_devs.h +@@ -1684,6 +1684,16 @@ UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x + US_SC_DEVICE, US_PR_DEVICE, NULL, + US_FL_IGNORE_RESIDUE ), + ++/* Reported by Mauro Andreolini <andreoli@weblab.ing.unimo.it> ++ * This entry is needed to bypass the ZeroCD mechanism ++ * and to properly load as a modem device. ++ */ ++UNUSUAL_DEV( 0x19d2, 0x2000, 0x0000, 0x0000, ++ "Onda ET502HS", ++ "USB MMC Storage", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ US_FL_IGNORE_DEVICE), ++ + /* patch submitted by Davide Perini <perini.davide@dpsoftware.org> + * and Renato Perini <rperini@email.it> + */ diff --git a/usb.current/usb-unusual_devs-add-support-for-gi-0401-sd-card-interface.patch b/usb.current/usb-unusual_devs-add-support-for-gi-0401-sd-card-interface.patch new file mode 100644 index 00000000000000..64c211badd0cbc --- /dev/null +++ b/usb.current/usb-unusual_devs-add-support-for-gi-0401-sd-card-interface.patch @@ -0,0 +1,93 @@ +From linux-usb-owner@vger.kernel.org Thu May 8 10:57:15 2008 +From: Filip Aben <f.aben@option.com> +Date: Thu, 08 May 2008 10:48:12 -0700 +Subject: USB: unusual_devs: Add support for GI 0401 SD-Card interface +To: Greg KH <greg@kroah.com> +Cc: USB Dev <linux-usb@vger.kernel.org>, USB Storage list <usb-storage@lists.one-eyed-alien.net>, f.aben@option.com +Message-ID: <48233CDC.9030700@ipom.com> + + +From: Filip Aben <f.aben@option.com> + +Enables the SD-Card interface on the GI 0401 HSUPA card from Option. + +The unusual_devs.h entry is necessary because the device descriptor is +vendor-specific. That prevents usb-storage from binding to it as an +interface driver. + +This revised patch adds a small comment explaining why and reduces the +rev range. + +T: Bus=02 Lev=01 Prnt=01 Port=06 Cnt=01 Dev#= 3 Spd=480 MxCh= 0 +D: Ver= 2.00 Cls=ff(vend.) Sub=ff Prot=ff MxPS=64 #Cfgs= 1 +P: Vendor=0af0 ProdID=7401 Rev= 0.00 +S: Manufacturer=Option N.V. +S: Product=Globetrotter HSUPA Modem +C:* #Ifs=10 Cfg#= 1 Atr=80 MxPwr=500mA +I:* If#= 0 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +I: If#= 0 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms +I:* If#= 1 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +I: If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms +I:* If#= 2 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +I: If#= 2 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms +I:* If#= 3 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +I: If#= 3 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms +I:* If#= 4 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +I: If#= 4 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms +I:* If#= 5 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +I: If#= 5 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms +I:* If#= 6 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +I: If#= 6 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms +I:* If#= 7 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +I: If#= 7 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=08(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms +I:* If#= 8 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +E: Ad=89(I) Atr=03(Int.) MxPS= 64 Ivl=2ms +E: Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=09(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms +I:* If#= 9 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage +E: Ad=0a(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=8b(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms + +Signed-off-by: Filip Aben <f.aben@option.com> +Signed-off-by: Phil Dibowitz <phil@ipom.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/storage/unusual_devs.h | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/usb/storage/unusual_devs.h ++++ b/drivers/usb/storage/unusual_devs.h +@@ -1311,6 +1311,16 @@ UNUSUAL_DEV( 0x0ace, 0x20ff, 0x0101, 0x0 + US_SC_DEVICE, US_PR_DEVICE, NULL, + US_FL_IGNORE_DEVICE ), + ++/* Reported by F. Aben <f.aben@option.com> ++ * This device (wrongly) has a vendor-specific device descriptor. ++ * The entry is needed so usb-storage can bind to it's mass-storage ++ * interface as an interface driver */ ++UNUSUAL_DEV( 0x0af0, 0x7401, 0x0000, 0x0000, ++ "Option", ++ "GI 0401 SD-Card", ++ US_SC_DEVICE, US_PR_DEVICE, NULL, ++ 0 ), ++ + #ifdef CONFIG_USB_STORAGE_ISD200 + UNUSUAL_DEV( 0x0bf6, 0xa001, 0x0100, 0x0110, + "ATI", diff --git a/usb.current/usb-use-get_unaligned_-helpers-for-kl5kusb105-driver.patch b/usb.current/usb-use-get_unaligned_-helpers-for-kl5kusb105-driver.patch new file mode 100644 index 00000000000000..aeb81cd6306dd1 --- /dev/null +++ b/usb.current/usb-use-get_unaligned_-helpers-for-kl5kusb105-driver.patch @@ -0,0 +1,27 @@ +From harvey.harrison@gmail.com Thu May 1 20:52:48 2008 +From: Harvey Harrison <harvey.harrison@gmail.com> +Date: Thu, 01 May 2008 20:52:57 -0700 +Subject: USB: use get_unaligned_* helpers for kl5kusb105 driver +To: Andrew Morton <akpm@linux-foundation.org> +Cc: Greg KH <gregkh@suse.de>, LKML <linux-kernel@vger.kernel.org> +Message-ID: <1209700377.22362.20.camel@brick> + + +Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> + +--- + drivers/usb/serial/kl5kusb105.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/serial/kl5kusb105.c ++++ b/drivers/usb/serial/kl5kusb105.c +@@ -236,7 +236,7 @@ static int klsi_105_get_line_state(struc + if (rc < 0) + err("Reading line status failed (error = %d)", rc); + else { +- status = le16_to_cpu(get_unaligned((__le16 *)status_buf)); ++ status = get_unaligned_le16(status_buf); + + info("%s - read status %x %x", __func__, + status_buf[0], status_buf[1]); |
