Commit graph

2470 commits

Author SHA1 Message Date
Johan Hovold f0e4cba253 USB: option: reduce interrupt-urb logging verbosity
Do not log normal interrupt-urb shutdowns as errors.

The option driver has always been logging any nonzero interrupt-urb
status as an error, including when the urb is killed during normal
operation.

Commit 9096f1fbba ("USB: usb_wwan: fix potential NULL-deref at
resume") moved the interrupt urb submission from port probe and release
to open and close, thus potentially increasing the number of these
false-positive error messages dramatically.

Reported-by: Ed Butler <ressy66@ausics.net>
Tested-by: Ed Butler <ressy66@ausics.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2014-08-18 11:05:37 +02:00
Patrick Riphagen 4bdcde358b USB: serial: ftdi_sio: Add support for new Xsens devices
This adds support for new Xsens devices, using Xsens' own Vendor ID.

Signed-off-by: Patrick Riphagen <patrick.riphagen@xsens.com>
Signed-off-by: Frans Klaver <frans.klaver@xsens.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-01 15:47:05 -07:00
Patrick Riphagen 9273b8a270 USB: serial: ftdi_sio: Annotate the current Xsens PID assignments
The converters are used in specific products. It can be useful to know
which they are exactly.

Signed-off-by: Patrick Riphagen <patrick.riphagen@xsens.com>
Signed-off-by: Frans Klaver <frans.klaver@xsens.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-01 15:47:05 -07:00
Preston Fick 934ef5aca9 USB: serial: cp210x: Removing unncessary usb_reset_device on startup
This `usb_reset_device` command has been around since the driver was
originally reverse engineered. It doesn't cause much issue on single
interface CP210x devices, but on the CP2105 and CP2108 with 2 and 4
interfaces respectively it will cause instability on enumeration and
delays enumeration noticably. There should be no reason to reset a device
at startup, per the CP210x AN571 spec.

Signed-off-by: Preston Fick <preston.fick@silabs.com>
Cc: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-17 17:12:13 -07:00
Greg Kroah-Hartman 46865bf3d6 USB-serial updates for v3.17-rc1
Here are some minor fixes and clean-ups to the ftdi_sio, mos7840 and kl5kusb105
 drivers for v3.17-rc1.
 
 Signed-off-by: Johan Hovold <johan@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJTxoJGAAoJEEEN5E/e4bSVhbEP/0EuyDICPe/Xcj/mCaBwzkSX
 EIupMPwDdDu+w7/hM8afc22Ijc1nBK09AOHWbfAgQ9Yxj8HRVCazaylsjNoSW3Wu
 6QDplfKZBD2X3Y0yg/h6Nk0zFiTOyTkMd7FSWDiOrdjeG4RIU6AgWgncwVYCpPto
 0Bb2aHyBUAglXlV2MwnW/tHMvDWC6vPcl+lWQQ2J+zSJcP110LAfu0dqAnh+UuEr
 5B6NYORdpz1inXZewIo5vnxJsQxxKMq5T3dUEZkhBaDGYstKReWAHZAb8lhWvLdr
 XMA+jhjVmVIVBFeUZYNYJ1xbAGeOqPquhz860jKQizF/fl3uFbPVDFYyrZEHxNoY
 KZNXBfuXkv/Dutdk/FaFMq7w8o9q/xWfeupZFLpSSThw3AwR42BvYHyTx8zBLUlf
 X2CmtokSDmp233QBAs40S1ZUO1cU7nL7/0C1GF+FR8s3rOjASR2oNGU6KRU7CKCP
 AKfKpn3Fo30hvxOICZUuitWbiIYgKQzEHXrKMR8G2awf/AoQgXaoQ1N48lL+57ya
 u8vkQLvbcZ2t75qzqEnwPza5BoRGugDD53cTrge06FgsGc0BoujZAP+/PzyvirZV
 yuZfbbP5EE8KywryQz7ol9ppGWrmT/TPPU51Eqye2tvePe+O6wAAZ1yU2Nvrg1dS
 qwc4S3BKDtoDNqAAx6Yu
 =tUqf
 -----END PGP SIGNATURE-----

Merge tag 'usb-serial-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-next

Johan writes:

USB-serial updates for v3.17-rc1

Here are some minor fixes and clean-ups to the ftdi_sio, mos7840 and kl5kusb105
drivers for v3.17-rc1.

Signed-off-by: Johan Hovold <johan@kernel.org>
2014-07-16 09:19:26 -07:00
Greg Kroah-Hartman 85bf20d18a Merge 3.16-rc5 into usb-next
We want those fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-13 15:54:09 -07:00
Michal Sojka d8279a40e5 USB: serial: ftdi_sio: Add Infineon Triboard
This adds support for Infineon TriBoard TC1798 [1]. Only interface 1
is used as serial line (see [2], Figure 8-6).

[1] http://www.infineon.com/cms/de/product/microcontroller/development-tools-software-and-kits/tricore-tm-development-tools-software-and-kits/starterkits-and-evaluation-boards/starter-kit-tc1798/channel.html?channel=db3a304333b8a7ca0133cfa3d73e4268
[2] http://www.infineon.com/dgdl/TriBoardManual-TC1798-V10.pdf?folderId=db3a304412b407950112b409ae7c0343&fileId=db3a304333b8a7ca0133cfae99fe426a

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
Cc: Johan Hovold <johan@kernel.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-11 18:22:38 -07:00
Bert Vermeulen 5a7fbe7e9e USB: ftdi_sio: Add extra PID.
This patch adds PID 0x0003 to the VID 0x128d (Testo). At least the
Testo 435-4 uses this, likely other gear as well.

Signed-off-by: Bert Vermeulen <bert@biot.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 16:27:40 -07:00
Fabian Frederick 91c72df1fc drivers/usb/serial/mos7840.c: remove unnecessary null test before kfree
Cc: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 16:25:22 -07:00
Peter Senna Tschudin f4f8ae0568 USB: kl5kusb105: Remove klsi_105_tiocmset function
This patch remove the function klsi_105_tiocmset which was only
returning -EINVAL. It also removes the function prototype and
the .tiocmset entry in the struct usb_serial_driver.

Verified by compilation only.

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-09 15:44:06 -07:00
Peter Senna Tschudin 5bc9e5933a USB: kl5kusb105: Remove klsi_105_tiocmset function
This patch remove the function klsi_105_tiocmset which was only
returning -EINVAL. It also removes the function prototype and
the .tiocmset entry in the struct usb_serial_driver.

Verified by compilation only.

Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
2014-07-07 10:49:28 +02:00
Bernd Wachter 3d28bd840b usb: option: Add ID for Telewell TW-LTE 4G v2
Add ID of the Telewell 4G v2 hardware to option driver to get legacy
serial interface working

Signed-off-by: Bernd Wachter <bernd.wachter@jolla.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2014-07-07 10:31:14 +02:00
Andras Kovacs b9326057a3 USB: cp210x: add support for Corsair usb dongle
Corsair USB Dongles are shipped with Corsair AXi series PSUs.
These are cp210x serial usb devices, so make driver detect these.
I have a program, that can get information from these PSUs.

Tested with 2 different dongles shipped with Corsair AX860i and
AX1200i units.

Signed-off-by: Andras Kovacs <andras@sth.sze.hu>
Cc: <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2014-07-07 10:28:18 +02:00
Fabian Frederick cca16d6242 USB: mos7840: remove unnecessary null test before kfree
Cc: Johan Hovold <jhovold@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Johan Hovold <johan@kernel.org>
2014-07-07 10:19:29 +02:00
Johan Hovold 19de427812 USB: ftdi_sio: remove redundant mtxorb quirk
Remove redundant mtxorb quirk used to fix up incorrect wMaxPacketSize,
which was added before 895f28badc ("USB: ftdi_sio: fix hi-speed device
packet size calculation") which does the same thing for all devices.

Signed-off-by: Johan Hovold <johan@kernel.org>
2014-07-07 10:10:35 +02:00
Johan Hovold 47e575952b USB: ftdi_sio: clean up ftdi_set_max_packet_size()
Code and comment style clean ups of ftdi_set_max_packet_size().

Signed-off-by: Johan Hovold <johan@kernel.org>
2014-07-07 10:10:34 +02:00
Johan Hovold a90d84adb4 USB: ftdi_sio: fix max-packet-size warning
Promote max-packet-size-override message to warning level and use the
port device for logging, while using actual endpoint numbers in the
message itself.

Signed-off-by: Johan Hovold <johan@kernel.org>
2014-07-07 10:10:33 +02:00
Johan Hovold af6f9e8355 USB: ftdi_sio: make port probe less verbose
There's no need to print the number of endpoints per interface or
endpoint wMaxPacketSize during port probe. This information is readily
available using lsusb should it ever be needed.

Note that this also fixes the wMaxPacketSize being incorrectly reported
on big-endian systems due to a missing le16_to_cpu().

Signed-off-by: Johan Hovold <johan@kernel.org>
2014-07-07 10:10:32 +02:00
Bjørn Mork b0ebef36e9 usb: option: add/modify Olivetti Olicard modems
Adding a couple of Olivetti modems and blacklisting the net
function on a couple which are already supported.

Reported-by: Lars Melin <larsm17@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Johan Hovold <johan@kernel.org>
2014-06-23 12:27:42 +02:00
Johan Hovold aea1ae8760 USB: ftdi_sio: fix null deref at port probe
Fix NULL-pointer dereference when probing an interface with no
endpoints.

These devices have two bulk endpoints per interface, but this avoids
crashing the kernel if a user forces a non-FTDI device to be probed.

Note that the iterator variable was made unsigned in order to avoid
a maybe-uninitialized compiler warning for ep_desc after the loop.

Fixes: 895f28badc ("USB: ftdi_sio: fix hi-speed device packet size
calculation")

Reported-by: Mike Remski <mremski@mutualink.net>
Tested-by: Mike Remski <mremski@mutualink.net>
Cc: <stable@vger.kernel.org>	# 2.6.31
Signed-off-by: Johan Hovold <johan@kernel.org>
2014-06-23 12:27:41 +02:00
Oliver Neukum 1cab4c68e3 USB: option: add device ID for SpeedUp SU9800 usb 3g modem
Reported by Alif Mubarak Ahmad:

This device vendor and product id is 1c9e:9800
It is working as serial interface with generic usbserial driver.
I thought it is more suitable to use usbserial option driver, which has
better capability distinguishing between modem serial interface and
micro sd storage interface.

[ johan: style changes ]

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Tested-by: Alif Mubarak Ahmad <alive4ever@live.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2014-06-23 12:24:53 +02:00
Linus Torvalds 3f17ea6dea Merge branch 'next' (accumulated 3.16 merge window patches) into master
Now that 3.15 is released, this merges the 'next' branch into 'master',
bringing us to the normal situation where my 'master' branch is the
merge window.

* accumulated work in next: (6809 commits)
  ufs: sb mutex merge + mutex_destroy
  powerpc: update comments for generic idle conversion
  cris: update comments for generic idle conversion
  idle: remove cpu_idle() forward declarations
  nbd: zero from and len fields in NBD_CMD_DISCONNECT.
  mm: convert some level-less printks to pr_*
  MAINTAINERS: adi-buildroot-devel is moderated
  MAINTAINERS: add linux-api for review of API/ABI changes
  mm/kmemleak-test.c: use pr_fmt for logging
  fs/dlm/debug_fs.c: replace seq_printf by seq_puts
  fs/dlm/lockspace.c: convert simple_str to kstr
  fs/dlm/config.c: convert simple_str to kstr
  mm: mark remap_file_pages() syscall as deprecated
  mm: memcontrol: remove unnecessary memcg argument from soft limit functions
  mm: memcontrol: clean up memcg zoneinfo lookup
  mm/memblock.c: call kmemleak directly from memblock_(alloc|free)
  mm/mempool.c: update the kmemleak stack trace for mempool allocations
  lib/radix-tree.c: update the kmemleak stack trace for radix tree allocations
  mm: introduce kmemleak_update_trace()
  mm/kmemleak.c: use %u to print ->checksum
  ...
2014-06-08 11:31:16 -07:00
Linus Torvalds 776edb5931 Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next
Pull core locking updates from Ingo Molnar:
 "The main changes in this cycle were:

   - reduced/streamlined smp_mb__*() interface that allows more usecases
     and makes the existing ones less buggy, especially in rarer
     architectures

   - add rwsem implementation comments

   - bump up lockdep limits"

* 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (33 commits)
  rwsem: Add comments to explain the meaning of the rwsem's count field
  lockdep: Increase static allocations
  arch: Mass conversion of smp_mb__*()
  arch,doc: Convert smp_mb__*()
  arch,xtensa: Convert smp_mb__*()
  arch,x86: Convert smp_mb__*()
  arch,tile: Convert smp_mb__*()
  arch,sparc: Convert smp_mb__*()
  arch,sh: Convert smp_mb__*()
  arch,score: Convert smp_mb__*()
  arch,s390: Convert smp_mb__*()
  arch,powerpc: Convert smp_mb__*()
  arch,parisc: Convert smp_mb__*()
  arch,openrisc: Convert smp_mb__*()
  arch,mn10300: Convert smp_mb__*()
  arch,mips: Convert smp_mb__*()
  arch,metag: Convert smp_mb__*()
  arch,m68k: Convert smp_mb__*()
  arch,m32r: Convert smp_mb__*()
  arch,ia64: Convert smp_mb__*()
  ...
2014-06-03 12:57:53 -07:00
Aleksander Morgado 0ce5fb5856 usb: qcserial: add additional Sierra Wireless QMI devices
A set of new VID/PIDs retrieved from the out-of-tree GobiNet/GobiSerial
Sierra Wireless drivers.

Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Link: http://marc.info/?l=linux-usb&m=140136310027293&w=2
Cc: <stable@vger.kernel.org>	# backport in link above
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-29 11:20:26 -07:00
Aleksander Morgado ff1fcd50bc usb: qcserial: add Netgear AirCard 341U
Signed-off-by: Aleksander Morgado <aleksander@aleksander.es>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-28 14:56:36 -07:00
Rickard Strandqvist d5afce82e1 USB: keyspan: fix potential null pointer dereference
Move control-urb dereference to after NULL-check. There is otherwise a
risk of a possible null pointer dereference.

Was largely found by using a static code analysis program called
cppcheck.

[Johan: modify commit message somewhat ]
[gkh: remove stable tag as it's not a real problem that anyone has ever hit]

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:14:13 -07:00
Alexej Starschenko 8a61ba3a47 USB: serial: option: add support for Novatel E371 PCIe card
Adds product ID for the Novatel E371 PCI Express Mini Card.

$ lsusb
Bus 001 Device 024: ID 1410:9011 Novatel Wireless

$ usb-devices
T:  Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 24 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=1410 ProdID=9011 Rev=00.03
S:  Manufacturer=Novatel Wireless, Inc.
S:  Product=Novatel Wireless HSPA
S:  SerialNumber=012773002115811
C:  #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
I:  If#= 6 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether
I:  If#= 7 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether

Tested with kernel 3.2.0.

Signed-off-by: Alexej Starschenko <starschenko@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:12:57 -07:00
George McCollister d0839d757e USB: ftdi_sio: add NovaTech OrionLXm product ID
The NovaTech OrionLXm uses an onboard FTDI serial converter for JTAG and
console access.

Here is the lsusb output:
Bus 004 Device 123: ID 0403:7c90 Future Technology Devices
International, Ltd

Signed-off-by: George McCollister <george.mccollister@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:12:57 -07:00
Johan Hovold c03890ff5e 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>
2014-05-27 15:12:57 -07:00
Johan Hovold 90419cfcb5 USB: kobil_sct: fix control requests without data stage
Fix incorrect pipe directions and remove bogus data buffer arguments
from control requests without data stage.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:08 -07:00
Johan Hovold 3fff3b4343 USB: serial: remove overly defensive port tests
The only way a port pointer may be NULL is if probe() failed, and in
that case neither disconnect(), resume(), or reset_resume() will be
called.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:08 -07:00
Johan Hovold c14829fad8 USB: serial: fix potential runtime pm imbalance at device remove
Only call usb_autopm_put_interface() if the corresponding
usb_autopm_get_interface() was successful.

This prevents a potential runtime PM counter imbalance should
usb_autopm_get_interface() fail. Note that the USB PM usage counter is
reset when the interface is unbound, but that the runtime PM counter may
be left unbalanced.

Also add comment on why we don't need to worry about racing
resume/suspend on autopm_get failures.

Fixes: d5fd650cfc ("usb: serial: prevent suspend/resume from racing
against probe/remove")

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:08 -07:00
Johan Hovold b0a9aa6da8 USB: usb_wwan: do not resume I/O on closing ports
Use tty-port initialised flag rather than private flag to determine when
port is closing down.

Since the tty-port flag is set prior to dropping DTR/RTS (when HUPCL is
set) this avoid submitting the read urbs when resuming the interface in
dtr_rts() only to immediately kill them again in shutdown().

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:08 -07:00
Johan Hovold 8bb7ec65d6 USB: usb_wwan: report failed submissions as errors
Promote failed-submission messages in open() and write() to error log
level.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:08 -07:00
Johan Hovold 89da4a49b9 USB: usb_wwan: remove bogus function prototype
The usb_wwan_send_setup() function has never existed.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:08 -07:00
Johan Hovold 7d5dddda08 USB: usb_wwan: remove some superfluous comments
Remove some more outdated or superfluous comments.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:08 -07:00
Johan Hovold 9fdf7063ec USB: usb_wwan: remove comment from close
Remove superfluous and cryptic comment from close.

It should be obvious that we're balancing the autopm_put in open (and
that operation already mentions the autopm_get done in the USB serial
core).

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:08 -07:00
Johan Hovold 3362c91c78 USB: usb_wwan: clean up delayed-urb submission
Clean up and rename delay-urb submission function using a more
descriptive name.

Also add comment on locking assumptions.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:07 -07:00
Johan Hovold 37357ca5a4 USB: usb_wwan: use interface-data accessors
Use usb_get_serial_data() rather than accessing the private pointer
directly.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:07 -07:00
Johan Hovold b0f9d0030d USB: usb_wwan: make resume error messages uniform
Make resume error messages uniform.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:07 -07:00
Johan Hovold ae75c94018 USB: usb_wwan: kill interrupt urb explicitly at suspend
As the port interrupt URB is submitted by the subdriver at open, we
should also kill it explicitly at suspend (even though this will be
taken care of by USB serial core otherwise).

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:07 -07:00
Johan Hovold 2b4aceabb1 USB: usb_wwan: remove redundant urb kill from port remove
Remove redundant usb_kill_urb from port remove, which is called
post-shutdown (close).

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:07 -07:00
Johan Hovold a427c179de USB: usb_wwan: remove unimplemented set_termios
The driver does not implement set_termios so the operation can be left
unset (tty will do the tty_termios_copy_hw for us).

Note that the send_setup call is bogus as it really only sets DTR/RTS
to their current values.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:07 -07:00
Johan Hovold 02803542b7 USB: usb_wwan: remove redundant modem-control request
The tty-port implementation has already made sure that DTR/RTS have been
raised by calling dtr_rts so remove the redundant call from open.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:06 -07:00
Johan Hovold c1c0180340 USB: usb_wwan: fix remote wakeup
Make sure that needs_remote_wake up is always set when there are open
ports.

Currently close() would unconditionally set needs_remote_wakeup to 0
even though there might still be open ports. This could lead to blocked
input and possibly dropped data on devices that do not support remote
wakeup (and which must therefore not be runtime suspended while open).

Add an open_ports counter (protected by the susp_lock) and only clear
needs_remote_wakeup when the last port is closed.

Note that there are currently no multi-port drivers using the usb_wwan
implementation.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:06 -07:00
Johan Hovold 7436f41283 USB: usb_wwan: fix discarded writes on resume errors
There's no reason not to try sending off any further delayed write urbs,
should one urb-submission fail.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:06 -07:00
Johan Hovold fb7ad4f93d USB: usb_wwan: fix potential blocked I/O after resume
Keep trying to submit urbs rather than bail out on first read-urb
submission error, which would also prevent I/O for any further ports
from being resumed.

Instead keep an error count, for all types of failed submissions, and
let USB core know that something went wrong.

Also make sure to always clear the suspended flag. Currently a failed
read-urb submission would prevent cached writes as well as any
subsequent writes from being submitted until next suspend-resume cycle,
something which may not even necessarily happen.

Note that USB core currently only logs an error if an interface resume
failed.

Fixes: 383cedc3bb ("USB: serial: full autosuspend support for the
option driver")

Cc: <stable@vger.kernel.org>	# v2.6.32
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:06 -07:00
Johan Hovold 9096f1fbba USB: usb_wwan: fix potential NULL-deref at resume
The interrupt urb was submitted unconditionally at resume, something
which could lead to a NULL-pointer dereference in the urb completion
handler as resume may be called after the port and port data is gone.

Fix this by making sure the interrupt urb is only submitted and active
when the port is open.

Fixes: 383cedc3bb ("USB: serial: full autosuspend support for the
option driver")

Cc: <stable@vger.kernel.org>  # v2.6.32: 032129cb03
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:06 -07:00
Johan Hovold 79eed03e77 USB: usb_wwan: fix urb leak at shutdown
The delayed-write queue was never emptied at shutdown (close), something
which could lead to leaked urbs if the port is closed before being
runtime resumed due to a write.

When this happens the output buffer would not drain on close
(closing_wait timeout), and after consecutive opens, writes could be
corrupted with previously buffered data, transfered with reduced
throughput or completely blocked.

Note that unbusy_queued_urb() was simply moved out of CONFIG_PM.

Fixes: 383cedc3bb ("USB: serial: full autosuspend support for the
option driver")

Cc: <stable@vger.kernel.org>	# v2.6.32
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:06 -07:00
Johan Hovold 170fad9e22 USB: usb_wwan: fix write and suspend race
Fix race between write() and suspend() which could lead to writes being
dropped (or I/O while suspended) if the device is runtime suspended
while a write request is being processed.

Specifically, suspend() releases the susp_lock after determining the
device is idle but before setting the suspended flag, thus leaving a
window where a concurrent write() can submit an urb.

Fixes: 383cedc3bb ("USB: serial: full autosuspend support for the
option driver")

Cc: <stable@vger.kernel.org>	# v2.6.32
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-27 15:04:05 -07:00