History log of /linux-master/drivers/usb/serial/io_ti.c
Revision Date Author Comments
# 6ff58ae1 04-Jun-2023 Johan Hovold <johan@kernel.org>

USB: serial: return errors from break handling

Start propagating errors to user space when setting the break state
fails.

This will be used by follow-on changes to also report when a driver or
device does not support break control.

Tested-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Johan Hovold <johan@kernel.org>


# 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>


# 908e698f 21-May-2022 Robert Eckelmann <longnoserob@gmail.com>

USB: serial: io_ti: add Agilent E5805A support

Add support for Agilent E5805A (rebranded ION Edgeport/4) to io_ti.

Signed-off-by: Robert Eckelmann <longnoserob@gmail.com>
Link: https://lore.kernel.org/r/20220521230808.30931eca@octoberrain
Cc: stable@vger.kernel.org
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>


# 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>


# 46388e86 12-Apr-2021 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: drop unnecessary packed attributes

Drop unnecessary packed attributes from structures that don't need it
and use the __packed macro consistently.

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


# 35aeb1b3 12-Apr-2021 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: use kernel types consistently

Use kernel types consistently by replacing the remaining __uXX types.

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


# 13c61339 12-Apr-2021 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: add read-port-command helper

Add a read-port-command helper analogous to the send-port-command
helper to take care of the UART module id instead of open coding.

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


# 7a14fac0 12-Apr-2021 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: add send-port-command helper

Add a send-port-command helper which takes care of determining the UART
module id when sending commands instead of doing so at every call site.

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


# e8d89db0 12-Apr-2021 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: clean up vendor-request helpers

Clean up the vendor-request helpers by using kernel-types consistently
and using void pointers for the data arguments, which allows removing
a cast from one caller.

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


# 4b8e0795 12-Apr-2021 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: document reason for drain delay

Document that the device line-status register doesn't tell when the
transmitter shift register has emptied and that this is why the
one-character drain delay is needed.

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


# 2813b165 06-Apr-2021 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: switch to 30-second closing wait

Switch to using the system-wide default 30-second closing-wait timeout
instead of the driver specific 40-second timeout.

The timeout can be changed per port using TIOCSSERIAL (setserial) if
needed.

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


# d669a51d 06-Apr-2021 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: drop closing_wait module parameter

Now that all USB serial drivers supports setting the closing_wait
parameter through TIOCSSERIAL (setserial) it's time to drop the
corresponding io_ti module parameter.

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


# f64d74a5 06-Apr-2021 Johan Hovold <johan@kernel.org>

USB: serial: stop reporting legacy UART types

The TIOCGSERIAL ioctl can be used to set and retrieve the UART type for
legacy UARTs, but some USB serial drivers have been reporting back
random types in order to "make user-space happy".

Some applications have historically expected TIOCGSERIAL to be
implemented, but judging from the Debian sources, the port type not
being PORT_UNKNOWN is only used to check for the existence of legacy
serial ports (ttySn).

Drivers like ftdi_sio have been using PORT_UNKNOWN for twenty years (and
option for 10 years) without anyone complaining so let's stop reporting
back anything else.

In the unlikely event that this do cause problems, this should be fixed
tree-wide anyway (e.g. for all USB serial drivers and also CDC-ACM).

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


# 01fd45f6 06-Apr-2021 Johan Hovold <johan@kernel.org>

USB: serial: add generic support for TIOCSSERIAL

TIOCSSERIAL is a horrid, underspecified, legacy interface which for most
serial devices is only useful for setting the close_delay and
closing_wait parameters.

The closing_wait parameter determines how long to wait for the transfer
buffers to drain during close and the default timeout of 30 seconds may
not be sufficient at low line speeds. In other cases, when for example
flow is stopped, the default timeout may instead be too long.

Add generic support for TIOCSSERIAL and TIOCGSERIAL with handling of the
three common parameters close_delay, closing_wait and line for the
benefit of all USB serial drivers while still allowing drivers to
implement further functionality through the existing callbacks.

This currently includes a few drivers that report their base baud clock
rate even if that is really only of interest when setting custom
divisors through the deprecated ASYNC_SPD_CUST interface; an interface
which only the FTDI driver actually implements.

Some drivers have also been reporting back a fake UART type, something
which should no longer be needed and will be dropped by a follow-on
patch.

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


# c2f58d24 06-Apr-2021 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: fix TIOCGSERIAL implementation

TIOCSSERIAL is a horrid, underspecified, legacy interface which for most
serial devices is only useful for setting the close_delay and
closing_wait parameters.

The port parameter is used to set the I/O port and does not make any
sense to use for USB serial devices.

The xmit_fifo_size parameter could be used to set the hardware transmit
fifo size of a legacy UART when it could not be detected, but the
interface is limited to eight bits and should be left unset when not
used.

Similarly, baud_base could be used to set the UART base clock when it
could not be detected but might as well be left unset when it is not
known.

The close_delay and closing_wait parameters returned by TIOCGSERIAL are
specified in centiseconds (not jiffies). The driver does not yet support
changing close_delay, but let's report back the default value actually
used (0.5 seconds).

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


# 0765590f 17-Jan-2021 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: fix a debug-message copy-paste error

Fix a copy-paste error in the ti_vread_sync() debug message.

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


# 66db9478 17-Jan-2021 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: drop short control-transfer check

There's no need to check for short control transfers when sending data
so remove the redundant sanity check.

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


