• Jussi Kivilinna's avatar
    zd1211rw: fix to work on OHCI · 59342f6a
    Jussi Kivilinna authored
    zd1211 devices register 'EP 4 OUT' endpoint as Interrupt type on USB 2.0:
    
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x04  EP 4 OUT
            bmAttributes            3
              Transfer Type            Interrupt
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               1
    
    However on USB 1.1 endpoint becomes Bulk:
    
          Endpoint Descriptor:
            bLength                 7
            bDescriptorType         5
            bEndpointAddress     0x04  EP 4 OUT
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               0
    
    Commit 37939810 assumed that endpoint is
    always interrupt type and changed usb_bulk_msg() calls to usb_interrupt_msg().
    
    Problem here is that usb_bulk_msg() on interrupt endpoint selfcorrects the
    call and changes requested pipe to interrupt type (see usb_bulk_msg).
    However with usb_interrupt_msg() on bulk endpoint does not correct the
    pipe type to bulk, but instead URB is submitted with interrupt type pipe.
    
    So pre-2.6.39 used usb_bulk_msg() and therefore worked with both endpoint
    types, however in 2.6.39 usb_interrupt_msg() with bulk endpoint causes
    ohci_hcd to fail submitted URB instantly with -ENOSPC and preventing zd1211rw
    from working with OHCI.
    
    Fix this by detecting endpoint type and using correct endpoint/pipe types
    for URB. Also fix asynchronous zd_usb_iowrite16v_async() to use right
    URB type on 'EP 4 OUT'.
    
    Cc: stable@kernel.org
    Signed-off-by: default avatarJussi Kivilinna <jussi.kivilinna@mbnet.fi>
    Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
    59342f6a
zd_usb.c 48.1 KB