History log of /linux-master/drivers/usb/serial/cypress_m8.c
Revision Date Author Comments
# f6d47fe5 16-Aug-2022 Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

usb: serial: Make ->set_termios() old ktermios const

There should be no reason to adjust old ktermios which is going to get
discarded anyway.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220816115739.10928-8-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9ec7e8d5 22-Jun-2022 Jiang Jian <jiangjian@cdjrlc.com>

USB: serial: fix repeated word "the" in comments

There is a repeated word "the" in two comments that should be replaced
or removed.

Signed-off-by: Jiang Jian <jiangjian@cdjrlc.com>
[ johan: replace one "the" with "that", merge the two cleanups, amend
commit message ]
Signed-off-by: Johan Hovold <johan@kernel.org>


# a65ab973 25-Aug-2021 Utkarsh Verma <utkarshverma294@gmail.com>

USB: serial: replace symbolic permissions by octal permissions

Replace symbolic permission macros with octal permission numbers
because octal permission numbers are easier to read and understand
instead of their symbolic macro names.

No functional change.

Suggested-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Utkarsh Verma <utkarshverma294@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>


# 3ec2ff37 10-Jun-2021 Jiri Slaby <jirislaby@kernel.org>

tty: make use of tty_get_{char,frame}_size

In the previous patch, we introduced tty_get_char_size() and
tty_get_frame_size() for computing character and frame sizes,
respectively. Here, we make use of them in various tty drivers where
applicable.

The stats look nice: 12 insertions, 169 deletions.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: David Lin <dtwlin@gmail.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: Alex Elder <elder@kernel.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: Oliver Neukum <oneukum@suse.com>
Acked-by: Alex Elder <elder@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210610090247.2593-4-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d8f0209b 10-Jun-2021 Jiri Slaby <jirislaby@kernel.org>

cypress_m8: switch data_bits to real character bits

Make data_bits what it really is. Assign proper bit counts to data_bits
instead of magic 0..3. There are two reasons:
1) it's clear what we store there, and
2) it will make the transition to tty_tty_get_char_size() in the next
patch easier.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210610090247.2593-3-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 155591d3 05-May-2021 Jiri Slaby <jirislaby@kernel.org>

USB: serial: make usb_serial_driver::chars_in_buffer return uint

tty_operations::chars_in_buffer is being switched to return uint. Do the
same for usb_serial_driver's chars_in_buffer.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
[ johan: amend commit message ]
Signed-off-by: Johan Hovold <johan@kernel.org>


# 94cc7aea 05-May-2021 Jiri Slaby <jirislaby@kernel.org>

USB: serial: make usb_serial_driver::write_room return uint

Line disciplines expect a positive value or zero returned from
tty->ops->write_room (invoked by tty_write_room). Both of them are being
updated to return an unsigned int. Switch also
usb_serial_driver::write_room and all its users.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
[ johan: amend commit message, drop unrelated comment change ]
Signed-off-by: Johan Hovold <johan@kernel.org>


# c5d1448f 08-Feb-2021 Uwe Kleine-König <uwe@kleine-koenig.org>

USB: serial: make remove callback return void

All usb_serial drivers return 0 in their remove callbacks and driver
core ignores the value returned by usb_serial_device_remove(). So change
the remove callback to return void and return 0 unconditionally in
usb_serial_device_remove().

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Link: https://lore.kernel.org/r/20210208143149.963644-2-uwe@kleine-koenig.org
Signed-off-by: Johan Hovold <johan@kernel.org>


# 74b76256 07-Jul-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

USB: serial: use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>


# 5c45d04c 16-Jun-2020 James Hilliard <james.hilliard1@gmail.com>

USB: serial: cypress_m8: enable Simply Automated UPB PIM

This is a UPB (Universal Powerline Bus) PIM (Powerline Interface Module)
which allows for controlling multiple UPB compatible devices from Linux
using the standard serial interface.

Based on vendor application source code there are two different models
of USB based PIM devices in addition to a number of RS232 based PIM's.

The vendor UPB application source contains the following USB ID's:

#define USB_PCS_VENDOR_ID 0x04b4
#define USB_PCS_PIM_PRODUCT_ID 0x5500

#define USB_SAI_VENDOR_ID 0x17dd
#define USB_SAI_PIM_PRODUCT_ID 0x5500

The first set of ID's correspond to the PIM variant sold by Powerline
Control Systems while the second corresponds to the Simply Automated
Incorporated PIM. As the product ID for both of these match the default
cypress HID->COM RS232 product ID it assumed that they both use an
internal variant of this HID->COM RS232 converter hardware. However
as the vendor ID for the Simply Automated variant is different we need
to also add it to the cypress_M8 driver so that it is properly
detected.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Link: https://lore.kernel.org/r/20200616220403.1807003-1-james.hilliard1@gmail.com
Cc: stable@vger.kernel.org
[ johan: amend VID define entry ]
Signed-off-by: Johan Hovold <johan@kernel.org>


# ecefae6d 18-Jun-2019 Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

docs: usb: rename files to .rst and add them to drivers-api

While there are a mix of things here, most of the stuff
were written from Kernel developer's PoV. So, add them to
the driver-api book.

A follow up for this patch would be to move documents from
there that are specific to sysadmins, adding them to the
admin-guide.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Acked-by: Johan Hovold <johan@kernel.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2e75232b 21-Apr-2019 Johan Hovold <johan@kernel.org>

USB: serial: cypress_m8: clean up initial-termios handling

Now that init_termios() is only called on first use, we can clean up the
cypress_m8 initial-termios handling.

Note that only the earthmate chip type used settings different from the
defaults provided by USB serial core, and that the chip type is indeed
known when init_termios is called at tty-install time.

Signed-off-by: Johan Hovold <johan@kernel.org>


# 817c0cfc 21-Apr-2019 Johan Hovold <johan@kernel.org>

USB: serial: cypress_m8: drop unused termios

Drop driver termios structure that held a copy of the tty termios for
no good reason.

Signed-off-by: Johan Hovold <johan@kernel.org>


# da7d26a0 21-Apr-2019 Johan Hovold <johan@kernel.org>

