summaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/generic.c
Commit message (Collapse)AuthorAgeFilesLines
...
* USB: serial: re-implement multi-urb writes in generic driverJohan Hovold2010-05-201-76/+56
| | | | | | | | | | | | | | | | 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: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: allow custom multi-urb write bulk callbacksJohan Hovold2010-05-201-1/+1
| | | | | | | | | Allow drivers to implement their own multi-urb write bulk callbacks as we do for single urb writes. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: clean up generic write start busy testJohan Hovold2010-05-201-11/+4
| | | | | | | | Submit write urb if it is not already in use and we have buffered data. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: clean up some error and debug messages in generic driverJohan Hovold2010-05-201-9/+4
| | | | | | | | | Clean up error messages on usb_submit_urb failure. Remove debug message on zero-length writes. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: export generic throttle and unthrottleJohan Hovold2010-05-201-0/+2
| | | | | | | | | | | | Allow drivers to use the generic throttle and unthrottle implementation. This makes sense for drivers using the generic read functionality. Note that drivers need to set these explicitly in order to enable them (i.e., we do not set them at port probe if not defined). Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: generalise generic read implementationJohan Hovold2010-05-201-2/+3
| | | | | | | | | | | | | | 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: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: clean up read processing in generic driverJohan Hovold2010-05-201-16/+11
| | | | | | | | | | | | | | | | | Always process and flush read urb, but only resubmit when not throttled. The new tty-layer supply plenty of slack so there is really no need to cache and delay processing of a single urb while throttled. Note that unthrottle now submits using GFP_KERNEL as we are not in atomic context (so there is no need to save irq state either). Note also that the process_read_urb function could be added to usb_serial_driver should any driver need to do any device specific processing. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: remove unnecessary re-initialisation of generic urbsJohan Hovold2010-05-201-23/+2
| | | | | | | | | | The generic read and write bulk urbs are initialised when allocated in usb_serial_probe. The only field that needs to be updated after that is the transfer_buffer_length of the write urb. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: refactor read urb submission in generic driverJohan Hovold2010-05-201-24/+8
| | | | | | | | | | | | 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: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: refactor generic closeJohan Hovold2010-05-201-0/+1
| | | | | | | | | Export usb_serial_generic_close so that drivers can easily kill the read and write urb and make sure that the write fifo is reset. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: clear fifo on closeJohan Hovold2010-05-201-1/+7
| | | | | | | | Make sure fifo is emptied on close. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: fix missing locking on fifo in write callbackJohan Hovold2010-05-201-2/+5
| | | | | | | | | | | | On errors the fifo was reset without any locking. This could race with write which do kfifo_put and perhaps also chars_in_buffer and write_room. Every other access to the fifo is protected using the port lock so better add it to the error path as well. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: fix generic chars_in_bufferJohan Hovold2010-05-201-4/+11
| | | | | | | | | | | | Make sure chars_in_buffer accounts also for data in host stack queues. This fixes the problem with tty_wait_until_sent returning too soon at close which could cause the final write urb to be cancelled. Reported-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: fix serial build when SYSRQ is disabledRandy Dunlap2010-05-201-0/+9
| | | | | | | | | | Fix build error when CONFIG_MAGIC_SYSRQ is not enabled: drivers/usb/serial/generic.c:566: error: implicit declaration of function 'handle_sysrq' Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb-serial: Use tty_port version console instead of usb_serial_portJason Wessel2010-05-201-2/+2
| | | | | | | | | | | | | | | 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: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: use port endpoint size to determine if ep is availableJohan Hovold2010-03-191-11/+19
| | | | | | | | | | | | | | | | | | It is possible to have a multi-port device with a port lacking an in or out bulk endpoint. Only checking for num_bulk_in or num_bulk_out is thus not sufficient to determine whether a specific port has an in or out bulk endpoint. This fixes potential null pointer dereferences in the generic open and write routines, as well as access to uninitialised fifo in write_room and chars_in_buffer. Also let write fail with ENODEV (instead of 0) on missing out endpoint (also on zero-length writes). Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: fix softint not being called on errorsJohan Hovold2010-03-191-10/+5
| | | | | | | | | Make sure usb_serial_port_softint is called on errors also when using multi urb writes. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: fix error message on close in generic driverJohan Hovold2010-03-191-1/+3
| | | | | | | | | Resubmitting read urb fails with -EPERM if completion handler runs while urb is being killed on close. This should not be reported as an error. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: remove references to port->port.count from the serial driversAlan Stern2010-03-021-1/+2
| | | | | | | | | | | | This patch (as1344) removes references to port->port.count from the USB serial drivers. Now that serial ports are properly reference counted, port.count checking is unnecessary and incorrect. Drivers should assume that the port is in use from the time the open method runs until the close method is called. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: Remove unnecessary \n's from dbg usesJoe Perches2010-03-021-1/+1
| | | | | | | | | #define dbg adds the newline, messages shouldn't. Converted dbg("%s", "some string") to dbg("some string") Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB serial: make USB device id constantNémeth Márton2010-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The id_table field of the struct usb_device_id is constant in <linux/usb.h> so it is worth to make the initialization data also constant. The semantic match that finds this kind of pattern is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r@ disable decl_init,const_decl_init; identifier I1, I2, x; @@ struct I1 { ... const struct I2 *x; ... }; @s@ identifier r.I1, y; identifier r.x, E; @@ struct I1 y = { .x = E, }; @c@ identifier r.I2; identifier s.E; @@ const struct I2 E[] = ... ; @depends on !c@ identifier r.I2; identifier s.E; @@ + const struct I2 E[] = ...; // </smpl> Signed-off-by: Németh Márton <nm127@freemail.hu> Cc: Julia Lawall <julia@diku.dk> Cc: cocci@diku.dk Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb: serial: fix memory leak in generic driverJohan Hovold2010-01-201-0/+2
| | | | | | | | | | | | | | | | | Fix a regression introduced by commit 715b1dc01fe44537e8fce9566e4bb48d6821d84b ("USB: usb_debug, usb_generic_serial: implement multi urb write"). URB transfer buffer was never freed when using multi-urb writes. Currently the only driver enabling multi-urb writes is usb_debug. Signed-off-by: Johan Hovold <jhovold@gmail.com> Cc: Greg KH <greg@kroah.com> Acked-by: Jason Wessel <jason.wessel@windriver.com> Cc: stable <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: fix USB serial fix kfifo_len lockingStefani Seibold2010-01-201-4/+4
| | | | | | | | | | | This patch fix a possible race bug in drivers/usb/serial/generic with the new kfifo API. Please apply it to the 2.6.33-rc* tree. Signed-off-by: Stefani Seibold <stefani@seibold.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Fix usb_serial_probe() problem introduced by the recent kfifo changesStefani Seibold2009-12-231-6/+6
| | | | | | | | | | | | | | | The USB serial code was a new user of the kfifo API, and it was missed when porting things to the new kfifo API. Please make the write_fifo in place. Here is my patch to fix the regression and full ported version. Signed-off-by: Stefani Seibold <stefani@seibold.net> Reported-and-tested-by: Rafael J. Wysocki <rjw@sisk.pl> Cc: Greg KH <greg@kroah.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* kfifo: rename kfifo_put... into kfifo_in... and kfifo_get... into kfifo_out...Stefani Seibold2009-12-221-2/+2
| | | | | | | | | | | | | | | | | | | | rename kfifo_put... into kfifo_in... to prevent miss use of old non in kernel-tree drivers ditto for kfifo_get... -> kfifo_out... Improve the prototypes of kfifo_in and kfifo_out to make the kerneldoc annotations more readable. Add mini "howto porting to the new API" in kfifo.h Signed-off-by: Stefani Seibold <stefani@seibold.net> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Acked-by: Andi Kleen <ak@linux.intel.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* kfifo: cleanup namespaceStefani Seibold2009-12-221-2/+2
| | | | | | | | | | | | | change name of __kfifo_* functions to kfifo_*, because the prefix __kfifo should be reserved for internal functions only. Signed-off-by: Stefani Seibold <stefani@seibold.net> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Acked-by: Andi Kleen <ak@linux.intel.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* kfifo: move out spinlockStefani Seibold2009-12-221-2/+2
| | | | | | | | | | | | | | | Move the pointer to the spinlock out of struct kfifo. Most users in tree do not actually use a spinlock, so the few exceptions now have to call kfifo_{get,put}_locked, which takes an extra argument to a spinlock. Signed-off-by: Stefani Seibold <stefani@seibold.net> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Acked-by: Andi Kleen <ak@linux.intel.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* USB: Fix throttling in generic usbserial driverJoris van Rantwijk2009-10-091-1/+1
| | | | | | | | | | | | | | The generic usbserial driver in Linux 2.6.31 halts its receiving channel in response to throttle requests from the line discipline. Unfortunately it drops the contents of the first URB received after throttling takes effect. This patch corrects that problem. Signed-off-by: Joris van Rantwijk <jorispubl@xs4all.nl> Acked-by: Johan Hovold <jhovold@gmail.com> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: use kfifo to buffer usb-generic serial writesDavid VomLehn2009-09-231-81/+125
| | | | | | | | | | | | | | | | | | 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: David VomLehn <dvomlehn@cisco.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* tty: USB does not need the filp argument in the driversAlan Cox2009-09-191-2/+1
| | | | | | | | And indeed none of them use it. Clean this up as it will make moving to a standard open method rather easier. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* tty: Fix USB kref leakAlan Cox2009-07-101-3/+4
| | | | | | | | | The sysrq code acquired a kref leak. Fix it by passing the tty separately from the caller (thus effectively using the callers kref which all the callers hold anyway) Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty: Sort out the USB sysrq changes that wrecked performanceAlan Cox2009-07-101-4/+11
| | | | | | | | We can't go around calling all sorts of magic per character functions at full rate 3G data speed. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* USB: usb-serial: replace shutdown with disconnect, releaseAlan Stern2009-06-151-2/+7
| | | | | | | | | | | | | | | | 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: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: usb_serial: only allow sysrq on a console portJason Wessel2009-06-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The only time a sysrq should get processed is if the attached device is a console. This is intended to protect sysrq execution on a host connected with a terminal program. Here is the problem scenario: host A <-- rs232 link --> host B Host A is using mincom and a usb pl2303 device to connect to host b which is a linux system with a usb pl2303 device acting as the serial console. When host B is rebooted the pl2303 emits random junk characters on reset. These character sequences contain serial break signals most of the time and when translated to a sysrq have caused host A to get random processes killed, reboots or power down. It is true that in this setup with this patch host B might still have the same problem as host A if you reboot host A. In most cases host A is a development host which seldom gets rebooted, and you could turn off sysrq temporarily on host B if you need to reboot host A. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: usb_debug,usb_generic_serial: implement sysrq and serial breakJason Wessel2009-06-151-12/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: usb_debug, usb_generic_serial: implement multi urb writeJason Wessel2009-06-151-7/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | 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: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* tty: Bring the usb tty port structure into more useAlan Cox2009-06-111-2/+1
| | | | | | | | | | This allows us to clean stuff up, but is probably also going to cause some app breakage with buggy apps as we now implement proper POSIX behaviour for USB ports matching all the other ports. This does also mean other apps that break on USB will now work properly. Signed-off-by: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* USB: removal of tty->low_latency hack dating back to the old serial codeOliver Neukum2009-04-231-6/+0
| | | | | | | | | | | | This removes tty->low_latency from all USB serial drivers that push data into the tty layer at hard interrupt context. It's no longer needed and actually harmful. Signed-off-by: Oliver Neukum <oliver@neukum.org> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: export symbol of usb_serial_generic_resumeOliver Neukum2009-03-241-0/+1
| | | | | | | | | | This exports a symbol for usb_serial_generic_resume, so that modules can use it. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial generic resume function fixOliver Neukum2009-03-241-8/+0
| | | | | | | | | | | | This removes an unnecessary check for autoresume from the generic resume method. The check has been obsoleted by the now delayed increase of the usage counter which makes the error this check prevented impossible. This change allows drivers which only use the bulk read URB the use of the generic method even if they support autosuspend. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* tty: usb-serial krefsAlan Cox2008-10-131-1/+2
| | | | | | | | | | | | | Use kref in the USB serial drivers so that we don't free tty structures from under the URB receive handlers as has historically been the case if you were unlucky. This also gives us a framework for general tty drivers to use tty_port objects and refcount. Contains two err->dev_err changes merged together to fix clashes in the -next tree. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tty-usb-generic: Code cleanupAlan Cox2008-07-221-38/+49
| | | | | | Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* usb_serial: API all changeAlan Cox2008-07-221-16/+23
| | | | | | | | | | | | | | | | | | | USB serial likes to use port->tty back pointers for the real work it does and to do so without any actual locking. Unfortunately when you consider hangup events, hangup/parallel reopen or even worse hangup followed by parallel close events the tty->port and port->tty pointers are not guaranteed to be the same as port->tty is the active tty while tty->port is the port the tty may or may not still be attached to. So rework the entire API to pass the tty struct. For console cases we need to pass both for now. This shows up multiple drivers that immediately crash with USB console some of which have been fixed in the process. Longer term we need a proper tty as console abstraction Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* USB: remove unnecessary type casting of urb->contextMing Lei2008-04-241-2/+2
| | | | | | | | urb->context code cleanup Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usb serial: more fixes and groundwork for tty changesAlan Cox2008-04-241-2/+3
| | | | | | | | | | | | | - If a termios change fails due to lack of memory we should copy the old settings back over as the device has not changed - Note various locking problems - kl5kusb105 had various remaining tty flag handling problems - Make safe_serial use tty_insert_flip_string not open coded loops - set termios speed properly in usb_serial Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: replace remaining __FUNCTION__ occurrencesHarvey Harrison2008-04-241-22/+22
| | | | | | | | __FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: serial: remove unneeded number endpoints settingsGreg Kroah-Hartman2008-04-241-3/+0
| | | | | | | | | The usb-serial core no longer checks these fields so remove them from all of the individual drivers. They will be removed from the usb-serial core in a patch later in the series. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: fix usb-serial generic recursive lockPete Zaitcev2008-03-101-4/+6
| | | | | | | | | | | | | | | Nobody should be using the generic usb-serial for anything other than testing. Still, it's not a good thing that it's easy to lock up. There is a traceback from NMI oopser here: https://bugzilla.redhat.com/show_bug.cgi?id=431379 But in short, if a line discipline has a chance to echo anything, input can loop back a write method. So, don't call tty_flip_buffer_push from under a lock taken on write path. Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* USB: Prepare serial core for autosuspend.Sarah Sharp2008-02-011-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Claim the interface for a USB to serial converter when the tty is open, and release the interface when the tty is closed. If a driver doesn't provide a resume function, use the generic resume instead. Make sure the generic resume function does not submit the URBs if we're coming back from autosuspend. On autoresume, we know that the open function will be called next, which will attempt to submit the URBs. If we submit them in the resume function, the open will fail. This works for: - autosuspend - suspending with the tty open or closed - hibernate with the tty closed A hibernate (or a suspend that causes the USB subsystem to lose power) has issues. If you have the tty open when you hibernate, a new tty will be created when the device re-enumerates during resume. Signed-off-by: Sarah Sharp <sarah.a.sharp@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* usbserial: fix inconsistent lock stateBorislav Petkov2007-11-281-2/+3
| | | | | | | | | | | | | In commit acd2a847e7fee7df11817f67dba75a2802793e5d usb_serial_generic_write() disables interrupts when taking &port->lock which is also taken in usb_serial_generic_read_bulk_callback() resulting in an inconsistent lock state due to the latter not disabling interrupts on the local cpu. Fix that by disabling interrupts in the latter call site also. Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de> Acked-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
OpenPOWER on IntegriCloud