1. 24 Mar, 2009 13 commits
    • Julia Lawall's avatar
      USB: drivers: use USB API functions rather than constants · 2e0fe709
      Julia Lawall authored
      This set of patches introduces calls to the following set of functions:
      
      usb_endpoint_dir_in(epd)
      usb_endpoint_dir_out(epd)
      usb_endpoint_is_bulk_in(epd)
      usb_endpoint_is_bulk_out(epd)
      usb_endpoint_is_int_in(epd)
      usb_endpoint_is_int_out(epd)
      usb_endpoint_num(epd)
      usb_endpoint_type(epd)
      usb_endpoint_xfer_bulk(epd)
      usb_endpoint_xfer_control(epd)
      usb_endpoint_xfer_int(epd)
      usb_endpoint_xfer_isoc(epd)
      
      In some cases, introducing one of these functions is not possible, and it
      just replaces an explicit integer value by one of the following constants:
      
      USB_ENDPOINT_XFER_BULK
      USB_ENDPOINT_XFER_CONTROL
      USB_ENDPOINT_XFER_INT
      USB_ENDPOINT_XFER_ISOC
      
      An extract of the semantic patch that makes these changes is as follows:
      (http://www.emn.fr/x-info/coccinelle/)
      
      // <smpl>
      @r1@ struct usb_endpoint_descriptor *epd; @@
      
      - ((epd->bmAttributes & \(USB_ENDPOINT_XFERTYPE_MASK\|3\)) ==
      - \(USB_ENDPOINT_XFER_CONTROL\|0\))
      + usb_endpoint_xfer_control(epd)
      
      @r5@ struct usb_endpoint_descriptor *epd; @@
      
      - ((epd->bEndpointAddress & \(USB_ENDPOINT_DIR_MASK\|0x80\)) ==
      -  \(USB_DIR_IN\|0x80\))
      + usb_endpoint_dir_in(epd)
      
      @inc@
      @@
      
      #include <linux/usb.h>
      
      @depends on !inc && (r1||r5)@
      @@
      
      + #include <linux/usb.h>
        #include <linux/usb/...>
      // </smpl>
      Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      2e0fe709
    • Julia Lawall's avatar
      USB: Remove redundant test in pxa27x_udc and ftdi_sio · 00185a60
      Julia Lawall authored
      priv is checked not to be NULL near the beginning of the function and not
      changed subsequently, making the test redundant.
      
      A simplified version of the semantic patch that makes this change is as
      follows: (http://www.emn.fr/x-info/coccinelle/)
      
      // <smpl>
      @r exists@
      local idexpression x;
      expression E;
      position p1,p2;
      @@
      
      if (x@p1 == NULL || ...) { ... when forall
         return ...; }
      ... when != \(x=E\|x--\|x++\|--x\|++x\|x-=E\|x+=E\|x|=E\|x&=E\|&x\)
      (
      x@p2 == NULL
      |
      x@p2 != NULL
      )
      
      // another path to the test that is not through p1?
      @s exists@
      local idexpression r.x;
      position r.p1,r.p2;
      @@
      
      ... when != x@p1
      (
      x@p2 == NULL
      |
      x@p2 != NULL
      )
      
      @fix depends on !s@
      position r.p1,r.p2;
      expression x,E;
      statement S1,S2;
      @@
      
      (
      - if ((x@p2 != NULL) || ...)
        S1
      |
      - if ((x@p2 == NULL) && ...) S1
      |
      - BUG_ON(x@p2 == NULL);
      )
      // </smpl>
      Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      00185a60
    • Julia Lawall's avatar
      USB: ub: use USB API functions rather than constants · db5e6df1
      Julia Lawall authored
      This set of patches introduces calls to the following set of functions:
      
      usb_endpoint_dir_in(epd)
      usb_endpoint_dir_out(epd)
      usb_endpoint_is_bulk_in(epd)
      usb_endpoint_is_bulk_out(epd)
      usb_endpoint_is_int_in(epd)
      usb_endpoint_is_int_out(epd)
      usb_endpoint_num(epd)
      usb_endpoint_type(epd)
      usb_endpoint_xfer_bulk(epd)
      usb_endpoint_xfer_control(epd)
      usb_endpoint_xfer_int(epd)
      usb_endpoint_xfer_isoc(epd)
      
      In some cases, introducing one of these functions is not possible, and it
      just replaces an explicit integer value by one of the following constants:
      
      USB_ENDPOINT_XFER_BULK
      USB_ENDPOINT_XFER_CONTROL
      USB_ENDPOINT_XFER_INT
      USB_ENDPOINT_XFER_ISOC
      
      An extract of the semantic patch that makes these changes is as follows:
      (http://www.emn.fr/x-info/coccinelle/)
      
      // <smpl>
      @r1@ struct usb_endpoint_descriptor *epd; @@
      
      - ((epd->bmAttributes & \(USB_ENDPOINT_XFERTYPE_MASK\|3\)) ==
      - \(USB_ENDPOINT_XFER_CONTROL\|0\))
      + usb_endpoint_xfer_control(epd)
      
      @r5@ struct usb_endpoint_descriptor *epd; @@
      
      - ((epd->bEndpointAddress & \(USB_ENDPOINT_DIR_MASK\|0x80\)) ==
      -  \(USB_DIR_IN\|0x80\))
      + usb_endpoint_dir_in(epd)
      
      @inc@
      @@
      
      #include <linux/usb.h>
      
      @depends on !inc && (r1||r5)@
      @@
      
      + #include <linux/usb.h>
        #include <linux/usb/...>
      // </smpl>
      Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      
      db5e6df1
    • Julia Lawall's avatar
      USB: Move definitions from usb.h to usb/ch9.h · 4d6914b7
      Julia Lawall authored
      The functions:
      
      usb_endpoint_dir_in(epd)
      usb_endpoint_dir_out(epd)
      usb_endpoint_is_bulk_in(epd)
      usb_endpoint_is_bulk_out(epd)
      usb_endpoint_is_int_in(epd)
      usb_endpoint_is_int_out(epd)
      usb_endpoint_is_isoc_in(epd)
      usb_endpoint_is_isoc_out(epd)
      usb_endpoint_num(epd)
      usb_endpoint_type(epd)
      usb_endpoint_xfer_bulk(epd)
      usb_endpoint_xfer_control(epd)
      usb_endpoint_xfer_int(epd)
      usb_endpoint_xfer_isoc(epd)
      
      are moved from include/linux/usb.h to include/linux/usb/ch9.h.
      include/linux/usb/ch9.h makes more sense for these functions because they
      only depend on constants that are defined in this file.
      Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
      Acked-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      4d6914b7
    • Robert Jarzmik's avatar
      USB: pxa27x_udc: add vbus_draw callback · ee069fb1
      Robert Jarzmik authored
      Add the vbus_draw() callback to inform the transceiver, if
      it exists, how much current may be drawn. The decision is
      taken on gadget driver side using the configuration chosen
      by the host and its bMaxPower field.  Some systems can use
      the host's VBUS supply to augment or recharge a battery.
      (There's also a default of 100 mA for unconfigured devices,
      or 8 mA if they're OTG devices.)
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      ee069fb1
    • Robert Jarzmik's avatar
      USB: pxa27x_udc: add otg transceiver support · 7fec3c25
      Robert Jarzmik authored
      When a transceiver driver is used, no automatic udc enable
      is done. The transceiver (OTG or not) should :
       - take care of VBus sensing
       - call usb_gadget_vbus_connect()
       - call usb_gadget_vbus_disconnect()
      
      The pullup should remain within this driver's management,
      either by gpio_pullup of udc_command() fields.
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      7fec3c25
    • Robert Jarzmik's avatar
      USB: pxa27x_udc: add vbus session handling · b799a7eb
      Robert Jarzmik authored
      On vbus_session() call, optionally activate D+ pullup
      resistor and enable the udc, or deactivate D+ pullup
      resistor and disable the udc.
      
      It is intentional to not handle any VBus sense related irq.
      An external transceiver driver (like gpio_vbus) should
      catch VBus sense signal, and call usb_gadget_vbus_connect()
      or usb_gadget_vbus_disconnect().
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      b799a7eb
    • Robert Jarzmik's avatar
      USB: pxa27x_udc: factor pullup code to prepare otg transceiver · eb507025
      Robert Jarzmik authored
      Prepare pxa27x_udc to handle usb D+ pullup properly : it
      should connect the pullup resistor and disconnect it only
      if no external transceiver is handling it.
      
      [ dbrownell@users.sourceforge.net: kerneldoc and gpio fixes ]
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      eb507025
    • Robert Jarzmik's avatar
      USB: gpio_vbus: add delayed vbus_session calls · c2344f13
      Robert Jarzmik authored
      Call usb_gadget_vbus_connect() and ...disconnect() from a
      workqueue rather than from an irq handler, allowing msleep()
      calls in vbus_session.  Update kerneldoc to match.
      
      [ dbrownell@users.sourceforge.net: more kerneldoc updates ]
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      c2344f13
    • Pete Zaitcev's avatar
      usblp: continuously poll for status · dd44be6b
      Pete Zaitcev authored
      The usblp in 2.6.18 polled for status regardless if we actually needed it.
      At some point I dropped it, to save the batteries if nothing else.
      As it turned out, printers exist (e.g. Canon BJC-3000) that need prodding
      this way or else they stop. This patch restores the old behaviour.
      If you want to save battery, don't leave jobs in the print queue.
      
      I tested this on my printers by printing and examining usbmon traces
      to make sure status is being requested and printers continue to print.
      Tuomas Jäntti verified the fix on BJC-3000.
      Signed-off-by: default avatarPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      dd44be6b
    • Alan Stern's avatar
      USB: usb-storage: increase max_sectors for tape drives · 5c16034d
      Alan Stern authored
      This patch (as1203) increases the max_sector limit for USB tape
      drives.  By default usb-storage sets max_sectors to 240 (i.e., 120 KB)
      for all devices.  But tape drives need a higher limit, since tapes can
      and do have very large block sizes.  Without the ability to transfer
      an entire large block in a single command, such tapes can't be used.
      
      This fixes Bugzilla #12207.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-and-tested-by: default avatarPhil Mitchell <philipm@sybase.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      5c16034d
    • David Brownell's avatar
      USB: gadget: fix rndis regression · 090b9011
      David Brownell authored
      Restore some code that was wrongly dropped from the RNDIS
      driver, and caused interop problems observed with OpenMoko.
      
      The issue is with hardware which needs help conforming to part
      of the USB 2.0 spec (section 8.5.3.2); some can automagically
      send a ZLP in response to an unexpected IN, but not all chips
      will do that.  We don't need to check the packet length ourselves
      the way earlier code did, since the UDC must already check it.
      But we do need to tell the UDC when it must force a short packet
      termination of the data stage.
      
      (Based on a patch from Aric D. Blumer <aric at sdgsystems.com>)
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      090b9011
    • Alan Stern's avatar
      USB: add quirk to avoid config and interface strings · 1662e3a7
      Alan Stern authored
      Apparently the Configuration and Interface strings aren't used as
      often as the Vendor, Product, and Serial strings.  In at least one
      device (a Saitek Cyborg Gold 3D joystick), attempts to read the
      Configuration string cause the device to stop responding to Control
      requests.
      
      This patch (as1226) adds a quirks flag, telling the kernel not to
      read a device's Configuration or Interface strings, together with a
      new quirk for the offending joystick.
      Reported-by: default avatarMelchior FRANZ <melchior.franz@gmail.com>
      Tested-by: default avatarMelchior FRANZ <melchior.franz@gmail.com>
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>  [2.6.28 and 2.6.29, nothing earlier]
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      1662e3a7
  2. 23 Mar, 2009 11 commits
  3. 22 Mar, 2009 6 commits
  4. 21 Mar, 2009 2 commits
  5. 20 Mar, 2009 5 commits
  6. 19 Mar, 2009 3 commits