USB: serial: cypress_m8: drop unused driver data flag

Drop the isthrottled flag which has never been used.

Signed-off-by: Johan Hovold <johan@kernel.org>


# 17c42e34 04-Oct-2018 YueHaibing <yuehaibing@huawei.com>

USB: serial: cypress_m8: remove set but not used variable 'iflag'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/usb/serial/cypress_m8.c: In function 'cypress_set_termios':
drivers/usb/serial/cypress_m8.c:866:18: warning:
variable 'iflag' set but not used [-Wunused-but-set-variable]

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Johan Hovold <johan@kernel.org>


# 56445eef 30-Sep-2018 Johan Hovold <johan@kernel.org>

USB: serial: cypress_m8: fix interrupt-out transfer length

Fix interrupt-out transfer length which was being set to the
transfer-buffer length rather than the size of the outgoing packet.

Note that no slab data was leaked as the whole transfer buffer is always
cleared before each transfer.

Fixes: 9aa8dae7b1fa ("cypress_m8: use usb_fill_int_urb where appropriate")
Signed-off-by: Johan Hovold <johan@kernel.org>


# bbc1f57a 23-Sep-2018 Colin Ian King <colin.king@canonical.com>

USB: serial: cypress_m8: fix spelling mistake "retreiving" -> "retrieving"

Trivial fix to spelling mistake in dev_dbg message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Johan Hovold <johan@kernel.org>


# 6ca98bc2 02-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: Remove redundant license text

Now that the SPDX tag is in all USB files, that identifies the license
in a specific and legally-defined manner. So the extra GPL text wording
can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text. And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

No copyright headers or other non-license-description text was removed.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5fd54ace 03-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: add SPDX identifiers to all remaining files in drivers/usb/

It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Update the drivers/usb/ and include/linux/usb* files with the correct
SPDX license identifier based on the license text in the file itself.
The SPDX identifier is a legally binding shorthand, which can be used
instead of the full boiler plate text.

This work is based on a script and data from Thomas Gleixner, Philippe
Ombredanne, and Kate Stewart.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 56e6d907 03-Jan-2017 Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>

USB: serial: cypress_m8: remove unused variable

The variable havedata was only being set but never used afterwards.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Johan Hovold <johan@kernel.org>


# c55aee1b 30-Mar-2016 Oliver Neukum <oneukum@suse.com>

USB: cypress_m8: add endpoint sanity check

An attack using missing endpoints exists.

CVE-2016-3137

Signed-off-by: Oliver Neukum <ONeukum@suse.com>
CC: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9db276f8 10-Jan-2016 Peter Hurley <peter@hurleysoftware.com>

tty: Use termios c_*flag macros

Expressions of the form "tty->termios.c_*flag & FLAG"
are more clearly expressed with the termios flags macros,
I_FLAG(), C_FLAG(), O_FLAG(), and L_FLAG().

Convert treewide.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d9a38a87 12-Mar-2014 Johan Hovold <johan@kernel.org>

USB: serial: add missing newlines to dev_<level> messages.

Add missing newlines to dev_<level> messages.

Also make some messages less verbose where appropriate.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


# d7c933ae 12-Mar-2014 Johan Hovold <johan@kernel.org>

USB: cypress_m8: fix potential scheduling while atomic

Remove erroneous call to usb_clear_halt which is blocking and cannot be
used in interrupt context.

This code has possibly never been executed as it would cause an oops if
it was. Simply treat a stalled-endpoint error as any other error
condition.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


# 803a5362 08-Jan-2014 Paul Gortmaker <paul.gortmaker@windriver.com>

usb: delete non-required instances of include <linux/init.h>

None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>. Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ab62a585 02-Jan-2014 Johan Hovold <johan@kernel.org>

USB: cypress_m8: switch to generic TIOCMIWAIT implementation

Switch to the generic TIOCMIWAIT implementation which does not suffer
from the races involved when using the deprecated sleep_on functions.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7603381e 02-Jan-2014 Johan Hovold <johan@kernel.org>

USB: cypress_m8: only wake up MSR queue on changes

Only wake up MSR wait queue on actual modem-status changes.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d7be6221 26-Jun-2013 Johan Hovold <johan@kernel.org>

USB: serial: set drain delay at port probe

The port drain delay is constant and should be set at port probe rather
than open.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1143832e 06-Jun-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: ports: add minor and port number

The usb_serial_port structure had the number field, which was the minor
number for the port, which almost no one really cared about. They
really wanted the number of the port within the device, which you had to
subtract from the minor of the parent usb_serial_device structure. To
clean this up, provide the real minor number of the port, and the number
of the port within the serial device separately, as these numbers might
not be related in the future.

Bonus is that this cleans up a lot of logic in the drivers, and saves
lines overall.

Tested-by: Tobias Winter <tobias@linuxdingsda.de>
Reviewed-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

--
drivers/staging/serqt_usb2/serqt_usb2.c | 21 +++--------
drivers/usb/serial/ark3116.c | 2 -
drivers/usb/serial/bus.c | 6 +--
drivers/usb/serial/console.c | 2 -
drivers/usb/serial/cp210x.c | 2 -
drivers/usb/serial/cypress_m8.c | 4 +-
drivers/usb/serial/digi_acceleport.c | 6 ---
drivers/usb/serial/f81232.c | 5 +-
drivers/usb/serial/garmin_gps.c | 6 +--
drivers/usb/serial/io_edgeport.c | 58 ++++++++++++--------------------
drivers/usb/serial/io_ti.c | 21 ++++-------
drivers/usb/serial/keyspan.c | 29 +++++++---------
drivers/usb/serial/metro-usb.c | 4 +-
drivers/usb/serial/mos7720.c | 37 +++++++++-----------
drivers/usb/serial/mos7840.c | 52 +++++++++-------------------
drivers/usb/serial/opticon.c | 2 -
drivers/usb/serial/pl2303.c | 2 -
drivers/usb/serial/quatech2.c | 7 +--
drivers/usb/serial/sierra.c | 2 -
drivers/usb/serial/ti_usb_3410_5052.c | 10 ++---
drivers/usb/serial/usb-serial.c | 7 ++-
drivers/usb/serial/usb_wwan.c | 2 -
drivers/usb/serial/whiteheat.c | 20 +++++------
include/linux/usb/serial.h | 6 ++-
24 files changed, 133 insertions(+), 180 deletions(-)


