1. 08 5月, 2012 1 次提交
    • G
      USB: serial: remove usb_serial_disconnect call in all drivers · 32078f91
      Greg Kroah-Hartman 提交于
      This is now set by the usb-serial core, no need for the driver to
      individually set it.
      
      Thanks to Alan Stern for the idea to get rid of it.
      
      Cc: William Greathouse <wgreathouse@smva.com>
      Cc: Matthias Bruestle and Harald Welte <support@reiner-sct.com>
      Cc: Lonnie Mendez <dignome@gmail.com>
      Cc: Peter Berger <pberger@brimson.com>
      Cc: Al Borchers <alborchers@steinerpoint.com>
      Cc: Gary Brubaker <xavyer@ix.netcom.com>
      Cc: Oliver Neukum <oliver@neukum.name>
      Cc: Matthias Urlichs <smurf@smurf.noris.de>
      Cc: Support Department <support@connecttech.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
      Cc: Kautuk Consul <consul.kautuk@gmail.com>
      Cc: Bill Pemberton <wfp5p@virginia.edu>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Bart Hartgers <bart.hartgers@gmail.com>
      Cc: Johan Hovold <jhovold@gmail.com>
      Cc: Preston Fick <preston.fick@silabs.com>
      Cc: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
      Cc: Simon Arlott <simon@fire.lp0.eu>
      Cc: Andrew Worsley <amworsley@gmail.com>
      Cc: "Michał Wróbel" <michal.wrobel@flytronic.pl>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Felipe Balbi <balbi@ti.com>
      Cc: Aleksey Babahin <tamerlan311@gmail.com>
      Cc: Dan Carpenter <error27@gmail.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Donald Lee <donald@asix.com.tw>
      Cc: Julia Lawall <julia@diku.dk>
      Cc: Michal Sroczynski <msroczyn@gmail.com>
      Cc: Wang YanQing <Udknight@gmail.com>
      Cc: Dan Williams <dcbw@redhat.com>
      Cc: Thomas Tuttle <ttuttle@chromium.org>
      Cc: Rigbert Hamisch <rigbert@gmx.de>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Cc: Jesper Juhl <jj@chaosbits.net>
      Cc: Adhir Ramjiawan <adhirramjiawan0@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      32078f91
  2. 10 4月, 2012 1 次提交
    • A
      USB: fix bug in serial driver unregistration · 891a3b1f
      Alan Stern 提交于
      This patch (as1536) fixes a bug in the USB serial core.  Unloading and
      reloading a serial driver while a serial device is plugged in causes
      errors because of the code in usb_serial_disconnect() that tries to
      make sure the port_remove method is called.  With the new order of
      driver registration introduced in the 3.4 kernel, this is definitely
      not the right thing to do (if indeed it ever was).
      
      The patch removes that whole section code, along with the mechanism
      for keeping track of each port's registration state, which is no
      longer needed.  The driver core can handle all that stuff for us.
      
      Note: This has been tested only with one or two USB serial drivers.
      In theory, other drivers might still run into trouble.  But if they
      do, it will be the fault of the drivers, not of this patch -- that is,
      the drivers will need to be fixed.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-and-tested-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      891a3b1f
  3. 10 3月, 2012 1 次提交
  4. 29 2月, 2012 1 次提交
    • G
      USB: create module_usb_serial_driver macro · d1cddb4a
      Greg KH 提交于
      Now that Alan Stern has cleaned up the usb serial driver registration,
      we have the ability to create a module_usb_serial_driver macro to make
      things a bit simpler, like the other *_driver macros created.
      
      But, as we need two functions here, we can't reuse the existing
      module_driver() macro, so we need to roll our own.
      
      Here's a patch implementing module_usb_serial_driver() and it converts
      the pl2303 driver to use it, showing a nice cleanup.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d1cddb4a
  5. 25 2月, 2012 2 次提交
    • G
      USB: serial: remove usb_serial_register and usb_serial_deregister · f799e767
      Greg Kroah-Hartman 提交于
      No one uses them anymore, they should be using the safer
      usb_serial_register_drivers() and usb_serial_deregister_drivers()
      functions instead.
      
      Thanks to Alan Stern for writing these functions and porting all
      in-kernel users to them.
      
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f799e767
    • A
      usb-serial: new API for driver registration · 765e0ba6
      Alan Stern 提交于
      This patch (as1522) adds two new routines to the usb-serial core, for
      registering and unregistering serial drivers.  Instead of registering
      the usb_driver and usb_serial_drivers separately, with error checking
      for each one, the drivers can all be registered and unregistered by a
      single function call.  This reduces duplicated code.
      
      More importantly, the new core routines change the order in which the
      drivers are registered.  Currently the usb-serial drivers are all
      registered first and the usb_driver is done last, which leaves a
      window for problems.  A udev script may quickly add a new dynamic-ID
      for a usb-serial driver, causing the corresponding usb_driver to be
      probed.  If the usb_driver hasn't been registered yet then an oops
      will occur.
      
      The new routine prevents such problems by registering the usb_driver
      first.  To insure that it gets probed properly for already-attached
      serial devices, we call driver_attach() after all the usb-serial
      drivers have been registered.
      
      Along with adding the new routines, the patch modifies the "generic"
      serial driver to use them.  Further patches will similarly modify all
      the other in-tree USB serial drivers.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      765e0ba6
  6. 10 2月, 2012 1 次提交
  7. 16 11月, 2011 2 次提交
  8. 26 2月, 2011 1 次提交
    • A
      USB: serial drivers need to use larger bulk-in buffers · 969e3033
      Alan Stern 提交于
      When a driver doesn't know how much data a device is going to send,
      the buffer size should be at least as big as the endpoint's maxpacket
      value.  The serial drivers don't follow this rule; many of them
      request only 256-byte bulk-in buffers.  As a result, they suffer
      overflow errors if a high-speed device wants to send a lot of data,
      because high-speed bulk endpoints are required to have a maxpacket
      size of 512.
      
      This patch (as1450) fixes the problem by using the driver's
      bulk_in_size value as a minimum, always allocating buffers no smaller
      than the endpoint's maxpacket size.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NFlynn Marquardt <flynn@flynnux.de>
      CC: <stable@kernel.org> [after .39-rc1 is out]
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      969e3033
  9. 18 2月, 2011 3 次提交
  10. 23 1月, 2011 1 次提交
    • L
      USB: serial: handle Data Carrier Detect changes · d14fc1a7
      Libor Pechacek 提交于
      Alan's commit 335f8514 introduced
      .carrier_raised function in several drivers.  That also means
      tty_port_block_til_ready can now suspend the process trying to open the serial
      port when Carrier Detect is low and put it into tty_port.open_wait queue.  We
      need to wake up the process when Carrier Detect goes high and trigger TTY
      hangup when CD goes low.
      
      Some of the devices do not report modem status line changes, or at least we
      don't understand the status message, so for those we remove .carrier_raised
      again.
      Signed-off-by: NLibor Pechacek <lpechacek@suse.cz>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d14fc1a7
  11. 23 10月, 2010 1 次提交
    • A
      tty: Make tiocgicount a handler · d281da7f
      Alan Cox 提交于
      Dan Rosenberg noted that various drivers return the struct with uncleared
      fields. Instead of spending forever trying to stomp all the drivers that
      get it wrong (and every new driver) do the job in one place.
      
      This first patch adds the needed operations and hooks them up, including
      the needed USB midlayer and serial core plumbing.
      Signed-off-by: NAlan Cox <alan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d281da7f
  12. 21 8月, 2010 1 次提交
  13. 21 5月, 2010 9 次提交
    • G
      USB: include/usb/*.h checkpatch cleanup · 0858a3a5
      Greg Kroah-Hartman 提交于
      Lots of minor formatting cleanups in includes/usb/ to make checkpatch
      happier.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0858a3a5
    • J
      USB: serial: remove multi-urb write from generic driver · c23e5fc1
      Johan Hovold 提交于
      Remove multi-urb write from the generic driver and simplify the
      prepare_write_buffer prototype:
      
      	int (*prepare_write_buffer)(struct usb_serial_port *port,
      						void *dest, size_t size);
      
      The default implementation simply fills dest with data from port write
      fifo but drivers can override it if they need to process the outgoing
      data (e.g. add headers).
      
      Turn ftdi_sio into a generic fifo-based driver, which lowers CPU usage
      significantly for small writes while retaining maximum throughput.
      Signed-off-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      c23e5fc1
    • J
      USB: serial: reimplement generic fifo-based writes · 27c7acf2
      Johan Hovold 提交于
      Reimplement fifo-based writes in the generic driver using a multiple
      pre-allocated urb scheme.
      
      In contrast to multi-urb writes, no allocations (of urbs or buffers) are
      made during run-time and there is less pressure on the host stack
      queues as currently only two urbs are used (implementation is generic
      and can handle more than two urbs as well, though).
      
      Initial tests using ftdi_sio show that the implementation achieves the
      same (maximum) throughput at high baudrates as multi-urb writes. The CPU
      usage is much lower than for multi-urb writes for small write requests
      and only slightly higher for large (e.g. 2k) requests (due to extra copy
      via fifo?).
      
      Also outperforms multi-urb writes for small write requests on an
      embedded arm-9 system, where multi-urb writes are CPU-bound at high
      baudrates (perf reveals that a lot of time is spent in the host stack
      enqueue function -- could perhaps be a bug as well).
      
      Keeping the original write_urb, buffer and flag for now as there are
      other drivers depending on them.
      Signed-off-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      27c7acf2
    • J
      USB: serial: generalise write buffer preparation · eaa3bcb0
      Johan Hovold 提交于
      Generalise write buffer preparation.
      
      This allows for drivers to manipulate (e.g. add headers) to bulk out
      data before it is sent.
      
      This adds a new function pointer to usb_serial_driver:
      
      int (*prepare_write_buffer)(struct usb_serial_port *port,
      		void **dest, size_t size, const void *src, size_t count);
      
      The function is generic and can be used with either kfifo-based or
      multi-urb writes:
      
      If *dest is NULL the implementation should allocate dest.
      If src is NULL the implementation should use the port write fifo.
      
      If not set, a generic implementation is used which simply uses memcpy or
      kfifo_out.
      Signed-off-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      eaa3bcb0
    • J
      USB: serial: re-implement multi-urb writes in generic driver · 25d514ca
      Johan Hovold 提交于
      Use dynamic transfer buffer sizes since it is more efficient to let the
      host controller do the partitioning to fit endpoint size. This way we
      also do not use more than one urb per write request.
      
      Replace max_in_flight_urbs with multi_urb_write flag in struct
      usb_serial_driver to enable multi-urb writes.
      
      Use MAX_TX_URBS=40 and a max buffer size of PAGE_SIZE to prevent DoS
      attacks.
      Signed-off-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      25d514ca
    • J
      USB: serial: generalise generic read implementation · 23154320
      Johan Hovold 提交于
      Add process_read_urb to usb_serial_driver so that a driver can rely on
      the generic read (and throttle) mechanism but still do device specific
      processing of incoming data (such as adding tty_flags before pushing to
      line discipline).
      
      The default generic implementation handles sysrq for consoles but
      otherwise simply pushes to tty.
      Signed-off-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      23154320
    • J
      USB: serial: refactor read urb submission in generic driver · 41bd72f9
      Johan Hovold 提交于
      Use the already exported function for submitting the read urb associated
      with a usb_serial_port.
      
      Make sure it returns the result of usb_submit_urb and rename to the
      more descriptive usb_serial_generic_submit_read_urb.
      Signed-off-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      41bd72f9
    • J
      USB: serial: allow drivers to define bulk buffer sizes · bbcb2b90
      Johan Hovold 提交于
      Allow drivers to define custom bulk in/out buffer sizes in struct
      usb_serial_driver. If not set, fall back to the default buffer size
      which matches the endpoint size.
      
      Three drivers are currently freeing the pre-allocated buffers and
      allocating larger ones to achieve this at port probe (ftdi_sio) or even
      at port open (ipaq and iuu_phoenix), which needless to say is suboptimal.
      Signed-off-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bbcb2b90
    • J
      usb-serial: Use tty_port version console instead of usb_serial_port · bd5afa9e
      Jason Wessel 提交于
      Replace all instances of using the console variable in struct
      usb_serial_port with the struct tty_port version.
      
      CC: Alan Cox <alan@linux.intel.com>
      CC: Alan Stern <stern@rowland.harvard.edu>
      CC: Oliver Neukum <oliver@neukum.org>
      CC: Andrew Morton <akpm@linux-foundation.org>
      CC: linux-usb@vger.kernel.org
      CC: linux-kernel@vger.kernel.org
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bd5afa9e
  14. 03 3月, 2010 1 次提交
  15. 24 12月, 2009 1 次提交
  16. 12 12月, 2009 1 次提交
  17. 10 10月, 2009 1 次提交
  18. 23 9月, 2009 1 次提交
    • D
      USB: use kfifo to buffer usb-generic serial writes · 8e8dce06
      David VomLehn 提交于
      When do_output_char() attempts to write a carriage return/line feed sequence,
      it first checks to see how much buffer room is available. If there are at least
      two characters free, it will write the carriage return/line feed with two calls
      to tty_put_char(). It calls the tty_operation functions write() for devices that
      don't support the tty_operations function put_char(). If the USB generic serial
      device's write URB is not in use, it will return the buffer size when asked how
      much room is available. The write() of the carriage return will cause it to mark
      the write URB busy, so the subsequent write() of the line feed will be ignored.
      
      This patch uses the kfifo infrastructure to implement a write FIFO that
      accurately returns the amount of space available in the buffer.
      Signed-off-by: NDavid VomLehn <dvomlehn@cisco.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      8e8dce06
  19. 20 9月, 2009 2 次提交
  20. 11 7月, 2009 1 次提交
  21. 16 6月, 2009 4 次提交
    • A
      USB: usb-serial: replace shutdown with disconnect, release · f9c99bb8
      Alan Stern 提交于
      This patch (as1254) splits up the shutdown method of usb_serial_driver
      into a disconnect and a release method.
      
      The problem is that the usb-serial core was calling shutdown during
      disconnect handling, but drivers didn't expect it to be called until
      after all the open file references had been closed.  The result was an
      oops when the close method tried to use memory that had been
      deallocated by shutdown.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      f9c99bb8
    • A
      USB: usb-serial: call port_probe and port_remove at the right times · c706ebdf
      Alan Stern 提交于
      This patch (as1253) prevents the usb-serial core from calling a
      driver's port_probe and port_remove methods more than once per port.
      It also removes some unnecessary try_module_get() calls and adds a
      missing port_remove method call in a failure path.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      c706ebdf
    • J
      USB: serial: usb_debug,usb_generic_serial: implement sysrq and serial break · 98fcb5f7
      Jason Wessel 提交于
      The usb_debug driver was modified to implement serial break handling
      by using a "magic" data packet comprised of the sequence:
      
             0x00 0xff 0x01 0xfe   0x00 0xfe 0x01 0xff
      
      When the tty layer requests a serial break the usb_debug driver sends
      the magic packet.  On the receiving side the magic packet is thrown
      away or a sysrq is activated depending on what kernel .config options
      have been set.
      
      The generic serial driver was modified as well as the usb serial
      headers to generically implement sysrq processing in the same way the
      non usb uart based drivers implement the sysrq handling.  This will
      allow other usb serial devices to implement sysrq handling as desired.
      
      The new usb serial functions are named similarly and implemented
      similarly to the uart functions as follows:
      
      usb_serial_handle_break <-> uart_handle_break
      usb_serial_handle_sysrq_char <-> uart_handle_sysrq_char
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      98fcb5f7
    • J
      USB: usb_debug, usb_generic_serial: implement multi urb write · 715b1dc0
      Jason Wessel 提交于
      The usb_debug driver, when used as the console, will always fail to
      insert the carriage return and new line sequence as well as randomly
      drop console output.  This is a result of only having the single
      write_urb and that the tty layer will have a lock that prevents the
      processing of the back to back urb requests.
      
      The solution is to allow more than one urb to be outstanding and have
      a slightly deeper transmit queue.  The idea and some code is borrowed
      from the ftdi_sio usb driver.
      
      The generic usb serial driver was modified so as to allow the classic
      method of 1 write urb, or a multi write urb scheme with N allowed
      outstanding urbs where N is controlled by max_in_flight_urbs.  When
      max_in_flight_urbs in a "struct usb_serial_driver" is non zero the
      multi write urb scheme will be used.
      
      The size of 4000 was selected for the usb_debug driver so that the
      driver lowers possibility of losing the queued console messages during
      the kernel startup.
      Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      715b1dc0
  22. 11 6月, 2009 1 次提交
  23. 14 4月, 2009 1 次提交
  24. 25 3月, 2009 1 次提交