aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/serial/mos7720.c
AgeCommit message (Collapse)Author
2010-09-20USB: serial/mos*: prevent reading uninitialized stack memoryDan Rosenberg
The TIOCGICOUNT device ioctl in both mos7720.c and mos7840.c allows unprivileged users to read uninitialized stack memory, because the "reserved" member of the serial_icounter_struct struct declared on the stack is not altered or zeroed before being copied back to the user. This patch takes care of it. Signed-off-by: Dan Rosenberg <dan.j.rosenberg@gmail.com> Cc: stable <stable@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-20USB: usbserial: mos7720: cleanup, consolidation, replace send_mos_cmd with ↵Mike Dunn
{read,write}_mos_reg No functionality added or bugs fixed, just improved code consistency and (hopefully) readability by replacing send_mos_cmd with the register read & write functions that were used for parallel port registers. Also shortens overall file length. Thoroughly tested, with emphasis on regression testing the serial port. Signed-off-by: Mike Dunn <mikedunn@newsguy.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-20USB: usbserial: mos7720: add support for parallel port on moschip 7715Mike Dunn
Add support for the parallel port on the moschip MCS7715 device. The port registers itself with the parport subsystem as a low-level driver. A separate entry to the kernel configuration is added beneath that for the mos7720, to avoid the need to link with the parport subsystem code for users who don't have or don't want the parallel port. Only compatibility mode is currently supported (no ECP/EPP). Tested with both moschip devices (7720 and 7715) on UP and SMP hosts, including regression testing of serial port, concurrent operation of serial and parallel ports, and various connect / disconnect scenarios. Signed-off-by: Mike Dunn <mikedunn@newsguy.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-02USB: tty: Prune uses of tty_request_room in the USB layerAlan Cox
We have lots of callers that do not need to do this in the first place. Remove the calls as they both cost CPU and for big buffers can mess up the multi-page allocation avoidance. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-02USB: serial: Remove unnecessary \n's from dbg usesJoe Perches
#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>
2010-03-02USB: serial: add support for serial port on the moschip 7715Mike Dunn
Add support for the serial port on devices based on the MosChip 7715, which provides a serial and parallel port on a single usb interface. This is added to the existing driver for the Moschip 7720 dual serial port device. The 7715 is very similiar to the 7720, requiring only the addition of a calc_num_ports() function, a separate interrupt-in endpoint callback, and some manipulation of the port pointers added to the attach() function to correct the fact that the usbserial core erroneously assigns the first bulk in/out endpoint pair to the serial port (the 7715 uses these for its parallel port). There is no support for the 7715's parallel port yet. Signed-off-by: Mike Dunn <mikedunn@newsguy.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-02USB serial: make USB device id constantNémeth Márton
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>
2010-03-02USB: mos7720: fix DMA buffers on stack and clean up send_mos_cmdJohan Hovold
Change data-argument type from (void *) to (u8 *) to prevent endianess problems. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-19tty: USB does not need the filp argument in the driversAlan Cox
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>
2009-09-19tty: usb_serial_mos7720: Fix get_lsr_infoKees Schoenmakers
I made a correction for get_lsr_info, now it returns some meaningful information. I tested it with two simultaneous simplex modem channels. it is attached Signed-off-by: Kees Schoenmakers <k.schoenmakers@sigmae.nl> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-19MOS7720 has no tiocmget methodKees Schoenmakers
Fix the tiocmget/mset handling on the mos7720 USB serial port. [Minor space reformatting for coding style - Alan] Signed-off-by: Kees Schoenmakers <k.schoenmakers@sigmae.nl> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-07-20tty: fix chars_in_buffersAlan Cox
This function does not have an error return and returning an error is instead interpreted as having a lot of pending bytes. Reported by Jeff Harris who provided a list of some of the remaining offenders. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-06-15USB: usb-serial: replace shutdown with disconnect, releaseAlan 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: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-06-11tty: Bring the usb tty port structure into more useAlan Cox
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>
2009-04-23USB: removal of tty->low_latency hack dating back to the old serial codeOliver Neukum
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>
2008-10-17USB: remove use of err() in drivers/usb/serialGreg Kroah-Hartman
err() is going away, so switch to dev_err() or printk() if it's really needed. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-10-17USB: remove info() macro from usb/serial driversGreg Kroah-Hartman
USB should not be having it's own printk macros, so remove info() and use the system-wide standard of dev_info() wherever possible. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-10-13tty: usb-serial krefsAlan Cox
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>
2008-07-22tty-usb-mos7720: Coding styleAlan Cox
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>
2008-07-22usb_serial: API all changeAlan Cox
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>
2008-04-24usb serial: more fixes and groundwork for tty changesAlan Cox
- 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>
2008-04-24USB: replace remaining __FUNCTION__ occurrencesHarvey Harrison
__FUNCTION__ is gcc-specific, use __func__ Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-04-24USB: serial: remove unneeded number endpoints settingsGreg Kroah-Hartman
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>
2008-02-01USB: stop io performed by mos7720 upon close()Oliver Neukum
This fixes a problem where the mos7720 driver will make io to a device from which it has been logically disconnected. It does so by introducing a flag by which the generic usb serial code can signal the subdrivers their disconnection and appropriate locking. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-02-01USB: mos7720: clean up termiosAlan Cox
Remove lots of NULL checks that can no longer occur Encode the baud rate back into the termios (again someone with docs see FIXME to improve this further) Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-18Add missing newlines to some uses of dev_<level> messagesJoe Perches
Found these while looking at printk uses. Add missing newlines to dev_<level> uses Add missing KERN_<level> prefixes to multiline dev_<level>s Fixed a wierd->weird spelling typo Added a newline to a printk Signed-off-by: Joe Perches <joe@perches.com> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Jens Axboe <jens.axboe@oracle.com> Cc: Mark M. Hoffman <mhoffman@lightlink.com> Cc: Roland Dreier <rolandd@cisco.com> Cc: Tilman Schmidt <tilman@imap.cc> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Jeff Garzik <jeff@garzik.org> Cc: Stephen Hemminger <shemminger@linux-foundation.org> Cc: Greg KH <greg@kroah.com> Cc: Jeremy Fitzhardinge <jeremy@goop.org> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: David Brownell <david-b@pacbell.net> Cc: James Smart <James.Smart@Emulex.Com> Cc: Andrew Vasquez <andrew.vasquez@qlogic.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Jaroslav Kysela <perex@suse.cz> Cc: Takashi Iwai <tiwai@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-19USB: mos7720, mos7840: remove redundant urb checkFlorin Malita
Coverity (1709, 1710, 1711, 1712, 1713) actually flagged these as REVERSE_INULLs (NULL check performed after dereference). But looking at the other drivers I can't see any similar tests and the USB core already makes sure urb is non-null - so might as well get rid of the checks. Signed-off-by: Florin Malita <fmalita@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: mos7720: remove bogus no termios change checkAlan Cox
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: mos7720: change developer email addressesGreg Kroah-Hartman
Update the original developer's email addresses at their request. Cc: Vijaya Kumar <vijaykumar.gn@gmail.com> Cc: Ajay Kumar <naanuajay@yahoo.com> Cc: Gurudeva <ngurudeva@yahoo.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12USB: serial: mos7720: clean up urb->status usageGreg Kroah-Hartman
This done in anticipation of removal of urb->status, which will make that patch easier to review and apply in the future. Cc: <linux-usb-devel@lists.sourceforge.net> Cc: VijayaKumar G.N. <vijaykumar@aspirecom.net> Cc: AjayKumar <ajay@aspirecom.net> Cc: Gurudeva N. <gurudev@aspirecom.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-04-27USB: fix endianness in mos7720Oliver Neukum
there's code unclean w.r.t. endianness in the mos7720 driver. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-04-27mos7720 updateOliver Neukum
this driver has an interesting way of handling ENOMEM: complain and ignore. If you decide to live with allocation failures, you must 1. guard against URBs without corresponding buffers 2. complete allocation failures 3. always test entries for NULL before you follow the pointers This patch does so. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-04-27USB: unnecessary GFP_ATOMIC in mos7720 driverOliver Neukum
GFP_KERNEL will do. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-03-19USB: necessary update for mos7720 driverOliver Neukum
these devices have a shared interrupt endpoint. For serialcore to pass an interrupt endpoint to a subdriver, the subdriver must define and _export_ a fitting callback. The mos7720 driver failed to do so. This led invariably to an oops upon open. This patch fixes it. The driver is useless without it. Please try to get this into 2.6.21 and the stable kernels that have this driver. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-02-11[PATCH] Char: tty_wakeup cleanupJiri Slaby
tty_wakeup cleanup - remove wake_up_interruptible(&tty->write_wait) surrounding tty_wakup(tty); - substitute tty->ldisc.write_wakeup(tty) + wake_up() by tty_wakeup(tty); Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Acked-by: Tilman Schmidt <tilman@imap.cc> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-07USB serial: add driver pointer to all usb-serial driversJohannes Hölzl
Every usb serial driver should have a pointer to the corresponding usb driver. So the usb serial core can add a new id not only to the usb serial driver, but also to the usb driver. Also the usb drivers of ark3116, mos7720 and mos7840 missed the flag no_dynamic_id=1. This is added now. Signed-off-by: Johannes Hölzl <johannes.hoelzl@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-12-08[PATCH] tty: switch to ktermiosAlan Cox
This is the grungy swap all the occurrences in the right places patch that goes with the updates. At this point we have the same functionality as before (except that sgttyb() returns speeds not zero) and are ready to begin turning new stuff on providing nobody reports lots of bugs If you are a tty driver author converting an out of tree driver the only impact should be termios->ktermios name changes for the speed/property setting functions from your upper layers. If you are implementing your own TCGETS function before then your driver was broken already and its about to get a whole lot more painful for you so please fix it 8) Also fill in c_ispeed/ospeed on init for most devices, although the current code will do this for you anyway but I'd like eventually to lose that extra paranoia [akpm@osdl.org: bluetooth fix] [mp3@de.ibm.com: sclp fix] [mp3@de.ibm.com: warning fix for tty3270] [hugh@veritas.com: fix tty_ioctl powerpc build] [jdike@addtoit.com: uml: fix ->set_termios declaration] Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Martin Peschke <mp3@de.ibm.com> Acked-by: Peter Oberparleiter <oberpar@de.ibm.com> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-07[PATCH] slab: remove SLAB_ATOMICChristoph Lameter
SLAB_ATOMIC is an alias of GFP_ATOMIC Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-17USB: add USB serial mos7720 driverGreg Kroah-Hartman
Add support for Moschip 7720 USB dual port usb to serial device. This driver is originally based on the drivers/usb/io_edgeport.c driver. Cleaned up and forward ported by me. Cc: VijayaKumar <vijaykumar@aspirecom.net> Cc: AjayKumar <ajay@aspirecom.net> Cc: Gurudeva <gurudev@aspirecom.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>