# 6529591e 31-May-2013 Robert Butora <robert.butora.fi@gmail.com>

USB: Serial: cypress_M8: Enable FRWD Dongle hidcom device

The patch adds a new HIDCOM device and does not affect other devices
driven by the cypress_M8 module. Changes are:
- add VendorID ProductID to device tables
- skip unstable speed check because FRWD uses 115200bps
- skip reset at probe which is an issue workaround for this
particular device.

Signed-off-by: Robert Butora <robert.butora.fi@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 87ddf4dc 20-Mar-2013 Johan Hovold <johan@kernel.org>

USB: cypress_m8: remove bogus disconnect test from close

Remove disconnected test from close which did not protect any device IO
at all.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c648e94e 20-Mar-2013 Johan Hovold <johan@kernel.org>

USB: cypress_m8: fix TIOCMIWAIT and disconnect

Use tty-port modem-status-change wait queue on which processes are woken
up at hangup and disconnect.

Currently a process waiting on modem-status changes will not be woken on
device disconnect.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 493516e3 20-Mar-2013 Johan Hovold <johan@kernel.org>

USB: cypress_m8: replace custom ioctl operation with tiocmiwait

Replace custom ioctl operation with tiocmiwait.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 356050d8 19-Mar-2013 Johan Hovold <johan@kernel.org>

USB: cypress_m8: fix use-after-free in TIOCMIWAIT

Use the port wait queue and make sure to check the serial disconnected
flag before accessing private port data after waking up.

This is is needed as the private port data (including the wait queue
itself) can be gone when waking up after a disconnect.

Also remove bogus test for private data pointer being NULL as it is
never assigned in the loop.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2e124b4a 03-Jan-2013 Jiri Slaby <jirislaby@kernel.org>

TTY: switch tty_flip_buffer_push

Now, we start converting tty buffer functions to actually use
tty_port. This will allow us to get rid of the need of tty in many
call sites. Only tty_port will needed and hence no more
tty_port_tty_get in those paths.

Now, the one where most of tty_port_tty_get gets removed:
tty_flip_buffer_push.

IOW we also closed all the races in drivers not using tty_port_tty_get
at all yet.

Also we move tty_flip_buffer_push declaration from include/linux/tty.h
to include/linux/tty_flip.h to all others while we are changing it
anyway.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2f693357 03-Jan-2013 Jiri Slaby <jirislaby@kernel.org>

TTY: convert more flipping functions

Now, we start converting tty buffer functions to actually use
tty_port. This will allow us to get rid of the need of tty pointer in
many call sites. Only tty_port will be needed and hence no more
tty_port_tty_get calls in those paths.

Now 4 string flipping ones are on turn:
* tty_insert_flip_string_flags
* tty_insert_flip_string_fixed_flag
* tty_prepare_flip_string
* tty_prepare_flip_string_flags

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# bcbec053 31-Oct-2012 Johan Hovold <johan@kernel.org>

USB: serial: remove driver version information

Remove all MODULE_VERSION macros and driver-version information (except
for garmin_gps which uses it in a status reply).

It is the kernel version that matters and not some private version
scheme which rarely even gets updated.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5c1a0f41 17-Oct-2012 Johan Hovold <johan@kernel.org>

USB: cypress_m8: fix port-data memory leak

Fix port-data memory leak by replacing attach and release with
port_probe and port_remove.

Since commit 0998d0631001288 (device-core: Ensure drvdata = NULL when no
driver is bound) the port private data is no longer freed at release as
it is no longer accessible.

Compile-only tested.

Cc: <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f462376e 18-Sep-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: Serial: cypress_m8.c: remove debug module parameter

Now that all usb-serial modules are only using dev_dbg()
the debug module parameter does not do anything at all, so
remove it to reduce any confusion if someone were to try to
use it.

CC: Lonnie Mendez <dignome@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 59d33f2f 18-Sep-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: remove debug parameter from usb_serial_debug_data()

We should use dev_dbg() for usb_serial_debug_data() like all of the rest
of the usb-serial drivers use, so remove the debug parameter as it's not
needed.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# dfa1c315 14-Sep-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: cypress_m8.c: remove dbg() usage

dbg() was a very old USB-serial-specific macro.
This patch removes it from being used in the
driver and uses dev_dbg() instead.

CC: Lonnie Mendez <dignome@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# adc8d746 14-Jul-2012 Alan Cox <alan@linux.intel.com>

tty: move the termios object into the tty

This will let us sort out a whole pile of tty related races. The
alternative would be to keep points and refcount the termios objects.
However
1. They are tiny anyway
2. Many devices don't use the stored copies
3. We can remove a pty special case

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 68e24113 08-May-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: rework usb_serial_register/deregister_drivers()

This reworks the usb_serial_register_drivers() and
usb_serial_deregister_drivers() to not need a pointer to a struct
usb_driver anymore. The usb_driver structure is now created dynamically
and registered and unregistered as needed.

This saves lines of code in each usb-serial driver. All in-kernel users
of these functions were also fixed up at this time. The pl2303 driver
was tested that everything worked properly.

Thanks for the idea to do this from Alan Stern.