# 2a5357e5 11-Sep-2018 Al Viro <viro@zeniv.linux.org.uk>

io_ti: switch to ->get_serial()

Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>


# 6778b0cb 23-Jun-2018 John Ogness <john.ogness@linutronix.de>

USB: serial: io_ti: use irqsave() in USB's complete callback

The USB completion callback does not disable interrupts while acquiring
the lock. We want to remove the local_irq_disable() invocation from
__usb_hcd_giveback_urb() and therefore it is required for the callback
handler to disable the interrupts while acquiring the lock.
The callback may be invoked either in IRQ or BH context depending on the
USB host controller.
Use the _irqsave() variant of the locking primitives.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
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>


# 6aeb75e6 11-May-2017 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: fix div-by-zero in set_termios

Fix a division-by-zero in set_termios when debugging is enabled and a
high-enough speed has been requested so that the divisor value becomes
zero.

Instead of just fixing the offending debug statement, cap the baud rate
at the base as a zero divisor value also appears to crash the firmware.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org> # 2.6.12
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>


# bc242fc1 27-Mar-2017 Johan Hovold <johan@kernel.org>

USB: serial: drop termios-flag debugging

Drop some unnecessary termios-flag debugging that have been faithfully
reproduced in a few old drivers, including the "clfag" typo and all.

This also addresses a compiler warning on sparc where tcflag_t is
unsigned long and would have required an explicit cast.

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>


# 772b2c5d 16-Mar-2017 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: drop redundant read-urb check

Drop the redundant read-urb check from open. The presence of a bulk-in
endpoint is now verified during probe and core has allocated the
corresponding resources.

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


# 9c8299b4 16-Mar-2017 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: verify interrupt endpoint at probe

Verify that the required interrupt endpoint is present at probe rather
than at open to avoid allocating resources for an unusable device.

Note that the endpoint is only required when in download mode.

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


# 8d9c4d9e 16-Mar-2017 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: always require a bulk-out endpoint

These devices always require at least one bulk-out endpoint so let core
verify that.

This avoids attempting to send bulk data to the default pipe when
downloading firmware in boot mode.

Note that further endpoints are still needed when not in boot mode.

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


# 49f4ff2d 16-Mar-2017 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: use calc_num_endpoints to verify endpoints

Use the calc_num_ports rather than attach callback to verify that the
required endpoints are present when in download mode.

This avoids allocating port resources for interfaces that won't be bound.

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


# 654b404f 06-Mar-2017 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: fix information leak in completion handler

Add missing sanity check to the bulk-in completion handler to avoid an
integer underflow that can be triggered by a malicious device.

This avoids leaking 128 kB of memory content from after the URB transfer
buffer to user space.

Fixes: 8c209e6782ca ("USB: make actual_length in struct urb field u32")
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org> # 2.6.30
Signed-off-by: Johan Hovold <johan@kernel.org>


# 0b1d250a 06-Mar-2017 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: fix NULL-deref in interrupt callback

Fix a NULL-pointer dereference in the interrupt callback should a
malicious device send data containing a bad port number by adding the
missing sanity check.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>


# 51211a3d 25-Jan-2017 Johan Hovold <johan@kernel.org>

USB: serial: drop unused ASYNC flags

Do not report ASYNC_SKIP_TEST or ASYNC_AUTO_IRQ as being set in
TIOCGSERIAL handlers as these flags are not supported and do not really
make any sense for USB serial devices in the first place.

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


# e35d6d7c 03-Jan-2017 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: bind to interface after fw download

Bind to the interface, but do not register any ports, after having
downloaded the firmware. The device will still disconnect and
re-enumerate, but this way we avoid an error messages from being logged
as part of the process:

io_ti: probe of 1-1.3:1.0 failed with error -5

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


# 2330d0a8 03-Jan-2017 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: fix I/O after disconnect

Cancel the heartbeat work on driver unbind in order to avoid I/O after
disconnect in case the port is held open.

Note that the cancel in release() is still needed to stop the heartbeat
after late probe errors.

