From: Greg KH To: torvalds@transmeta.com Cc: linux-usb-devel@lists.sourceforge.net Subject: [BK PATCH] USB changes for 2.5.15 This includes 5 new changesets from the last round that I posted on Saturday evening. Pull from: bk://linuxusb.bkbits.net/linus-2.5 drivers/usb/core/hcd.c | 4 drivers/usb/core/hcd.h | 3 drivers/usb/core/hub.c | 99 +++ drivers/usb/core/hub.h | 28 drivers/usb/core/usb.c | 81 +- drivers/usb/host/ehci-hcd.c | 97 ++- drivers/usb/host/ehci-q.c | 19 drivers/usb/host/uhci.c | 86 +- drivers/usb/host/usb-ohci.c | 24 drivers/usb/host/usb-uhci.c | 14 drivers/usb/media/usbvideo.c | 4 drivers/usb/net/cdc-ether.c | 4 drivers/usb/net/pegasus.c | 4 drivers/usb/net/usbnet.c | 4 drivers/usb/storage/Config.help | 4 drivers/usb/storage/Config.in | 1 drivers/usb/storage/Makefile | 1 drivers/usb/storage/datafab.c | 40 + drivers/usb/storage/debug.c | 11 drivers/usb/storage/freecom.c | 2 drivers/usb/storage/isd200.c | 364 +++++------ drivers/usb/storage/jumpshot.c | 45 + drivers/usb/storage/protocol.c | 68 +- drivers/usb/storage/scsiglue.c | 159 ++--- drivers/usb/storage/sddr09.c | 33 - drivers/usb/storage/sddr55.c | 1135 ++++++++++++++++++++++++++++++++++++ drivers/usb/storage/sddr55.h | 34 + drivers/usb/storage/shuttle_usbat.c | 25 drivers/usb/storage/transport.c | 583 +++++++++++------- drivers/usb/storage/transport.h | 8 drivers/usb/storage/unusual_devs.h | 96 ++- drivers/usb/storage/usb.c | 84 +- drivers/usb/storage/usb.h | 27 include/linux/usb.h | 78 -- 34 files changed, 2451 insertions(+), 818 deletions(-) ------ ChangeSet@1.548, 2002-05-13 15:51:10-07:00, greg@kroah.com USB sddr55 minor patch to enable a MDSM-B reader This was forgotten in the previous sddr55 patch import, and is needed to support the MDSM-B reader devices. Thanks to Andries.Brouwer@cwi.nl for the 2.4.x version of the patch. drivers/usb/storage/unusual_devs.h | 9 +++++++++ 1 files changed, 9 insertions(+) ------ ChangeSet@1.547, 2002-05-13 14:52:23-07:00, greg@kroah.com [PATCH] USB device reference counting api cleanup changes This patch replaces the awkwardly named usb_inc_dev_use() and usb_dec_dev_use() with usb_get_dev() and usb_put_dev() to match the naming convention of the rest of the kernel's reference counted structures. It also does away with the special case of usb_free_dev(), and has usb_put_dev() be the same thing (through a #define, just like usb_free_urb() works.) Now when the last person calls usb_put_dev() or usb_free_dev() the structure is cleaned up. This allows the different host controller drivers to implement their logic differently if they want to (as they do), and everyone can be happy and stop arguing about the "proper" way to write their host controller drivers :) drivers/usb/core/hcd.c | 4 ++-- drivers/usb/core/usb.c | 43 +++++++++++++++++++++++++++++++++++-------- drivers/usb/host/uhci.c | 14 +++++++------- drivers/usb/host/usb-ohci.c | 24 ++++++++++++------------ drivers/usb/host/usb-uhci.c | 14 +++++++------- drivers/usb/media/usbvideo.c | 4 ++-- drivers/usb/net/cdc-ether.c | 4 ++-- drivers/usb/net/pegasus.c | 4 ++-- drivers/usb/net/usbnet.c | 4 ++-- drivers/usb/storage/usb.c | 20 ++++++++++---------- include/linux/usb.h | 34 +++------------------------------- 11 files changed, 84 insertions(+), 85 deletions(-) ------ ChangeSet@1.546, 2002-05-13 14:48:22-07:00, johannes@erdfelt.com [PATCH] USB device reference counting fix for uhci.c and usb core Earlier in the 2.5 development cycle a patch was applied that changed the reference counting behaviour for USB devices. There are a couple of problems with the change: - It made the USB code more complicated as a whole with the introduction of an additional cleanup path for devices. Using the traditional method of reference counting, cleanup is handled implictly - It reduces functionality by requiring a callback for all references to the device, but doesn't provide a method of providing callbacks for references. It relies on the hardcoded device driver ->disconnect and HCD ->deallocate method for callbacks The traditional method of using reference counting supports as many reference users as needed, without complicating it with mandatory callbacks to cleanup references. The change in 2.5 also only helps catch one subset of programming problem in device drivers, the case where it decrements too many times. That is of dubious debugging value. So, this patch reverts the change and makes the reference counting behave like it does in the rest of the kernel as well as how the USB code does in 2.4. This patch doesn't remove all of the superfluous code. Some drivers, like usb-ohci, ohci-hcd and ehci-hcd have some code that is no longer needed. I wanted to spend some more time with those drivers since the changes weren't as trivial as uhci.c and usb-uhci.c. I've tested with uhci and usb-ohci with no adverse effects. drivers/usb/core/hcd.h | 3 --- drivers/usb/core/usb.c | 20 +++++++------------- drivers/usb/host/uhci.c | 15 --------------- include/linux/usb.h | 25 +++++++------------------ 4 files changed, 14 insertions(+), 49 deletions(-) ------ ChangeSet@1.545, 2002-05-13 14:48:05-07:00, greg@kroah.com [PATCH] usb_submit_urb fix for broken usb devices added check for wMaxPacketSize of 0, which is a messed up device, but seems to be legal according to the USB spec. Thanks to Johannes for figuring out the problem, and providing an original version of this patch. drivers/usb/core/usb.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) ------ ChangeSet@1.544, 2002-05-13 14:25:19-07:00, manfred@colorfullife.com [PATCH] usb-storage locking fixes I found several SMP and UP locking errors in usb-storage, attached is a patch: Changes: * srb->result is a bitfield, several << 1 were missing. * add scsi_lock calls around midlayer calls, release the lock before calling usb functions that might sleep. * replace the queue semaphore with a queue spinlocks, queuecommand is called from bh context. drivers/usb/storage/datafab.c | 2 +- drivers/usb/storage/isd200.c | 2 +- drivers/usb/storage/jumpshot.c | 2 +- drivers/usb/storage/scsiglue.c | 26 ++++++++++++++++++++------ drivers/usb/storage/usb.c | 31 +++++++++++++++++-------------- drivers/usb/storage/usb.h | 14 +++++++++++++- 6 files changed, 53 insertions(+), 24 deletions(-) ------ ChangeSet@1.543, 2002-05-11 22:18:37-07:00, greg@kroah.com USB storage added Sandisk SDDR-55 driver from Simon Munton drivers/usb/storage/Config.help | 4 drivers/usb/storage/Config.in | 1 drivers/usb/storage/Makefile | 1 drivers/usb/storage/sddr55.c | 1135 +++++++++++++++++++++++++++++++++++++ drivers/usb/storage/sddr55.h | 34 + drivers/usb/storage/transport.h | 3 drivers/usb/storage/unusual_devs.h | 8 drivers/usb/storage/usb.c | 12 8 files changed, 1198 insertions(+) ------ ChangeSet@1.542, 2002-05-11 22:05:14-07:00, greg@kroah.com USB storage drivers fix for scsi memory address changes. Now the datafab and jumpshot drivers build properly. drivers/usb/storage/datafab.c | 8 ++++---- drivers/usb/storage/jumpshot.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) ------ ChangeSet@1.541, 2002-05-11 22:04:21-07:00, greg@kroah.com USB storage fixed typo in variable name. drivers/usb/storage/shuttle_usbat.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) ------ ChangeSet@1.540, 2002-05-11 21:48:09-07:00, greg@kroah.com USB storage sync up with both the -dj and cvs version of the usb-storage code. drivers/usb/storage/datafab.c | 30 + drivers/usb/storage/debug.c | 11 drivers/usb/storage/freecom.c | 2 drivers/usb/storage/isd200.c | 362 ++++++++++------------ drivers/usb/storage/jumpshot.c | 35 +- drivers/usb/storage/protocol.c | 68 ++-- drivers/usb/storage/scsiglue.c | 133 +++----- drivers/usb/storage/sddr09.c | 33 -- drivers/usb/storage/shuttle_usbat.c | 23 - drivers/usb/storage/transport.c | 583 ++++++++++++++++++++++-------------- drivers/usb/storage/transport.h | 5 drivers/usb/storage/unusual_devs.h | 79 ++++ drivers/usb/storage/usb.c | 21 - drivers/usb/storage/usb.h | 13 14 files changed, 832 insertions(+), 566 deletions(-) ------ ChangeSet@1.539, 2002-05-11 21:16:49-07:00, johannes@erdfelt.com [PATCH] uhci.c FSBR timeout There was a discussion a long time ago about how safe the bit operations were as well as recently. set_bit/clear_bit are not safe on x86 UP, nor are they safe on other architectures. It's also unclear from the UHCI spec if the HC's are safe with respect to atomic updates to the status field. This patch ditches all of the uses of set_bit and clear_bit and changes the algorithm that depended on it. The FSBR timeout algorithm would reenable FSBR for transfers when they started making progress again. So instead of trying for this best case, we convert the transfer over to depth first from the standard breadth first. To make sure the transfer doesn't hog all of the bandwidth, every 5th TD is left in breadth first mode. This will ensure other transfers get some bandwidth. It's not perfect, but I think it's a good compromise. Note: td->info is read only by the HC, so we can touch it whenever we want. drivers/usb/host/uhci.c | 57 +++++++++++++++++++++++++++--------------------- 1 files changed, 33 insertions(+), 24 deletions(-) ------ ChangeSet@1.538, 2002-05-11 21:16:35-07:00, david-b@pacbell.net [PATCH] -- hub/tt error recovery This patch adds missing functionality to the transaction translator support for USB 2.0 hubs: - moves the 'struct usb_tt' definition to "hub.h" from - adds state to it as neeed for some control/bulk error recovery - teaches the hub driver how to use that state (via keventd) - adds a call letting HCDs trigger that recovery drivers/usb/core/hub.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++ drivers/usb/core/hub.h | 28 +++++++++++++ drivers/usb/core/usb.c | 7 +-- include/linux/usb.h | 19 +-------- 4 files changed, 133 insertions(+), 20 deletions(-) ------ ChangeSet@1.537, 2002-05-11 21:16:19-07:00, david-b@pacbell.net [PATCH] -- ehci misc FIXMEs This addresses FIXME comments in the EHCI code, notably: - telling the hub driver to clear up TT error state (relies on the hub error recovery patch I just sent) - using 64bit PCI DMA where appropriate - handling BIOS handoff as neeed except that the repository that you are pushing to is 40 changesets ahead of your repository. Please do a "bk pull" to get these changes or do a "bk pull -nl" to see what they are. drivers/usb/host/ehci-hcd.c | 97 +++++++++++++++++++++++++++++++------------- drivers/usb/host/ehci-q.c | 19 ++++---- 2 files changed, 78 insertions(+), 38 deletions(-) ------