Cc: Adhir Ramjiawan <adhirramjiawan0@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Al Borchers <alborchers@steinerpoint.com>
Cc: Aleksey Babahin <tamerlan311@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andrew Worsley <amworsley@gmail.com>
Cc: Bart Hartgers <bart.hartgers@gmail.com>
Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Dan Carpenter <error27@gmail.com>
Cc: Dan Williams <dcbw@redhat.com>
Cc: Donald Lee <donald@asix.com.tw>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Gary Brubaker <xavyer@ix.netcom.com>
Cc: Jesper Juhl <jj@chaosbits.net>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Johan Hovold <jhovold@gmail.com>
Cc: Julia Lawall <julia@diku.dk>
Cc: Kautuk Consul <consul.kautuk@gmail.com>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Lonnie Mendez <dignome@gmail.com>
Cc: Matthias Bruestle and Harald Welte <support@reiner-sct.com>
Cc: Matthias Urlichs <smurf@smurf.noris.de>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Michal Sroczynski <msroczyn@gmail.com>
Cc: "Michał Wróbel" <michal.wrobel@flytronic.pl>
Cc: Oliver Neukum <oliver@neukum.name>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Peter Berger <pberger@brimson.com>
Cc: Preston Fick <preston.fick@silabs.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Rigbert Hamisch <rigbert@gmx.de>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Simon Arlott <simon@fire.lp0.eu>
Cc: Support Department <support@connecttech.com>
Cc: Thomas Tuttle <ttuttle@chromium.org>
Cc: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Cc: Wang YanQing <Udknight@gmail.com>
Cc: William Greathouse <wgreathouse@smva.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 32078f91 07-May-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: remove usb_serial_disconnect call in all drivers

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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5026bb07 07-May-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: remove usb_serial_probe call in all drivers

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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 108feb66 03-May-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: cypress_m8.c: remove dbg() tracing calls

dbg() was used a lot a long time ago to trace code flow. Now that we have
ftrace, this isn't needed at all, so remove these calls.

CC: Lonnie Mendez <dignome@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7e3131f8 28-Feb-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: cypress_m8.c: use module_usb_serial_driver

This converts the cypress_m8.c driver to use the module_usb_serial_driver() call
instead of having to have a module_init/module_exit function, saving a lot
of duplicated code.

CC: Lonnie Mendez <dignome@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 08a4f6bc 23-Feb-2012 Alan Stern <stern@rowland.harvard.edu>

usb-serial: use new registration API in [a-c]* drivers

This patch (as1523) modifies the following usb-serial drivers to
utilize the new usb_serial_{de}register_drivers() routines:

aircable, ark3116, belkin_sa, ch341, cp210x, cyberjack,
and cypress_m8.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 22a416c4 10-Feb-2012 Johan Hovold <johan@kernel.org>

USB: serial: use dev_err_console in custom write paths

Use dev_err_console in write paths for devices which can be used as a
console but do not use the generic write implementation.

Compile-only tested.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 90ab5ee9 12-Jan-2012 Rusty Russell <rusty@rustcorp.com.au>

module_param: make bool parameters really bool (drivers & misc)

module_param(bool) used to counter-intuitively take an int. In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.

It's time to remove the int/unsigned int option. For this version
it'll simply give a warning, but it'll break next kernel version.

Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


# 5833041f 06-Nov-2011 Johan Hovold <johan@kernel.org>

USB: serial: remove unnecessary reinitialisations of urb->dev

Remove unnecessary reinitialisations of urb->dev before each submission,
which were based on the (no longer valid) assumption that serial->dev
will be set to NULL on close.

Compile-only tested.

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: Support Department <support@connecttech.com>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 14b54e39 06-Nov-2011 Johan Hovold <johan@kernel.org>

USB: serial: remove changelogs and old todo entries

Remove remaining changelogs from file headers (can still be retrieved
through git).
Remove even older changelog entries stored in Changelog.history.
Remove outdated todo entries from belkin_sa.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 25985edc 30-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi>

Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>


# 00a0d0d6 14-Feb-2011 Alan Cox <alan@linux.intel.com>

tty: remove filp from the USB tty ioctls

We don't use it so we can trim it from here as we try and stamp the file
object dependencies out of the serial code.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 20b9d177 14-Feb-2011 Alan Cox <alan@linux.intel.com>

tiocmset: kill the file pointer argument

Doing tiocmget was such fun we should do tiocmset as well for the same
reasons

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 60b33c13 14-Feb-2011 Alan Cox <alan@linux.intel.com>

tiocmget: kill off the passing of the struct file

We don't actually need this and it causes problems for internal use of
this functionality. Currently there is a single use of the FILE * pointer.
That is the serial core which uses it to check tty_hung_up_p. However if
that is true then IO_ERROR is also already set so the check may be removed.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 7f26b3a7 04-Aug-2010 Joe Perches <joe@perches.com>

drivers/usb: Remove unnecessary return's from void functions

Greg prefers this to go through the trivial tree.
http://lkml.org/lkml/2010/6/24/1

There are about 2500 void functions in drivers/usb
Only a few used return; at end of function.

Standardize them a bit.

Moved a statement down a line in drivers/usb/host/u132-hcd.c

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 117fb8d0 16-May-2010 Johan Hovold <johan@kernel.org>

USB: cypress_m8: use kfifo to implement write buffering

Kill custom fifo implementation.

Note that cypress_m8 has no port write fifo as it has no bulk-out
endpoint.

Compile-only tested.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# c4f4736f 16-May-2010 Johan Hovold <johan@kernel.org>

USB: cypress_m8: remove unused drain define

Driver uses tty-port drain these days.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 70ced221 07-May-2010 Johan Hovold <johan@kernel.org>

USB: tty: fix incorrect use of tty_insert_flip_string_fixed_flag

Fix regression introduced by commit
a108bfcb372d8c4452701039308fb95747911c59 (USB: tty: Prune uses of
tty_request_room in the USB layer) which broke three drivers
(cypress_m8, digi_acceleport and spcp8x5) through incorrect use of
tty_insert_flip_string_fixed_flag.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Cc: stable <stable@kernel.org> [.34]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 1f87158e 17-Feb-2010 Alan Stern <stern@rowland.harvard.edu>

USB: remove references to port->port.count from the serial drivers

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>


# a108bfcb 18-Feb-2010 Alan Cox <alan@linux.intel.com>

USB: tty: Prune uses of tty_request_room in the USB layer

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>


# a45a1e07 16-Jan-2010 Julia Lawall <julia@diku.dk>

USB: serial: Eliminate useless code

The variables priv and portdata are initialized twice to the same (side
effect-free) expressions. Drop one initialization in each case.