Fixes: 26c78daade0f ("USB: io_ti: Add heartbeat to keep idle EP/416
ports from disconnecting")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>


# 4f9785cc 03-Jan-2017 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: fix another NULL-deref at open

In case a device is left in "boot-mode" we must not register any port
devices in order to avoid a NULL-pointer dereference on open due to
missing endpoints. This could be used by a malicious device to trigger
an OOPS:

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
[<bf0caa84>] (edge_open [io_ti]) from [<bf0b0118>] (serial_port_activate+0x68/0x98 [usbserial])
[<bf0b0118>] (serial_port_activate [usbserial]) from [<c0470ca4>] (tty_port_open+0x9c/0xe8)
[<c0470ca4>] (tty_port_open) from [<bf0b0da0>] (serial_open+0x48/0x6c [usbserial])
[<bf0b0da0>] (serial_open [usbserial]) from [<c0469178>] (tty_open+0xcc/0x5cc)

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>


# a323fefc 03-Jan-2017 Johan Hovold <johan@kernel.org>

USB: serial: io_ti: fix NULL-deref at open

Fix NULL-pointer dereference when clearing halt at open should a
malicious device lack the expected endpoints when in download mode.

Unable to handle kernel NULL pointer dereference at virtual address 00000030
...
[<bf011ed8>] (edge_open [io_ti]) from [<bf000118>] (serial_port_activate+0x68/0x98 [usbserial])
[<bf000118>] (serial_port_activate [usbserial]) from [<c0470ca4>] (tty_port_open+0x9c/0xe8)
[<c0470ca4>] (tty_port_open) from [<bf000da0>] (serial_open+0x48/0x6c [usbserial])
[<bf000da0>] (serial_open [usbserial]) from [<c0469178>] (tty_open+0xcc/0x5cc)

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>


# 2fbd69c4 08-Nov-2016 Johan Hovold <johan@kernel.org>

USB: serial: fix invalid user-pointer checks

Drop invalid user-pointer checks from ioctl handlers.

A NULL-pointer can be valid in user space and copy_to_user() takes care
of sanity checking.

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


# 8d23766b 16-Sep-2015 Peter E. Berger <pberger@brimson.com>

USB: io_ti: Remove extra blank lines separating functions

Remove extra blank lines in the several places where functions were
separated by more than one.

Signed-off-by: Peter E. Berger <pberger@brimson.com>
Signed-off-by: Johan Hovold <johan@kernel.org>


# 75899513 16-Sep-2015 Peter E. Berger <pberger@brimson.com>

USB: io_ti: Fix non-standard comment formatting

Fix non-standard formatting in some of the comments.

Signed-off-by: Peter E. Berger <pberger@brimson.com>
[johan: minor fixes ]
Signed-off-by: Johan Hovold <johan@kernel.org>


# b4146162 16-Sep-2015 Peter E. Berger <pberger@brimson.com>

USB: io_ti: Move request_firmware from edge_startup to download_fw

Move request_firmware from edge_startup to download_fw.

Signed-off-by: Peter E. Berger <pberger@brimson.com>
Signed-off-by: Johan Hovold <johan@kernel.org>


# bebf1f18 16-Sep-2015 Peter E. Berger <pberger@brimson.com>

USB: io_ti: Move download and boot mode code out of download_fw

Separate the download and boot mode code from download_fw() into two new
helper functions: do_download_mode() and do_boot_mode().

Signed-off-by: Peter E. Berger <pberger@brimson.com>
Signed-off-by: Johan Hovold <johan@kernel.org>


# ef9324b2 16-Sep-2015 Peter E. Berger <pberger@brimson.com>

USB: io_ti: Use serial->interface for messages in download_fw

Use serial->interface instead of serial->dev for messages in download_fw().

Signed-off-by: Peter E. Berger <pberger@brimson.com>
Signed-off-by: Johan Hovold <johan@kernel.org>


# 277bf37b 16-Sep-2015 Peter E. Berger <pberger@brimson.com>

USB: io_ti: Remove obsolete dev parameter from build_i2c_fw_hdr

Remove unused "dev" parameter from build_i2c_fw_hdr() and its caller.

Signed-off-by: Peter E. Berger <pberger@brimson.com>
Signed-off-by: Johan Hovold <johan@kernel.org>


# 26c78daa 31-Jul-2015 Peter E. Berger <pberger@brimson.com>

USB: io_ti: Add heartbeat to keep idle EP/416 ports from disconnecting

When using Edgeport/416 models with newer firmware (sometime after
firmware version 4.80.0), idle ports are automatically bounced
(disconnected and then reconnected) approximately every 60 seconds.
This breaks programs (e.g: minicom) where idle periods are common,
normal and expected.

I confirmed with the manufacturer (Digi International) that Edgeport/416
models now ship from the factory with firmware that expects periodic
"heartbeat" queries from the driver to keep idle ports alive. This
patch implements heartbeat support using the mechanism Digi suggested
(periodically requesting an I2C descriptor address) that appears effective
on Edgeports running the newer firmware (that require it) and benign on
Edgeport devices running older firmware. Since we know that Edgeport
firmware version 4.80 (the version distributed in /lib/firmware/down3.bin
and used for Edgeports that are either running still older versions or
have no onboard non-volatile firmware image) does not require heartbeat
support, this patch schedules heartbeats only on Edgeport/416 devices,
and only if they are running firmware versions newer than 4.80.

Signed-off-by: Peter E. Berger <pberger@brimson.com>
[johan: minor style changes ]
Signed-off-by: Johan Hovold <johan@kernel.org>


# dcb8e99d 31-Jul-2015 Peter E. Berger <pberger@brimson.com>

USB: io_ti: Add firmware image sanity checks

Do what we can to verify that the driver's firmware image is valid
(before attempting to download it to the Edgeport) by adding a new
function, check_fw_sanity(), and a call to it in in download_fw().

Note: It looks like some Edgeports (models like the EP/416 with on-board
E2PROM) may be able to function even if the on-disk firmware image is
bad or missing, iff their local E2PROM versions are valid. But most
Edgeport models (I've tried EP/1 and EP/8) do not appear to have this
capability and they always rely on the on-disk firmware image.

I tested an implementation that calls the new check_fw_sanity()
function at the top of download_fw() and, rather than simply returning
an error if the firmware image is bad or missing, it saves the result
and defers the decision until later when it may find that it is running
on a E2PROM-equipped device with a valid image. But I think this is
messier than it is worth (adding still more messiness to the already
very messy download_fw()) for such a marginal possible benefit. So, at
least for now, I have chosen the much simpler approach of returning an
error whenever edge_startup() fails to load an on-disk firmware image, or
check_fw_sanity() indicates that it is unusable.

Signed-off-by: Peter E. Berger <pberger@brimson.com>
[johan: drop redundant checksum mask ]
Signed-off-by: Johan Hovold <johan@kernel.org>


# c0e34831 31-Jul-2015 Peter E. Berger <pberger@brimson.com>

USB: io_ti: Fix firmware version handling

The io_ti driver fails to download firmware to Edgeport
devices such as the EP/416, even when the on-disk firmware image
(/lib/firmware/edgeport/down3.bin) is more current than the version
on the EP/416. The current download code is broken in a few ways.
Notably it mis-uses global variables OperationalMajorVersion and
OperationalMinorVersion (reading their values before they've been
properly initialized and subsequently initializing them multiple times
without synchronization). This patch drops the global variables and
replaces the redundant calls to request_firmware()/release_firmware()
in download_fw() with a single call pair in edge_startup(); the firmware
image pointer is then passed to download_fw() and build_i2c_fw_hdr().

Signed-off-by: Peter E. Berger <pberger@brimson.com>
Signed-off-by: Johan Hovold <johan@kernel.org>


# c3ece7e7 31-Jul-2015 Peter E. Berger <pberger@brimson.com>

USB: io_ti: Increase insufficient timeout for firmware downloads

The io_ti driver fails to download firmware to Edgeport devices such as
the EP/416 and EP/421 (devices with on-board E2PROM). One of the problems
is that the default 1 second timeout in ti_vsend_sync() is insufficient
for download operations. This patch increases the download timeout to
10 seconds.

Signed-off-by: Peter E. Berger <pberger@brimson.com>
Signed-off-by: Johan Hovold <johan@kernel.org>


# d95e3cae 10-Sep-2014 Peter Hurley <peter@hurleysoftware.com>

usb: serial: Remove unused tty->hw_stopped

The tty core does not test tty->hw_stopped; remove from drivers
which don't test it themselves.

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


# c03890ff 26-Apr-2014 Johan Hovold <johan@kernel.org>

USB: io_ti: fix firmware download on big-endian machines (part 2)

A recent patch that purported to fix firmware download on big-endian
machines failed to add the corresponding sparse annotation to the
i2c-header. This was reported by the kbuild test robot.

Adding the appropriate annotation revealed another endianess bug related
to the i2c-header Size-field in a code path that is exercised when the
firmware is actually being downloaded (and not just verified and left
untouched unless older than the firmware at hand).

This patch adds the required sparse annotation to the i2c-header and
makes sure that the Size-field is sent in little-endian byte order
during firmware download also on big-endian machines.

Note that this patch is only compile-tested, but that there is no
functional change for little-endian systems.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Ludovic Drolez <ldrolez@debian.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5509076d 25-Apr-2014 Johan Hovold <johan@kernel.org>

USB: io_ti: fix firmware download on big-endian machines

During firmware download the device expects memory addresses in
big-endian byte order. As the wIndex parameter which hold the address is
sent in little-endian byte order regardless of host byte order, we need
to use swab16 rather than cpu_to_be16.

Also make sure to handle the struct ti_i2c_desc size parameter which is
returned in little-endian byte order.

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


# 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>


# 10c642d0 29-Dec-2013 Johan Hovold <johan@kernel.org>

USB: serial: remove redundant OOM messages

Remove redundant error messages on allocation failures, which have
already been logged.

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


# 4d5147ec 29-Dec-2013 Johan Hovold <johan@kernel.org>

USB: serial: clean up ioctl debugging

Remove redundant ioctl debugging from subdrivers. The ioctl request code
has already been logged by usb-serial core.

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


# 154547c4 23-Aug-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: clean up attribute permissions

Clean up the DEVICE_ATTR usage in the USB serial drivers, making them
more obvious as to the permissions that the sysfs files should be.

Note: ftdi_sio.c still has a DEVICE_ATTR() used, that will have to wait
until after 3.12-rc1 comes out when DEVICE_ATTR_WO() shows up in Linus's
tree.

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


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

USB: io_ti: move port initialisation to probe

Move port initialisation code from open to probe where it belongs.

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


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

USB: io_ti: kill private fifo

Kill private write fifo and use the already allocated port write fifo
instead.

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>


# e5b1e206 07-Jun-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: make minor allocation dynamic

This moves the allocation of minor device numbers from a static array to
be dynamic, using the idr interface. This means that you could
potentially get "gaps" in a minor number range for a single USB serial
device with multiple ports, but all should still work properly.

We remove the 'minor' field from the usb_serial structure, as it no
longer makes any sense for it (use the field in the usb_serial_port
structure if you really want to know this number), and take the fact
that we were overloading a number in this field to determine if we had
initialized the minor numbers or not, and just use a flag variable
instead.

Note, we still have the limitation of 255 USB to serial devices in the
system, as that is all we are registering with the TTY layer at this
point in time.

Tested-by: Tobias Winter <tobias@linuxdingsda.de>
Reviewed-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(-)


# b16634ad 05-May-2013 Johan Hovold <johan@kernel.org>

USB: io_ti: fix chars_in_buffer overhead

Use the new generic usb-serial wait_until_sent implementation to wait
for hardware buffers to drain.

This removes the need to check the hardware buffers in chars_in_buffer
and thus removes the overhead introduced by commit 263e1f9f ("USB:
io_ti: query hardware-buffer status in chars_in_buffer") without
breaking tty_wait_until_sent (used by, for example, tcdrain, tcsendbreak
and close).

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


# a8ec374f 18-Apr-2013 Johan Hovold <johan@kernel.org>

USB: io_ti: remove redundant wait_until_sent

Remove redundant wait_until_sent, which has already been handled by the
tty-layer, from break_ctl.

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


# b6fd35ee 18-Apr-2013 Johan Hovold <johan@kernel.org>

USB: io_ti: fix TIOCGSERIAL

Fix regression introduced by commit f40d78155 ("USB: io_ti: kill custom
closing_wait implementation") which made TIOCGSERIAL return the wrong
value for closing_wait.

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


# ae3759c2 04-Apr-2013 Jiri Slaby <jirislaby@kernel.org>

USB: io_ti, stop dereferencing potential NULL

tty_port_tty_get might return a tty which is NULL. But it is
dereferenced unconditionally in edge_send. Stop dereferencing that by
sending usb_serial_port pointer around.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


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

USB: io_ti: always disable uart on close

Always try to disable the uart on close.

Since the switch to tty ports, close will be called as part of shutdown
before disconnect returns. Hence there is no need to check the
disconnected flag, and we can put devices in disabled states also on
driver unbind.

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


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

USB: io_ti: 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.

This also fixes the issue with processes waiting for
modem-status-changes not being woken up at disconnect.

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


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

USB: io_ti: switch to generic get_icount implementation

Switch to the generic get_icount implementation.

Note that the interrupt counters will no longer be reset at open which
is in accordance with which how the other drivers work.

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


# 7b245969 19-Mar-2013 Johan Hovold <johan@kernel.org>

USB: io_ti: 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.

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


# 5492bf3d 19-Mar-2013 Johan Hovold <johan@kernel.org>

USB: io_ti: fix get_icount for two port adapters

Add missing get_icount field to two-port driver.

The two-port driver was not updated when switching to the new icount
interface in commit 0bca1b913aff ("tty: Convert the USB drivers to the
new icount interface").

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


# f40d7815 14-Jan-2013 Johan Hovold <johan@kernel.org>

USB: io_ti: kill custom closing_wait implementation

Kill custom closing_wait implementation and let the tty layer handle it
instead.

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


# 263e1f9f 14-Jan-2013 Johan Hovold <johan@kernel.org>

USB: io_ti: query hardware-buffer status in chars_in_buffer

Query hardware-buffer status in chars_in_buffer should the write fifo be
empty.

This is needed to make the tty layer wait for hardware buffers to drain
on close.

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


# fcdb6a21 14-Jan-2013 Johan Hovold <johan@kernel.org>

USB: io_ti: use tty-port drain delay

Use tty-port drain delay rather than custom implementation in
chase_port.

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


# 77de2518 14-Jan-2013 Johan Hovold <johan@kernel.org>

USB: io_ti: move write-fifo flushing to close

Move write-fifo flushing from chase_port to close where it belongs.

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


# 1ee0a224 16-Jan-2013 Wolfgang Frisch <wfpub@roembden.net>

USB: io_ti: Fix NULL dereference in chase_port()

The tty is NULL when the port is hanging up.
chase_port() needs to check for this.

This patch is intended for stable series.
The behavior was observed and tested in Linux 3.2 and 3.7.1.

Johan Hovold submitted a more elaborate patch for the mainline kernel.

[ 56.277883] usb 1-1: edge_bulk_in_callback - nonzero read bulk status received: -84
[ 56.278811] usb 1-1: USB disconnect, device number 3
[ 56.278856] usb 1-1: edge_bulk_in_callback - stopping read!
[ 56.279562] BUG: unable to handle kernel NULL pointer dereference at 00000000000001c8
[ 56.280536] IP: [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35
[ 56.281212] PGD 1dc1b067 PUD 1e0f7067 PMD 0
[ 56.282085] Oops: 0002 [#1] SMP
[ 56.282744] Modules linked in:
[ 56.283512] CPU 1
[ 56.283512] Pid: 25, comm: khubd Not tainted 3.7.1 #1 innotek GmbH VirtualBox/VirtualBox
[ 56.283512] RIP: 0010:[<ffffffff8144e62a>] [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35
[ 56.283512] RSP: 0018:ffff88001fa99ab0 EFLAGS: 00010046
[ 56.283512] RAX: 0000000000000046 RBX: 00000000000001c8 RCX: 0000000000640064
[ 56.283512] RDX: 0000000000010000 RSI: ffff88001fa99b20 RDI: 00000000000001c8
[ 56.283512] RBP: ffff88001fa99b20 R08: 0000000000000000 R09: 0000000000000000
[ 56.283512] R10: 0000000000000000 R11: ffffffff812fcb4c R12: ffff88001ddf53c0
[ 56.283512] R13: 0000000000000000 R14: 00000000000001c8 R15: ffff88001e19b9f4
[ 56.283512] FS: 0000000000000000(0000) GS:ffff88001fd00000(0000) knlGS:0000000000000000
[ 56.283512] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 56.283512] CR2: 00000000000001c8 CR3: 000000001dc51000 CR4: 00000000000006e0
[ 56.283512] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 56.283512] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[ 56.283512] Process khubd (pid: 25, threadinfo ffff88001fa98000, task ffff88001fa94f80)
[ 56.283512] Stack:
[ 56.283512] 0000000000000046 00000000000001c8 ffffffff810578ec ffffffff812fcb4c
[ 56.283512] ffff88001e19b980 0000000000002710 ffffffff812ffe81 0000000000000001
[ 56.283512] ffff88001fa94f80 0000000000000202 ffffffff00000001 0000000000000296
[ 56.283512] Call Trace:
[ 56.283512] [<ffffffff810578ec>] ? add_wait_queue+0x12/0x3c
[ 56.283512] [<ffffffff812fcb4c>] ? usb_serial_port_work+0x28/0x28
[ 56.283512] [<ffffffff812ffe81>] ? chase_port+0x84/0x2d6
[ 56.283512] [<ffffffff81063f27>] ? try_to_wake_up+0x199/0x199
[ 56.283512] [<ffffffff81263a5c>] ? tty_ldisc_hangup+0x222/0x298
[ 56.283512] [<ffffffff81300171>] ? edge_close+0x64/0x129
[ 56.283512] [<ffffffff810612f7>] ? __wake_up+0x35/0x46
[ 56.283512] [<ffffffff8106135b>] ? should_resched+0x5/0x23
[ 56.283512] [<ffffffff81264916>] ? tty_port_shutdown+0x39/0x44
[ 56.283512] [<ffffffff812fcb4c>] ? usb_serial_port_work+0x28/0x28
[ 56.283512] [<ffffffff8125d38c>] ? __tty_hangup+0x307/0x351
[ 56.283512] [<ffffffff812e6ddc>] ? usb_hcd_flush_endpoint+0xde/0xed
[ 56.283512] [<ffffffff8144e625>] ? _raw_spin_lock_irqsave+0x14/0x35
[ 56.283512] [<ffffffff812fd361>] ? usb_serial_disconnect+0x57/0xc2
[ 56.283512] [<ffffffff812ea99b>] ? usb_unbind_interface+0x5c/0x131
[ 56.283512] [<ffffffff8128d738>] ? __device_release_driver+0x7f/0xd5
[ 56.283512] [<ffffffff8128d9cd>] ? device_release_driver+0x1a/0x25
[ 56.283512] [<ffffffff8128d393>] ? bus_remove_device+0xd2/0xe7
[ 56.283512] [<ffffffff8128b7a3>] ? device_del+0x119/0x167
[ 56.283512] [<ffffffff812e8d9d>] ? usb_disable_device+0x6a/0x180
[ 56.283512] [<ffffffff812e2ae0>] ? usb_disconnect+0x81/0xe6
[ 56.283512] [<ffffffff812e4435>] ? hub_thread+0x577/0xe82
[ 56.283512] [<ffffffff8144daa7>] ? __schedule+0x490/0x4be
[ 56.283512] [<ffffffff8105798f>] ? abort_exclusive_wait+0x79/0x79
[ 56.283512] [<ffffffff812e3ebe>] ? usb_remote_wakeup+0x2f/0x2f
[ 56.283512] [<ffffffff812e3ebe>] ? usb_remote_wakeup+0x2f/0x2f
[ 56.283512] [<ffffffff810570b4>] ? kthread+0x81/0x89
[ 56.283512] [<ffffffff81057033>] ? __kthread_parkme+0x5c/0x5c
[ 56.283512] [<ffffffff8145387c>] ? ret_from_fork+0x7c/0xb0
[ 56.283512] [<ffffffff81057033>] ? __kthread_parkme+0x5c/0x5c
[ 56.283512] Code: 8b 7c 24 08 e8 17 0b c3 ff 48 8b 04 24 48 83 c4 10 c3 53 48 89 fb 41 50 e8 e0 0a c3 ff 48 89 04 24 e8 e7 0a c3 ff ba 00 00 01 00
<f0> 0f c1 13 48 8b 04 24 89 d1 c1 ea 10 66 39 d1 74 07 f3 90 66
[ 56.283512] RIP [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35
[ 56.283512] RSP <ffff88001fa99ab0>
[ 56.283512] CR2: 00000000000001c8
[ 56.283512] ---[ end trace 49714df27e1679ce ]---

Signed-off-by: Wolfgang Frisch <wfpub@roembden.net>
Cc: Johan Hovold <jhovold@gmail.com>
Cc: stable <stable@vger.kernel.org>
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>


# 05c7cd39 03-Jan-2013 Jiri Slaby <jirislaby@kernel.org>

TTY: switch tty_insert_flip_string

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.

tty_insert_flip_string this time.

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>


# 5d8c61bc 18-Oct-2012 Johan Hovold <johan@kernel.org>

USB: io_ti: fix sysfs-attribute creation

Make sure port data is initialised before creating sysfs attributes to
avoid a race.

A recent patch ("USB: io_ti: fix port-data memory leak") got the
sysfs-attribute creation and port-data initialisation ordering wrong.

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


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

USB: io_ti: fix port-data memory leak

Fix port-data memory leak by moving port data allocation and
deallocation to 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>


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

USB: serial: io_ti: remove some remaining printk() calls

Use dev_err() like the rest of that function does, and the rest of the
driver does, to properly show what device and driver caused the problem.

Cc: Johan Hovold <jhovold@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


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

USB: Serial: io_ti.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: Johan Hovold <jhovold@gmail.com>
CC: "Eric W. Biederman" <ebiederm@xmission.com>
CC: Rusty Russell <rusty@rustcorp.com.au>
CC: Alan Stern <stern@rowland.harvard.edu>
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>


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

USB: serial: io_ti.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: Johan Hovold <jhovold@gmail.com>
CC: "Eric W. Biederman" <ebiederm@xmission.com>
CC: Rusty Russell <rusty@rustcorp.com.au>
CC: Alan Stern <stern@rowland.harvard.edu>
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>


# af581059 26-Mar-2012 Johan Hovold <johan@kernel.org>

USB: io_ti: fix abuse of interface data

Fix abuse of interface data which was used to signal device disconnect.

Use the usb_serial disconnect flag and mutex where appropriate.

Note that there's no need to grab the mutex in chase_port as it does not
access the device.

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


# 8485f8c9 28-Feb-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: serial: io_ti.c: use module_usb_serial_driver

This converts the io_ti.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: Johan Hovold <jhovold@gmail.com>
CC: Lucas De Marchi <lucas.demarchi@profusion.mobi>
CC: "Eric W. Biederman" <ebiederm@xmission.com>
CC: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7dbe2460 23-Feb-2012 Alan Stern <stern@rowland.harvard.edu>

usb-serial: use new registration API in [i-j]* drivers

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

io_edgeport, io_ti, ipaq, ipw, ir-usb, and iuu_phoenix.

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>


# 6d443d84 13-Jan-2012 Eric W. Biederman <ebiederm@xmission.com>

usb: io_ti: Make edge_remove_sysfs_attrs the port_remove method.

Calling edge_remove_sysfs_attrs from edge_disconnect is too late
as the device has already been removed from sysfs.

Do the simple and obvious thing and make edge_remove_sysfs_attrs
the port_remove method.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Reported-by: Wolfgang Frisch <wfpub@roembden.net>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 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>


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

USB: serial: remove unnecessary bulk-urb re-fills

Remove unnecessary re-fills of bulk urbs whose fields have not changed
since port probe.

Compile-only tested.

Cc: Matthias Bruestle and Harald Welte <support@reiner-sct.com>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


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

USB: serial: remove unnecessary reinitialisations of urb fields

Remove unnecessary reinitialisations of completion and context fields of
urbs.

Compile-only tested.

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


# 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>


# 0bca1b91 16-Sep-2010 Alan Cox <alan@linux.intel.com>

tty: Convert the USB drivers to the new icount interface

Simple pasting job using the new ops function. Also fix a couple of devices
directly returning the internal struct (which happens at this point to match
for the fields that matter but isn't correct or futureproof)

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


# fd6e5bbb 10-Aug-2010 Roel Kluin <roel.kluin@gmail.com>

USB: serial: io_ti.c: don't return 0 if writing the download record failed

If the write download record failed we shouldn't return 0.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 0827a9ff 17-Aug-2010 Greg Kroah-Hartman <gregkh@suse.de>

USB: io_ti: check firmware version before updating

If we can't read the firmware for a device from the disk, and yet the
device already has a valid firmware image in it, we don't want to
replace the firmware with something invalid. So check the version
number to be less than the current one to verify this is the correct
thing to do.


Reported-by: Chris Beauchamp <chris@chillibean.tv>
Tested-by: Chris Beauchamp <chris@chillibean.tv>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 9800eb33 20-Jul-2010 Roel Kluin <roel.kluin@gmail.com>

USB: io_ti.c: don't return 0 if writing the download record failed

If the write download record failed we shouldn't return 0.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 1e29709e 01-Jul-2010 Roel Kluin <roel.kluin@gmail.com>

USB: serial: io_ti: Don't return 0 if writing the download record failed

If the write download record failed we shouldn't return 0.

Signed-off-by: Roel Kluin <roel.kluin@gmail.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>


# d733cec1 18-May-2010 Johan Hovold <johan@kernel.org>

USB: io_ti: use kfifo to implement write buffering

Kill custom fifo implementation.

Compile-only tested.

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


# a3a30f10 18-May-2010 Johan Hovold <johan@kernel.org>

USB: io_ti: remove unsused private counter

Signed-off-by: Johan Hovold <jhovold@gmail.com>
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>


# 759f3634 05-Feb-2010 Joe Perches <joe@perches.com>

USB: serial: Remove unnecessary \n's from dbg uses

#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>


# 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>


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

USB: io_ti: fix DMA buffers on stack

Signed-off-by: Johan Hovold <jhovold@gmail.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>


# 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>


# 19af5cdb 23-Apr-2009 Martin Olsson <martin@minimum.se>

trivial: fix typo milisecond/millisecond for documentation and source comments.

Signed-off-by: Martin Olsson <martin@minimum.se>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 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>


# 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>


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

io_ti: Minor coding style

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>


# 2742fd88 29-Apr-2008 Alan Cox <alan@lxorguk.ukuu.org.uk>

USB: io_ti: FIrst cut at a big clean up

Sort out the insane naming like "OperationalFirmwareVersion" which seems
designed to cause formatting problems and RSI
Merge various common code together
Clean up the pointlessly complex and spread about MCR handling

This is really just the low hanging fruit.

Needs lots of testing before it goes upstream so testers and reports
appreciated

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


# d12b219a 04-Jul-2008 Jaswinder Singh <jaswinder@infradead.org>

edgeport-ti: use request_firmware()

Firmware blob looks like this...
uint8_t MajorVersion
uint8_t MinorVersion
__le16 BuildNumber
uint8_t data[]

Signed-off-by: Jaswinder Singh <jaswinder@infradead.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>


# 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>


# b56394bf 04-Mar-2008 Ray Lee <ray-lk@madrabbit.org>

USB: io_ti.c: remove unneeded null tty check

The Coverity checker (and Adrian Bunk) spotted an inconsistent NULL check of
port->tty (it's blindly dereferenced later without the check).

Alan Cox confirmed the check can go.

Signed-off-by: Ray Lee <ray-lk@madrabbit.org>
Cc: Adrian Bunk <bunk@kernel.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# dfa5ec79 04-Mar-2008 Julia Lawall <julia@diku.dk>

USB: use DIV_ROUND_UP

The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /
(d)) but is perhaps more readable.

An extract of the semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@haskernel@
@@

#include <linux/kernel.h>

@depends on haskernel@
expression n,d;
@@

(
- (n + d - 1) / d
+ DIV_ROUND_UP(n,d)
|
- (n + (d - 1)) / d
+ DIV_ROUND_UP(n,d)
)

@depends on haskernel@
expression n,d;
@@

- DIV_ROUND_UP((n),d)
+ DIV_ROUND_UP(n,d)

@depends on haskernel@
expression n,d;
@@

- DIV_ROUND_UP(n,(d))
+ DIV_ROUND_UP(n,d)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 3d71fe0b 20-Feb-2008 Alan Cox <alan@lxorguk.ukuu.org.uk>

USB: io_ti: lock mcr and msr shadows properly

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


# 9544e833 05-Feb-2008 Andrew Morton <akpm@linux-foundation.org>

USB: io_ti.c: remove pointless eye-candy in debug statements

These strings always come up as false positives whenever I'm doing
git-conflict fixups (ie: about 1000 times/day).

I don't think the zillion "<" and ">" characters are very useful and removing
them makes my life that little bit easier.

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


# d3135846 18-Apr-2008 Matthew Wilcox <willy@infradead.org>

drivers: Remove unnecessary inclusions of asm/semaphore.h

None of these files use any of the functionality promised by
asm/semaphore.h. It's possible that they rely on it dragging in some
unrelated header file, but I can't build all these files, so we'll have
fix any build failures as they come up.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>


# d5f5bcd4 03-Jan-2008 Alan Cox <alan@lxorguk.ukuu.org.uk>

USB: io_ti: clean up termios handling

Don't pass NULL into termios functions when calling them internally
Remove all the crap which then checks for NULL which can't occur now
Clear CMSPAR as it is not supported
Report the baud rate back to the caller properly (See FIXME someone with
the docs)

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


# 241ca64f 04-Dec-2007 Matthias Kaehlcke <matthias.kaehlcke@gmail.com>

USB: Edgeport USB Serial Converter: convert es_sem to mutex

Edgeport USB Serial Converter: convert semaphore es_sem to the
mutex API

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 0d46c007 16-Jul-2007 Jesper Juhl <jesper.juhl@gmail.com>

USB: Remove pointless conditional in drivers/usb/serial/io_ti.c::edge_shutdown()

Coverity scan found (CID: 1708) this in
drivers/usb/serial/io_ti.c::edge_shutdown() :

...
2797 for (i=0; i < serial->num_ports; ++i) {
2798 edge_port = usb_get_serial_port_data(serial->port[i]);
2799 edge_remove_sysfs_attrs(edge_port->port);
2800 if (edge_port) {
2801 edge_buf_free(edge_port->ep_out_buf);
2802 kfree(edge_port);
2803 }
2804 usb_set_serial_port_data(serial->port[i], NULL);
2805 }
...

It's complaining that we dereference 'edge_port' in line 2799 which
makes the test of that pointer against NULL in 2800 pointless, since if
edge_port was actually NULL we'd have crashed already before reaching
line 2800.
Reading the edge_open() function it seems to me that the pointer
returned by usb_get_serial_port_data(serial->port[i]) and stored in
'edge_port' can never actually be NULL here, so the test is entirely
superfluous (even if it could be NULL it would be pointless here,
ignoring the then possible crash in that case, since both
edge_buf_free() and kfree() can handle being passed NULL pointers.

This patch removes the pointless conditional (and also makes a few
tiny style corrections now that I was in the area anyway).


Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 6dc73102 09-Jul-2007 Alan Cox <alan@lxorguk.ukuu.org.uk>

USB: io_*: remove bogus termios no change checks

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>


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

USB: serial: io_ti: 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: Al Borchers <alborchers@steinerpoint.com>
Cc: Peter Berger <pberger@brimson.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# efdff608 05-Jun-2007 Oliver Neukum <oneukum@suse.de>

USB: io_ti: sleep with spinlock held detected by automatic tool

this fixes the sleep found with the automatic tool.

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


# fc4cbd75 22-May-2007 Martin K. Petersen <mkp@mkp.net>

USB: io_ti: Digi EdgePort update for new devices

This patch adds support for the most recent Digi EdgePort USB serial
devices.

Signed-off-by: Martin K. Petersen <mkp@mkp.net>
Signed-off-by: Mike Swift <mikes@digi.com>
Signed-off-by: Jeremy McBane <jmcbane@digi.com>
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>


# 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>


# 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)


# 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>


# 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>


# 3d48586c 20-Nov-2005 Adrian Bunk <bunk@stusta.de>

[PATCH] USB: small cleanups

This patch contains the following cleanups:
- make needlessly global functions static
- every file should #include the headers containing the prototypes for
it's global functions

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 75318d2d 21-Nov-2005 Greg Kroah-Hartman <gregkh@suse.de>

[PATCH] USB: remove .owner field from struct usb_driver

It is no longer needed, so let's remove it, saving a bit of memory.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.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>


# 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!