A simplified version of the semantic match that finds this problem is:
(http://coccinelle.lip6.fr/)

// <smpl>
@forall@
idexpression *x;
identifier f!=ERR_PTR;
@@

x = f(...)
... when != x
(
x = f(...,<+...x...+>,...)
|
* x = f(...)
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 7d40d7e8 10-Jan-2010 Németh Márton <nm127@freemail.hu>

USB serial: make USB device id constant

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>


# 0f2c2d7b 31-Dec-2009 Johan Hovold <johan@kernel.org>

USB: cypress_m8: use put_unaligned_le32() where necessary

Cc: Lonnie Mendez <dignome@gmail.com>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 974fccb7 28-Dec-2009 Johan Hovold <johan@kernel.org>

USB: cypress_m8: fix endianess bug

Cc: Lonnie Mendez <dignome@gmail.com>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 0954644b 28-Dec-2009 Johan Hovold <johan@kernel.org>

USB: cypress_m8: fix DMA buffer on stack

Cc: Lonnie Mendez <dignome@gmail.com>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# c312659c 18-Dec-2009 Mike Frysinger <vapier@gentoo.org>

USB: cypress_m8: allow unstable baud rates

I've got a crappy cypress converter here, and while running at higher
baud rates craps out on throughput, it works fine with lower ones.
While it'd be nice to simply use a lower baud rate, not all devices
can be configured this way, and it is possible to (slowly) interact
at higher rates by sending a byte at a time. So let people force
higher rates when they need it via a module parameter.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 2805eb13 18-Dec-2009 Mike Frysinger <vapier@gentoo.org>

USB: cypress_m8: unify confusing new baudrate check

The current code has a confusing duplicate new_baudrate init when setting
the serial parameters. So just combine the if statement checks to avoid
this.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 64319dd7 18-Dec-2009 Mike Frysinger <vapier@gentoo.org>

USB: cypress_m8: stop using USB debug driver config

The USB_SERIAL_DEBUG Kconfig is for the USB serial debug driver, not for
generically enabling debug output in random USB serial drivers.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 3ad2f3fb 02-Feb-2010 Daniel Mack <daniel@caiaq.de>

tree-wide: Assorted spelling fixes

In particular, several occurances of funny versions of 'success',
'unknown', 'therefore', 'acknowledge', 'argument', 'achieve', 'address',
'beginning', 'desirable', 'separate' and 'necessary' are fixed.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Joe Perches <joe@perches.com>
Cc: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 63832515 07-Oct-2009 Oliver Neukum <oliver@neukum.org>

USB: serial: fix assumption that throttle/unthrottle cannot sleep

many serial subdrivers are clearly written as if throttle/unthrottle
cannot sleep. This leads to unneeded atomic submissions. This
patch converts affected drivers in a way to makes very clear that
throttle/unthrottle can sleep. Thus future misdesigns can be avoided
and efficiency and reliability improved.

This removes any such assumption using GFP_KERNEL and spin_lock_irq()

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# fe1ae7fd 19-Sep-2009 Alan Cox <alan@linux.intel.com>

tty: USB serial termios bits

Various drivers have hacks to mangle termios structures. This stems from
the fact there is no nice setup hook for configuring the termios settings
when the port is created

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# a509a7e4 19-Sep-2009 Alan Cox <alan@linux.intel.com>

tty: USB does not need the filp argument in the drivers

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>


# 4d2fae8b 08-Jul-2009 Alan Stern <stern@rowland.harvard.edu>

USB: cypress_m8: remove invalid Clear-Halt

This patch (as1265) removes an erroneous call to usb_clear_halt from
the cypress_m8 driver. The call isn't valid because it is made from
interrupt context whereas usb_clear_halt is a blocking routine.

Presumably the code has never been executed; if it did it would cause
an oops. So instead treat -EPIPE like any other sort of unexplained
error.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# f9c99bb8 02-Jun-2009 Alan Stern <stern@rowland.harvard.edu>

USB: usb-serial: replace shutdown with disconnect, release

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>


# 335f8514 10-Jun-2009 Alan Cox <alan@lxorguk.ukuu.org.uk>

tty: Bring the usb tty port structure into more use

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>


# 2400a2bf 20-Apr-2009 Oliver Neukum <oliver@neukum.org>

USB: removal of tty->low_latency hack dating back to the old serial code

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>


# 194343d9 20-Aug-2008 Greg Kroah-Hartman <gregkh@suse.de>

USB: remove use of err() in drivers/usb/serial

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>


# c197a8db 18-Aug-2008 Greg Kroah-Hartman <gregkh@suse.de>

USB: remove info() macro from usb/serial drivers

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>


# 4a90f09b 13-Oct-2008 Alan Cox <alan@redhat.com>

tty: usb-serial krefs

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>


# 77336828 22-Jul-2008 Alan Cox <alan@redhat.com>

usb-cypress: There is no 0 case to go with CS5/6/7/8 so remove the test

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>


# 813a224f 22-Jul-2008 Alan Cox <alan@redhat.com>

cypress_m8: coding style

Coding style clean ups

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>


# 95da310e 22-Jul-2008 Alan Cox <alan@redhat.com>

usb_serial: API all change

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>


# fd05e720 28-Apr-2008 Al Viro <viro@ftp.linux.org.uk>

drivers/usb annotations and fixes

* endianness annotations
* endianness fixes
* missing get_unaligned/put_unaligned

It's pretty much all over the place, changes to different files are independent.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Serial-parts-Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# cdc97792 24-Feb-2008 Ming Lei <tom.leiming@gmail.com>

USB: remove unnecessary type casting of urb->context

urb->context code cleanup

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 441b62c1 03-Mar-2008 Harvey Harrison <harvey.harrison@gmail.com>

USB: replace remaining __FUNCTION__ occurrences

__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 0ba4034e 16-Apr-2008 Greg Kroah-Hartman <gregkh@suse.de>

USB: serial: remove unneeded number endpoints settings

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>


# 8873aaa6 10-Mar-2008 Alan Cox <alan@lxorguk.ukuu.org.uk>

USB: cypress_m8: Speed handling

The recent changes to this driver cleaned it up a lot, follow that up
by sorting the speed side of things out as well

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 92983c21 10-Feb-2008 Mike Isely <isely@pobox.com>

USB: cypress_m8: Limit baud rate to <=4800 for USB low speed devices

The cypress app note for the M8 states that for the USB low speed
version of the part, throughput is effectively limited to 800
bytes/sec. So if we were to try a faster baud rate in such cases then
we risk overrun errors on receive. Best to just identify this case
and limit the rate to 4800 baud or less (by ignoring any request to
set a faster rate). The old baud rate setting code was somewhat
fragile; this change also hopefully makes it easier in the future to
better checking / limiting.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 6768306c 10-Feb-2008 Mike Isely <isely@pobox.com>

USB: cypress_m8: Get rid of pointless NULL check

Remove a NULL check in cypress_m8; the check is useless in this
context because it is referenced earlier in the same code path thus
the kernel would be oops'ed before reaching this point anyway. (And
it's really pointless here anyway; if this pointer somehow is NULL the
driver is going to have serious problems in many other places.)

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 3d6aa320 10-Feb-2008 Mike Isely <isely@pobox.com>

USB: cypress_m8: Don't issue GET_CONFIG for certain devices

Earthmate LT-20 devices (both "old" and "new" versions) can't tolerate
a GET_CONFIG command. The original Earthmate has no trouble with
this. Presumably other non-Earthmate devices are still OK as well.
This change disables the use of GET_CONFIG for cases where it is known
not to work.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 3416eaa1 10-Feb-2008 Mike Isely <isely@pobox.com>

USB: cypress_m8: Packet format is separate from characteristic size

cypress_m8: Packet format is separate from characteristic size

The Cypress app note states that when using an 8 byte packet buffer
size that the packet format is modified (to be more compact). However
I have since discovered that newer DeLorme Earthmate LT-20 devices
(those that are low speed USB with 8 byte packet size) STILL use the
format that is really supposed to correspond to 32 byte packets.
Further confusing things is the subsequent discovery that there are
actually two different types of LT-20 - older LT-20's use 32 byte
packets which is probably why this issue wasn't originally
encountered. The solution here is to flag the packet format
separately from the buffer size. Then at initialization time,
identify the correct combination and set it up. This is a critical
fix for anyone with a newer LT-20. Older devices and non-Earthmate
devices should remain unaffected by this change. (If other devices
behave in this, uh, unexpected manner, it's now just a simple 1 line
change to fix them as well (change the pkt_fmt member for that
device). Default behavior with this patch is still to drive the
format as per the app-note; of course for Earthmate devices this is
overridden.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 93075544 10-Feb-2008 Mike Isely <isely@isely.net>

USB: cypress_m8: Feature buffer fixes

cypress_m8: Feature buffer fixes

From: Mike Isely <isely@pobox.com>

Don't hardcode the feature buffer size; use sizeof() instead. That
way we can easily specify the size in a single spot. Speaking of the
feature buffer size, the Cypress app note (and further testing with a
DeLorme Earthmate) suggests that this size should be 5 not 8 bytes.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 6f6f06ee 04-Mar-2008 Dmitry Shapin <shapin@googlemail.com>

USB: cypress_m8: add UPS Powercom (0d9f:0002)

Add support for UPS Powercom USB interface (0d9f:0002) in chip CY7C63723.
In my case, this Powercom BNT800AP.

Signed-off-by: Dmitry Shapin <shapin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 9e3b1d8e 22-Jan-2008 Oliver Neukum <oliver@neukum.org>

USB: stop abuse of intfdata in cypress_m8

this driver uses usb_get_intfdata() == NULL as a test for disconnect().
You must not do that as this races with probe(). By the time you test
your erstwhile interface may already be somebody else's interface.
This fixes the close() method of cypress_m8 to use the recently introduced
flag and use locking against disconnect() where required in close().

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 8d7bc55e 15-Jun-2007 Greg Kroah-Hartman <gregkh@suse.de>

USB: serial: cypress_m8: clean up urb->status usage

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: Lonnie Mendez <dignome@gmail.com>
Cc: Neil Whelchel <koyama@firstlight.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# d9b1b787 17-Dec-2006 Johannes Hölzl <johannes.hoelzl@gmx.de>

USB serial: add driver pointer to all usb-serial drivers

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>


# b1cff285 04-Dec-2006 Alan Cox <alan@lxorguk.ukuu.org.uk>

usb serial: Eliminate bogus ioctl code

Several drivers have bogus ioctl code that tries unneccessarily to
override the standard processing. In the three cases here the actual code
is not only wrong but also not required as they implement the proper
set_termios method as well.

Remove the junk.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 5cbded58 13-Dec-2006 Robert P. J. Day <rpjday@mindspring.com>

[PATCH] getting rid of all casts of k[cmz]alloc() calls

Run this:

#!/bin/sh
for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do
echo "De-casting $f..."
perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f
done

And then go through and reinstate those cases where code is casting pointers
to non-pointers.

And then drop a few hunks which conflicted with outstanding work.

Cc: Russell King <rmk@arm.linux.org.uk>, Ian Molton <spyro@f2s.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Greg KH <greg@kroah.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Karsten Keil <kkeil@suse.de>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Ian Kent <raven@themaw.net>
Cc: Steven French <sfrench@us.ibm.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 606d099c 08-Dec-2006 Alan Cox <alan@lxorguk.ukuu.org.uk>

[PATCH] tty: switch to ktermios

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>


# 2e46b748 17-Nov-2006 Mariusz Kozlowski <m.kozlowski@tuxland.pl>

usb: cypress_m8 init error path fix

If at some point cypress_init() fails deregister
only the resources that were registered until that point.

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 7d12e780 05-Oct-2006 David Howells <dhowells@redhat.com>

IRQ: Maintain regs pointer globally rather than passing to IRQ handlers

Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.

The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).

Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.

Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.

I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.

This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

struct pt_regs *old_regs = set_irq_regs(regs);

And put the old one back at the end:

set_irq_regs(old_regs);

Don't pass regs through to generic_handle_irq() or __do_IRQ().

In timer_interrupt(), this sort of change will be necessary:

- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);

I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().

Some notes on the interrupt handling in the drivers:

(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.

(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.

(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.

Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)


# 78aef519 29-Aug-2006 Mike Isely <isely@pobox.com>

cypress_m8: implement graceful failure handling

When receiving a fatal error from the USB core, e.g. EILSEQ (which can
happen if the polling interval is too short), fail gracefully.
Previously the driver would fill the log with useless error messages
or (more alarmingly) silently spin forever trying to write updated
control information to the device. This change implements a new flag
which if cleared indicates that the driver has failed. The flag will
be set on initialization, cleared on fatal errors, and anything else
that touches the USB port in the driver will abort if the flag is
clear. When the flag is cleared, a message will be logged indicating
that the driver has failed.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 48298e50 29-Aug-2006 Mike Isely <isely@pobox.com>

cypress_m8: improve control endpoint error handling

Fix usb core function error return checks to look for negative errno
values, not positive errno values. This bug had rendered those checks
useless. Also remove attempted error recovery on control endpoints
for EPIPE - with control endpoints EPIPE does not indicate a halted
endpoint so trying to recover with usb_clear_halt() is not the correct
action.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 9aa8dae7 29-Aug-2006 Mike Isely <isely@pobox.com>

cypress_m8: use usb_fill_int_urb where appropriate

Rather than directly filling in URB fields, it's safer to use
usb_fill_int_urb(). This improves robustness of the driver; URB
changes in the future will not go uninitialized here. That point not
withstanding, this driver should at least be self-consistent. Either
use usb_fill_int_urb() everywhere or don't bother with it all.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 0257fa9f 29-Aug-2006 Mike Isely <isely@pobox.com>

cypress_m8: use appropriate URB polling interval

The polling interval for the device can't always be 1msec. If it is
too quick, the device can fail causing a fatal (to the driver) EILSEQ
error from the USB core. The actual correct value is reported by the
device as part of its configuration data, so use that value as the
default. On a DeLorme Earthmate for example, the device reports that
it wants a 6msec interval. As part of this fix, the "interval" module
option has been fixed as well; the device's default can be overridden
by specifying interval=<value> as a module option.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# a969888c 11-Jul-2006 Greg Kroah-Hartman <gregkh@suse.de>

[PATCH] USB: move usb-serial.h to include/linux/usb/

USB serial outside of the kernel tree can not build properly due to
usb-serial.h being buried down in the source tree. This patch moves the
location of the file to include/linux/usb and fixes up all of the usb
serial drivers to handle the move properly.

Cc: Sergei Organov <osv@javad.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 6ab3d562 30-Jun-2006 Jörn Engel <joern@wohnheim.fh-wedel.de>

Remove obsolete #include <linux/config.h>

Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>


# cf2c7481 22-May-2006 Pete Zaitcev <zaitcev@redhat.com>

[PATCH] USB serial: encapsulate schedule_work, remove double-calling

I'm going to throw schedule_work away, it's retarded. But for starters,
let's have it encapsulated.

Also, generic and whiteheat were both calling usb_serial_port_softint
and scheduled work. Only one was necessary.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# a5c44e29 01-Mar-2006 Lonnie Mendez <lmendez19@austin.rr.com>

[PATCH] USB: cypress_m8: add support for the Nokia ca42-version 2 cable

This patch adds support for the Nokia ca42 version 2 cable to the
cypress_m8 driver. The device was tested by others with this patch and
found to be compatible with the cypress_m8 driver. A special note
should be taken that this cable seems to vary in the type of chipset
used. This patch supports the cable with product id 0x4101.

Signed-off-by: Lonnie Mendez <lmendez19@austin.rr.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 80b6ca48 27-Feb-2006 Eric Sesterhenn <snakebyte@gmx.de>

[PATCH] USB: kzalloc() conversion for rest of drivers/usb

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 33f0f88f 09-Jan-2006 Alan Cox <alan@lxorguk.ukuu.org.uk>

[PATCH] TTY layer buffering revamp

The API and code have been through various bits of initial review by
serial driver people but they definitely need to live somewhere for a
while so the unconverted drivers can get knocked into shape, existing
drivers that have been updated can be better tuned and bugs whacked out.

This replaces the tty flip buffers with kmalloc objects in rings. In the
normal situation for an IRQ driven serial port at typical speeds the
behaviour is pretty much the same, two buffers end up allocated and the
kernel cycles between them as before.

When there are delays or at high speed we now behave far better as the
buffer pool can grow a bit rather than lose characters. This also means
that we can operate at higher speeds reliably.

For drivers that receive characters in blocks (DMA based, USB and
especially virtualisation) the layer allows a lot of driver specific
code that works around the tty layer with private secondary queues to be
removed. The IBM folks need this sort of layer, the smart serial port
people do, the virtualisers do (because a virtualised tty typically
operates at infinite speed rather than emulating 9600 baud).

Finally many drivers had invalid and unsafe attempts to avoid buffer
overflows by directly invoking tty methods extracted out of the innards
of work queue structs. These are no longer needed and all go away. That
fixes various random hangs with serial ports on overflow.

The other change in here is to optimise the receive_room path that is
used by some callers. It turns out that only one ldisc uses receive room
except asa constant and it updates it far far less than the value is
read. We thus make it a variable not a function call.

I expect the code to contain bugs due to the size alone but I'll be
watching and squashing them and feeding out new patches as it goes.

Because the buffers now dynamically expand you should only run out of
buffering when the kernel runs out of memory for real. That means a lot of
the horrible hacks high performance drivers used to do just aren't needed any
more.

Description:

tty_insert_flip_char is an old API and continues to work as before, as does
tty_flip_buffer_push() [this is why many drivers dont need modification]. It
does now also return the number of chars inserted

There are also

tty_buffer_request_room(tty, len)

which asks for a buffer block of the length requested and returns the space
found. This improves efficiency with hardware that knows how much to
transfer.

and tty_insert_flip_string_flags(tty, str, flags, len)

to insert a string of characters and flags

For a smart interface the usual code is

len = tty_request_buffer_room(tty, amount_hardware_says);
tty_insert_flip_string(tty, buffer_from_card, len);

More description!

At the moment tty buffers are attached directly to the tty. This is causing a
lot of the problems related to tty layer locking, also problems at high speed
and also with bursty data (such as occurs in virtualised environments)

I'm working on ripping out the flip buffers and replacing them with a pool of
dynamically allocated buffers. This allows both for old style "byte I/O"
devices and also helps virtualisation and smart devices where large blocks of
data suddenely materialise and need storing.

So far so good. Lots of drivers reference tty->flip.*. Several of them also
call directly and unsafely into function pointers it provides. This will all
break. Most drivers can use tty_insert_flip_char which can be kept as an API
but others need more.

At the moment I've added the following interfaces, if people think more will
be needed now is a good time to say

int tty_buffer_request_room(tty, size)

Try and ensure at least size bytes are available, returns actual room (may be
zero). At the moment it just uses the flipbuf space but that will change.
Repeated calls without characters being added are not cumulative. (ie if you
call it with 1, 1, 1, and then 4 you'll have four characters of space. The
other functions will also try and grow buffers in future but this will be a
more efficient way when you know block sizes.

int tty_insert_flip_char(tty, ch, flag)

As before insert a character if there is room. Now returns 1 for success, 0
for failure.

int tty_insert_flip_string(tty, str, len)

Insert a block of non error characters. Returns the number inserted.

int tty_prepare_flip_string(tty, strptr, len)

Adjust the buffer to allow len characters to be added. Returns a buffer
pointer in strptr and the length available. This allows for hardware that
needs to use functions like insl or mencpy_fromio.

Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: John Hawkes <hawkes@sgi.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 943ffb58 09-Jan-2006 Adrian Bunk <bunk@stusta.de>

spelling: s/retreive/retrieve/

Signed-off-by: Adrian Bunk <bunk@stusta.de>


# ba9dc657 16-Nov-2005 Greg Kroah-Hartman <gregkh@suse.de>

[PATCH] USB: allow usb drivers to disable dynamic ids

This lets drivers, like the usb-serial ones, disable the ability to add
ids from sysfs.

The usb-serial drivers are "odd" in that they are really usb-serial bus
drivers, not usb bus drivers, so the dynamic id logic will have to go
into the usb-serial bus core for those drivers to get that ability.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 269bda1c 20-Jun-2005 Greg Kroah-Hartman <gregkh@suse.de>

[PATCH] USB Serial: move name to driver structure

This fixes up a lot of problems in sysfs with some of the usb serial
drivers, they had incorrect driver names. Also saves a tiny ammount
of memory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 18fcac35 20-Jun-2005 Greg Kroah-Hartman <gregkh@suse.de>

[PATCH] USB Serial: get rid of the .owner field in usb_serial_driver

Don't duplicate something that's already in struct driver.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# ea65370d 20-Jun-2005 Greg Kroah-Hartman <gregkh@suse.de>

[PATCH] USB Serial: rename usb_serial_device_type to usb_serial_driver

I'm tired of trying to explain why a "device_type" is really a driver.
This better describes exactly what this structure is.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 22c43863 15-Aug-2005 Nishanth Aravamudan <nacc@us.ibm.com>

[PATCH] drivers/usb: fix-up schedule_timeout() usage

Description: Use schedule_timeout_{,un}interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# b9db07fb 12-Jul-2005 Lonnie Mendez <lmendez19@austin.rr.com>

[PATCH] USB: whitespace fixes for cypress_m8 driver

Reading this driver I noticed some trailing whitespaces and tabs so I
removed them with some 80th column fitting and a few more similar
things.

From: Carlo Perassi <carlo@linux.it>
Signed-off-by: Lonnie Mendez <dignome@gmail.com>
Signed-off-by: Carlo Perassi <carlo@linux.it>
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 25b6f08e 10-May-2005 Lonnie Mendez <lmendez19@austin.rr.com>

[PATCH] USB: cypress_m8: add support for the DeLorme Earthmate lt-20

This patch adds support for the DeLorme Earthmate lt-20 to the
cypress_m8 driver. The device was tested and found to be compatible
with the cypress_m8 driver. This is a resend with the complete patch
which properly compiles.

Adds support for the DeLorme Earthmate lt-20 to the cypress_m8 driver.

Signed-off-by: Lonnie Mendez <lmendez19@austin.rr.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 3cb4a4f7 03-May-2005 Lonnie Mendez <lmendez19@austin.rr.com>

[PATCH] USB cypress_m8: update kernel driver with current source

Fixed problem where setting or retreiving the serial config would fail
with EPIPE. Removed CRTS toggling so the driver behaves more like other
usbserial adapters. Issued new interval of 1ms instead of the default
bInterval. As a result, transfer speed has been substantially
increased. From avg. 850bps to avg. 3300bps. Also added new module
parameter 'interval' to tweak the interval in case this change causes
problems for someone. Cleaned up code and formatting issues so source
is more readable. Replaced the C++ style comments. Various other code
cleanups.

Signed-off-by: Lonnie Mendez <lmendez19@austin.rr.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 093cf723 03-May-2005 Steven Cole <elenstev@mesatop.com>

[PATCH] USB: Spelling fixes for drivers/usb.

Here are some spelling corrections for drivers/usb.

cancelation -> cancellation
succesful -> successful
cancelation -> cancellation
decriptor -> descriptor
Initalize -> Initialize
wierd -> weird
Protocoll -> Protocol
occured -> occurred
successfull -> successful
Procesing -> Processing
devide -> divide
Isochronuous -> Isochronous
noticable -> noticeable
Basicly -> Basically
transfering -> transferring
intialize -> initialize
Incomming -> Incoming
additionnal -> additional
asume -> assume
Unfortunatly -> Unfortunately
retreive -> retrieve
tranceiver -> transceiver
Compatiblity -> Compatibility
Incorprated -> Incorporated
existance -> existence
Ununsual -> Unusual

Signed-off-by: Steven Cole <elenstev@mesatop.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 1bc3c9e1 18-Apr-2005 Jesper Juhl <juhl-lkml@dif.dk>

[PATCH] USB: kfree cleanup for drivers/usb/* - no need to check for NULL

Get rid of a bunch of redundant NULL pointer checks in drivers/usb/*,
there's no need to check a pointer for NULL before calling kfree() on it.

Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


Index: gregkh-2.6/drivers/usb/class/audio.c
===================================================================


# 1da177e4 16-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org>

Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!