RE: [PATCH v3 2/4] libusbg: Fix buffer overrun issue. CID#56128

2014-05-26 Thread Krzysztof Opasiak
> -Original Message- > From: linux-usb-ow...@vger.kernel.org [mailto:linux-usb- > ow...@vger.kernel.org] On Behalf Of philippedesw...@gmail.com > Sent: Saturday, May 24, 2014 7:29 PM > To: philippedesw...@gmail.com; linux-usb@vger.kernel.org > Subject: [PATCH v3 2/4] libusbg: Fix buffer o

RE: [PATCH v3 1/4] libusbg: Fix readlink/buffer overrun issue. CID#56130, CID#56129

2014-05-26 Thread Krzysztof Opasiak
> -Original Message- > From: linux-usb-ow...@vger.kernel.org [mailto:linux-usb- > ow...@vger.kernel.org] On Behalf Of philippedesw...@gmail.com > Sent: Saturday, May 24, 2014 7:29 PM > To: philippedesw...@gmail.com; linux-usb@vger.kernel.org > Subject: [PATCH v3 1/4] libusbg: Fix readlink/

RE: [PATCH v3 3/4] libusbg: Do not try to dereference func when it is NULL. CID#56127

2014-05-26 Thread Krzysztof Opasiak
> -Original Message- > From: linux-usb-ow...@vger.kernel.org [mailto:linux-usb- > ow...@vger.kernel.org] On Behalf Of philippedesw...@gmail.com > Sent: Saturday, May 24, 2014 7:29 PM > To: philippedesw...@gmail.com; linux-usb@vger.kernel.org > Subject: [PATCH v3 3/4] libusbg: Do not try t

RE: [PATCH v3 4/4] libusbg: Do not dereference usb config attributes when they are NULL. CID#56126

2014-05-26 Thread Krzysztof Opasiak
> -Original Message- > From: linux-usb-ow...@vger.kernel.org [mailto:linux-usb- > ow...@vger.kernel.org] On Behalf Of philippedesw...@gmail.com > Sent: Saturday, May 24, 2014 7:29 PM > To: philippedesw...@gmail.com; linux-usb@vger.kernel.org > Subject: [PATCH v3 4/4] libusbg: Do not deref

Re: [PATCH v3 5/7] usb: musb: introduce dma_channel.packet_done

2014-05-26 Thread Daniel Mack
On 05/26/2014 08:58 AM, George Cherian wrote: > On 5/25/2014 2:06 PM, Daniel Mack wrote: >> The musb/cppi41 glue layer is capable of handling transactions that span >> over more than one USB packet by reloading the DMA descriptors >> partially. An urb is considered completed when either its transfe

Re: [PATCH v4 1/6] usb: musb: core: Handle Babble condition only in HOST mode

2014-05-26 Thread George Cherian
On 5/23/2014 2:12 AM, Bin Liu wrote: Hi George, On Mon, May 19, 2014 at 11:32 PM, George Cherian wrote: Hi Bin, On 5/19/2014 9:24 PM, Bin Liu wrote: Hi, On Mon, May 19, 2014 at 8:39 AM, George Cherian wrote: BABBLE and RESET share the same interrupt. The interrupt is considered to be RESE

[PATCH v6 3/5] usb: musb: dsps: Call usb_phy(_shutdown/_init) during musb_platform_reset()

2014-05-26 Thread George Cherian
For DSPS platform usb_phy_vbus(_off/_on) are NOPs. So during musb_platform_reset() call usb_phy(_shutdown/_init) Signed-off-by: George Cherian --- drivers/usb/musb/musb_dsps.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb

[PATCH v6 4/5] usb: musb: core: Convert the musb_platform_reset to have a return value.

2014-05-26 Thread George Cherian
Currently musb_platform_reset() is only used by dsps. In case of BABBLE interrupt for other platforms the musb_platform_reset() is a NOP. In such situations no need to re-initialize the endpoints. Also in the latest silicon revision of AM335x, we do have a babble recovery mechanism without resetti

[PATCH v6 5/5] usb: musb: dsps: Add the sw_babble_control() and Enable for newer silicon

2014-05-26 Thread George Cherian
Add sw_babble_control() logic to differentiate between transient babble and real babble condition. Also add the SW babble control register definitions. Babble control register logic is implemented in the latest revision of AM335x. Find whether we are running on newer silicon. The babble control r

[PATCH v6 0/5] Add support for SW babble Control

2014-05-26 Thread George Cherian
Series add support for SW babble control logic found in new silicon versions of AM335x. Runtime differentiation of silicon version is done by checking the BABBLE_CTL register. For newer silicon the register default value read is 0x4 and for older versions its 0x0. Patch 1 -> Handle Babble only if

[PATCH v6 2/5] usb: musb: core: Convert babble recover work to delayed work

2014-05-26 Thread George Cherian
During babble condition both first disconnect of devices are initiated. Make sure MUSB controller is reset and re-initialized after all disconnects. To acheive this schedule a delayed work for babble recovery. While at that convert udelay to usleep_range. Refer Documentation/timers/timers-howto.t

[PATCH v6 1/5] usb: musb: core: Handle Babble condition only in HOST mode

2014-05-26 Thread George Cherian
BABBLE and RESET share the same interrupt. The interrupt is considered to be RESET if MUSB is in peripheral mode and as a BABBLE if MUSB is in HOST mode. Handle babble condition iff MUSB is in HOST mode. Signed-off-by: George Cherian --- drivers/usb/musb/musb_core.c | 2 +- 1 file changed, 1 in

Re: [PATCH 1/5] phy: add support for USB cluster on the Armada 375 SoC

2014-05-26 Thread Kishon Vijay Abraham I
hI, On Saturday 24 May 2014 03:20 AM, Gregory CLEMENT wrote: > On 23/05/2014 11:20, Kishon Vijay Abraham I wrote: >> Hi, >> >> On Friday 16 May 2014 09:52 PM, Gregory CLEMENT wrote: >>> The Armada 375 SoC comes with an USB2 host and device controller and >>> an USB3 controller. The USB cluster con

[PATCH net-next 2/8] net: cdc_ncm: always reallocate tx_curr_skb when tx_max increases

2014-05-26 Thread Bjørn Mork
We are calling usbnet_start_xmit() to flush any remaining data, depending on the side effect that tx_curr_skb is set to NULL, ensuring a new allocation using the updated tx_max. But this side effect will only happen if there were any cached data ready to transmit. If not, then an empty tx_curr_skb

[PATCH net-next 8/8] net: cdc_ncm: document the sysfs API

2014-05-26 Thread Bjørn Mork
Adding documentation for all the driver specific sysfs attributes. Signed-off-by: Bjørn Mork --- Documentation/ABI/testing/sysfs-class-net-cdc_ncm | 143 ++ 1 file changed, 143 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-net-cdc_ncm diff --git a/D

[PATCH net-next 1/8] net: cdc_ncm: reduce skb truesize in rx path

2014-05-26 Thread Bjørn Mork
Cloning the big skbs we use for USB buffering chokes up TCP and SCTP because the socket memory limits are hitting earlier than they should. It is better to unconditionally copy the unwrapped packets to freshly allocated skbs. Reported-by: Jim Baxter Acked-by: Eric Dumazet Signed-off-by: Bjørn Mo

[PATCH net-next 5/8] net: cdc_ncm: drop ethtool coalesce support

2014-05-26 Thread Bjørn Mork
The ethtool coalesce API is not applicable for this driver. Forcing it to fit the NCM aggregation redefined the API in a driver specific way, which is much worse than defining a clean new API. These ethtool coalesce functions have therefore been replaced by a new sysfs API. Signed-off-by: Bjørn Mo

[PATCH net-next 4/8] net: cdc_ncm: use sysfs for rx/tx aggregation tuning

2014-05-26 Thread Bjørn Mork
Attach a driver specific sysfs group to the netdev, and use it for the rx/tx aggregation variables. The datagram aggregation defined by the CDC NCM specification is specific to this device class (including CDC MBIM). Using the ethtool interrupt coalesce API as an interface to the aggregation param

[PATCH net-next 0/8] cdc_ncm: fixes and conversion to sysfs API

2014-05-26 Thread Bjørn Mork
After considering the comments received after the ethtool coalesce support was commited, I have ended up concluding that we should remove it again, while we can, before it hits a release. The idea was not well enough thought through, and all comments received pointed to advantages of using a sysfs

[PATCH net-next 3/8] net: cdc_ncm: inform usbnet when rx buffers are reduced

2014-05-26 Thread Bjørn Mork
It doesn't matter whether the buffer size goes up or down. We have to keep usbnet and device syncronized to be able to split transfers at the correct boundaries. The spec allow skipping short packets when using max sized transfers. If we don't tell usbnet about our new expected rx buffer size, th

[PATCH net-next 7/8] net: cdc_ncm: allow tuning min_tx_pkt

2014-05-26 Thread Bjørn Mork
The min_tx_pkt variable decides the cutoff point where the driver will stop padding out NTBs to maximum size. The padding is a tradeoff where we use some USB bus bandwidth to allow the device to receive fixed size buffers. Different devices will have different optimal settings, spanning from no pad

[PATCH net-next 6/8] net: cdc_ncm: export NCM Transfer Block (NTB) parameters

2014-05-26 Thread Bjørn Mork
The mandatory GetNtbParameters control request is an important part of the host <-> device protocol negotiation in CDC NCM (and CDC MBIM). It gives device limits which the host must obey when configuring the protocol aggregation variables. The driver will enforce this by rejecting attempts to set a

Re: xhci usb 3.0 logitech c920 not working

2014-05-26 Thread Martin Rudhart
Thank your for your reply, A summary of my Bugreport at Launchpad: My usb-Webcam Logitech c920 doesn't work when connected to my usb 3.0 Host Controller (Etron EJ168a). When connected to a usb 2.0 Host Controller it works perfectly. When I connect my usb 3.0 stick to the same port, it's recogn

Re: [PATCH usb: phy: add run-time dependencies to R-Car driver

2014-05-26 Thread Laurent Pinchart
Hi Jean, Thank you for the patch. On Friday 23 May 2014 10:36:22 Jean Delvare wrote: > The Renesas R-Car USB PHY driver only supports the R8A7778 and > R8A7779, it isn't useful on other systems unless build testing. > > Signed-off-by: Jean Delvare > Cc: Felipe Balbi > Cc: Greg Kroah-Hartman >

[PATCH v4 0/7] Multiple fixes for musb and cppi41

2014-05-26 Thread Daniel Mack
Here is v4 of my cleanup series for musb in CPPI DMA mode. v3 -> v4: * s/MUSB_CSR0_TXPKTRDY/MUSB_TXCSR_TXPKTRDY/ in patch #4 * s/packet_done/rx_packet_done/ in #5 v2 -> v3: * Dropped the RXSTALL bit modification from patch #4 * Droped some occasions where musb_ep_s

[PATCH v4 2/7] usb: musb: remove unnecessary (void) prefix at function calls

2014-05-26 Thread Daniel Mack
Just a little cleanup that removes unnecessary casts. Signed-off-by: Daniel Mack Acked-by: George Cherian --- drivers/usb/musb/musb_host.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index eb06291..f98a7c0

[PATCH v4 3/7] usb: musb: use is_host_active() to distinguish between host and gadget mode

2014-05-26 Thread Daniel Mack
On AM33xx platforms, unplugging a device in the middle of an active transfer leads to a drop of MUSB_DEVCTL_HM in MUSB_DEVCTL before the system is informed about a disconnect. This consequently makes the musb core call the gadget code to handle the interrupt request, which then crashes the kernel b

[PATCH v4 1/7] dma: cppi41: handle 0-length packets

2014-05-26 Thread Daniel Mack
When a 0-length packet is received on the bus, desc->pd0 yields 1, which confuses the driver's users. This information is clearly wrong and not in accordance to the datasheet, but it's been observed on an AM335x board, very reproducible. Fix this by looking at bit 19 in PD2 of the completed packet

[PATCH v4 7/7] usb: musb: fix wrong indentation in musb_host.c

2014-05-26 Thread Daniel Mack
Just a cosmetic cleanup with no functional change. Signed-off-by: Daniel Mack --- drivers/usb/musb/musb_host.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index b00edd2..ac6dd92 100644 --- a/drivers/us

[PATCH v4 5/7] usb: musb: introduce dma_channel.rx_packet_done

2014-05-26 Thread Daniel Mack
The musb/cppi41 glue layer is capable of handling transactions that span over more than one USB packet by reloading the DMA descriptors partially. An urb is considered completed when either its transfer buffer has been filled entirely (actual_length == transfer_buffer_length) or if a packet in the

[PATCH v4 6/7] usb: musb/cppi41: call musb_ep_select() before accessing an endpoint's CSR

2014-05-26 Thread Daniel Mack
Before accessing any of an endpoint's CSR registers, make sure the correct endpoint is selected. Otherwise, data read from or written to the registers is likely to affect the wrong endpoint as long as the connected device has more than one endpoint. This, of course, leads to all sorts of strange e

[PATCH v4 4/7] usb: musb: fix bit mask for CSR in musb_h_tx_flush_fifo()

2014-05-26 Thread Daniel Mack
The datasheet says that MUSB_TXCSR_FLUSHFIFO is only valid when MUSB_TXCSR_TXPKTRDY is set as well. With this patch applied, the warning in this function does no longer kick in when an USB soundcard is unplugged while the stream is active. Signed-off-by: Daniel Mack --- drivers/usb/musb/musb_ho

Re: [PATCH usb: phy: add run-time dependencies to R-Car driver

2014-05-26 Thread Sergei Shtylyov
Hello. On 05/26/2014 04:50 PM, Laurent Pinchart wrote: The Renesas R-Car USB PHY driver only supports the R8A7778 and R8A7779, it isn't useful on other systems unless build testing. Signed-off-by: Jean Delvare Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: Laurent Pinchart Could you plea

Re: [PATCH v2 4/6] usb: musb: fix bit masks for CSR in musb_h_tx_flush_fifo()

2014-05-26 Thread Sergei Shtylyov
Hello. On 05/24/2014 11:22 AM, Daniel Mack wrote: I I'd say it's not supposed to. I just wanted the bit to be 0 when writing back the CSR. You failed to achieve that since you forgot ~; you're clearing all bits but this one. Ouch, totally missed that, thanks! And I've missed CSR0

Re: ASMedia AS2105 interface on USB 3.0 corrupts data

2014-05-26 Thread Mathias Nyman
On 05/22/2014 05:10 PM, Alan Stern wrote: > On Thu, 22 May 2014, Heinz Diehl wrote: > >> On 21.05.2014, Alan Stern wrote: >> >>> In that case, I have no idea what else could be causing the problem. >> >> Thanks for your efforts! >> >> If somebody of the developers is interested in debugging t

Re: ASMedia AS2105 interface on USB 3.0 corrupts data

2014-05-26 Thread Mathias Nyman
On 05/22/2014 05:22 PM, David Laight wrote: > From: Alan Stern >> On Thu, 22 May 2014, Heinz Diehl wrote: >> >>> On 21.05.2014, Alan Stern wrote: >>> In that case, I have no idea what else could be causing the problem. >>> >>> Thanks for your efforts! >>> >>> If somebody of the developers

[PATCH 1/18] USB: storage: ene_ub6250: Use kmemdup instead of kmalloc + memcpy

2014-05-26 Thread Benoit Taine
This issue was reported by coccicheck using the semantic patch at scripts/coccinelle/api/memdup.cocci Signed-off-by: Benoit Taine --- Tested by compilation without errors. drivers/usb/storage/ene_ub6250.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/stor

[PATCH 11/18] usb: gadget: Use kmemdup instead of kmalloc + memcpy

2014-05-26 Thread Benoit Taine
This issue was reported by coccicheck using the semantic patch at scripts/coccinelle/api/memdup.cocci Signed-off-by: Benoit Taine --- Tested by compilation without errors. drivers/usb/gadget/configfs.c|4 +--- drivers/usb/gadget/lpc32xx_udc.c |3 +-- 2 files changed, 2 insertions(+

[PATCH 0/18] Use kmemdup instead of kmalloc + memcpy

2014-05-26 Thread Benoit Taine
These patches enhance kernel style usage, and allows smaller code while preventing accidental code edits to produce overflows. The semantic patch at scripts/coccinelle/api/memdup.cocci was used to detect and edit this situation. -- To unsubscribe from this list: send the line "unsubscribe linux-us

[PATCH 14/18] r8152: Use kmemdup instead of kmalloc + memcpy

2014-05-26 Thread Benoit Taine
This issue was reported by coccicheck using the semantic patch at scripts/coccinelle/api/memdup.cocci Signed-off-by: Benoit Taine --- Tested by compilation without errors. drivers/net/usb/r8152.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/usb/r8152.c

Re: ASMedia AS2105 interface on USB 3.0 corrupts data

2014-05-26 Thread Heinz Diehl
On 26.05.2014, Mathias Nyman wrote: > This would be helpful, I've got a LeCroy protocol analyzer in Finland. > Heinz, if you're willing to send it to Europe Finland I'll gladly take it, > (I'll send the address details in a separate personal mail) Of course! Send me your adress, and I'll send

[PATCH 02/63] USB: sierra: fix use after free at suspend/resume

2014-05-26 Thread Johan Hovold
Fix use after free or NULL-pointer dereference during suspend and resume. The port data may never have been allocated (port probe failed) or may already have been released by port_remove (e.g. driver is unloaded) when suspend and resume are called. Fixes: e6929a9020ac ("USB: support for autosuspe

[PATCH 55/63] USB: cdc-acm: fix I/O after failed open

2014-05-26 Thread Johan Hovold
Make sure to kill any already submitted read urbs on read-urb submission failures in open in order to prevent doing I/O for a closed port. Fixes: 088c64f81284 ("USB: cdc-acm: re-write read processing") Signed-off-by: Johan Hovold --- drivers/usb/class/cdc-acm.c | 3 +++ 1 file changed, 3 inserti

[PATCH 04/63] USB: sierra: fix urb and memory leak on disconnect

2014-05-26 Thread Johan Hovold
The delayed-write queue was never emptied on disconnect, something which would lead to leaked urbs and transfer buffers if the device is disconnected before being runtime resumed due to a write. Fixes: e6929a9020ac ("USB: support for autosuspend in sierra while online") Cc: # v2.6.32 Signed-o

[PATCH 21/63] USB: option: fix runtime PM handling

2014-05-26 Thread Johan Hovold
Fix potential I/O while runtime suspended due to missing PM operations in send_setup. Fixes: 383cedc3bb43 ("USB: serial: full autosuspend support for the option driver") Cc: # v2.6.32 Signed-off-by: Johan Hovold --- drivers/usb/serial/option.c | 11 ++- 1 file changed, 10 insert

[PATCH 58/63] USB: cdc-acm: remove redundant disconnected test from shutdown

2014-05-26 Thread Johan Hovold
Remove redundant disconnect test from shutdown(), which is never called post disconnect() where we do synchronous hangup. Signed-off-by: Johan Hovold --- drivers/usb/class/cdc-acm.c | 41 +++-- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/dr

[PATCH 61/63] USB: cdc-acm: remove redundant usb_mark_last_busy

2014-05-26 Thread Johan Hovold
There's no need to call usb_mark_last_busy after having increased the PM counter in write(). The device will be marked busy by USB core when the PM counter is balanced in the completion handler. Signed-off-by: Johan Hovold --- drivers/usb/class/cdc-acm.c | 1 - 1 file changed, 1 deletion(-) dif

[PATCH 35/63] USB: usb_wwan: kill interrupt urb explicitly at suspend

2014-05-26 Thread Johan Hovold
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 --- drivers/usb/serial/usb_wwan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletio

[PATCH 63/63] USB: wusbcore: fix control-pipe directions

2014-05-26 Thread Johan Hovold
Fix incorrect pipe directions in control requests (which has been silently fixed up by USB core). Signed-off-by: Johan Hovold --- drivers/usb/wusbcore/wa-rpipe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/wusbcore/wa-rpipe.c b/drivers/usb/wusbcore/wa-rpip

[PATCH 34/63] USB: usb_wwan: remove redundant urb kill from port remove

2014-05-26 Thread Johan Hovold
Remove redundant usb_kill_urb from port remove, which is called post-shutdown (close). Signed-off-by: Johan Hovold --- drivers/usb/serial/usb_wwan.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index aa45985

[PATCH 57/63] USB: cdc-acm: simplify runtime PM locking

2014-05-26 Thread Johan Hovold
We can simply the runtime PM locking as there's no need to check the susp_count in the read path (at least not since killing the rx tasklet). Specifically, the read urbs will never be resubmitted by the completion handler when killed during suspend. Signed-off-by: Johan Hovold --- drivers/usb/c

[PATCH 59/63] USB: cdc-acm: minimise no-suspend window during shutdown

2014-05-26 Thread Johan Hovold
Now that acm_set_control() handles runtime PM properly, the only remaining reason for the PM operations in shutdown is to clear the needs_remote_wakeup flag before the final put. Note that this also means that we now need to grab the write_lock to prevent racing with resume. Signed-off-by: Johan

[PATCH 28/63] USB: usb_wwan: fix potential NULL-deref at resume

2014-05-26 Thread Johan Hovold
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 op

[PATCH 36/63] USB: usb_wwan: make resume error messages uniform

2014-05-26 Thread Johan Hovold
Make resume error messages uniform. Signed-off-by: Johan Hovold --- drivers/usb/serial/usb_wwan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index b671d59e356e..3737006930c0 100644 --- a/drivers/usb/seria

[PATCH 41/63] USB: usb_wwan: remove bogus function prototype

2014-05-26 Thread Johan Hovold
The usb_wwan_send_setup() function has never existed. Signed-off-by: Johan Hovold --- drivers/usb/serial/usb-wwan.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h index dc379603c4b8..8502f9add334 100644 --- a/drivers/usb/serial/us

[PATCH 50/63] USB: cdc-acm: fix runtime PM for control messages

2014-05-26 Thread Johan Hovold
Fix runtime PM handling of control messages by adding the required PM counter operations. Fixes: 11ea859d64b6 ("USB: additional power savings for cdc-acm devices that support remote wakeup") Cc: # v2.6.27 Signed-off-by: Johan Hovold --- drivers/usb/class/cdc-acm.c | 12 +++- 1 file

[PATCH 37/63] USB: usb_wwan: use interface-data accessors

2014-05-26 Thread Johan Hovold
Use usb_get_serial_data() rather than accessing the private pointer directly. Signed-off-by: Johan Hovold --- drivers/usb/serial/usb_wwan.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c ind

[PATCH 49/63] USB: cdc-acm: fix broken runtime suspend

2014-05-26 Thread Johan Hovold
The current ACM runtime-suspend implementation is broken in several ways: Firstly, it buffers only the first write request being made while suspended -- any further writes are silently dropped. Secondly, writes being dropped also leak write urbs, which are never reclaimed (until the device is unb

[PATCH 13/63] USB: sierra: remove disconnected test from close

2014-05-26 Thread Johan Hovold
Remove no longer needed disconnected test from close, which is never called post disconnect (and drivers must handle failed I/O during disconnect anyway). Signed-off-by: Johan Hovold --- drivers/usb/serial/sierra.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git

[PATCH 51/63] USB: cdc-acm: fix shutdown and suspend race

2014-05-26 Thread Johan Hovold
We should stop I/O unconditionally at suspend rather than rely on the tty-port initialised flag (which is set prior to stopping I/O during shutdown) in order to prevent suspend returning with URBs still active. Fixes: 11ea859d64b6 ("USB: additional power savings for cdc-acm devices that support re

[PATCH 33/63] USB: usb_wwan: remove unimplemented set_termios

2014-05-26 Thread Johan Hovold
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 --- drivers/usb/serial/option.c | 1 - drivers

[PATCH 60/63] USB: cdc-acm: do not update PM busy on read errors

2014-05-26 Thread Johan Hovold
There's no need to update the runtime PM last_busy field on read urb errors (e.g. when the urb is being killed on shutdown). Signed-off-by: Johan Hovold --- drivers/usb/class/cdc-acm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/us

[PATCH 42/63] USB: usb_wwan: report failed submissions as errors

2014-05-26 Thread Johan Hovold
Promote failed-submission messages in open() and write() to error log level. Signed-off-by: Johan Hovold --- drivers/usb/serial/usb_wwan.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index c951f75

[PATCH 53/63] USB: cdc-acm: fix open and suspend race

2014-05-26 Thread Johan Hovold
We must not do the usb_autopm_put_interface() before submitting the read urbs or we might end up doing I/O to a suspended device. Fixes: 088c64f81284 ("USB: cdc-acm: re-write read processing") Signed-off-by: Johan Hovold --- drivers/usb/class/cdc-acm.c | 7 +++ 1 file changed, 3 insertions(+

[PATCH 47/63] USB: cdc-acm: fix write and suspend race

2014-05-26 Thread Johan Hovold
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 write_lock after determining the device is idle but before incrementing the sus

[PATCH 38/63] USB: usb_wwan: clean up delayed-urb submission

2014-05-26 Thread Johan Hovold
Clean up and rename delay-urb submission function using a more descriptive name. Also add comment on locking assumptions. Signed-off-by: Johan Hovold --- drivers/usb/serial/usb_wwan.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/usb/serial/usb_wwan.

[PATCH 10/63] USB: sierra: remove bogus endpoint test

2014-05-26 Thread Johan Hovold
Remove bogus endpoint-address test which is never true. Signed-off-by: Johan Hovold --- drivers/usb/serial/sierra.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 4cb11b710b48..169899f5f2e6 100644 --- a/drivers/usb/serial/sie

[PATCH 19/63] USB: sierra: minimise no-suspend window during close

2014-05-26 Thread Johan Hovold
Move usb_autopm_get_interface_no_resume to the end of close(). This makes the window during which suspend is prevented before the final put in USB serial core slightly smaller. Signed-off-by: Johan Hovold --- drivers/usb/serial/sierra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

[PATCH 24/63] USB: usb_wwan: fix urb leak in write error path

2014-05-26 Thread Johan Hovold
From: xiao jin When enable usb serial for modem data, sometimes the tty is blocked in tty_wait_until_sent because portdata->out_busy always is set and have no chance to be cleared. We find a bug in write error path. usb_wwan_write set portdata->out_busy firstly, then try autopm async with error.

[PATCH 11/63] USB: sierra: remove unused variable

2014-05-26 Thread Johan Hovold
Remove unused variable from sierra_release_urb. Signed-off-by: Johan Hovold --- drivers/usb/serial/sierra.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 169899f5f2e6..fa0b78ad42d7 100644 --- a/drivers/usb/serial/sierra.c +++

[PATCH 43/63] USB: usb_wwan: do not resume I/O on closing ports

2014-05-26 Thread Johan Hovold
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()

[PATCH 12/63] USB: sierra: remove unimplemented set_termios

2014-05-26 Thread Johan Hovold
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 --- drivers/usb/serial/sierra.c | 8 1 f

[PATCH 07/63] USB: sierra: fix urbs not being killed on shutdown

2014-05-26 Thread Johan Hovold
Make sure to stop all I/O, including any active write urbs, at shutdown. Signed-off-by: Johan Hovold --- drivers/usb/serial/sierra.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index ed43b18ace78..96ad379a0681 100644 --- a/drive

[PATCH 20/63] USB: sierra: do not resume I/O on closing ports

2014-05-26 Thread Johan Hovold
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()

[PATCH 18/63] USB: sierra: refactor delayed-urb submission

2014-05-26 Thread Johan Hovold
Refactor and clean up delayed-urb submission at resume. Signed-off-by: Johan Hovold --- drivers/usb/serial/sierra.c | 63 +++-- 1 file changed, 43 insertions(+), 20 deletions(-) diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index

[PATCH 08/63] USB: sierra: fix resume error reporting

2014-05-26 Thread Johan Hovold
Add error message to resume error path and make sure to also return an error when failing to submit a cached write. Signed-off-by: Johan Hovold --- drivers/usb/serial/sierra.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index

[PATCH 45/63] USB: serial: remove overly defensive port tests

2014-05-26 Thread Johan Hovold
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 --- drivers/usb/serial/usb-serial.c | 38 ++ 1 file changed, 14 insertions(+), 24 delet

[PATCH 01/63] USB: sierra: fix AA deadlock in open error path

2014-05-26 Thread Johan Hovold
Fix AA deadlock in open error path that would call close() and try to grab the already held disc_mutex. Fixes: b9a44bc19f48 ("sierra: driver urb handling improvements") Cc: # v2.6.31 Signed-off-by: Johan Hovold --- drivers/usb/serial/sierra.c | 21 + 1 file changed, 13 i

[PATCH 31/63] USB: usb_wwan: fix remote wakeup

2014-05-26 Thread Johan Hovold
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 (an

[PATCH 14/63] USB: sierra: do not resume I/O on closed ports

2014-05-26 Thread Johan Hovold
Do not resume any I/O, including the delayed write queue, on closed ports. Note that this currently has no functional impact due to the usb_autopm_get_interface() in close(), but that call is about to be removed by a follow-up patch. Signed-off-by: Johan Hovold --- drivers/usb/serial/sierra.c |

[PATCH 09/63] USB: sierra: fix line-control pipe direction

2014-05-26 Thread Johan Hovold
The sierra line-control request has been using the wrong pipe direction, while relying on USB core to fix it up. Signed-off-by: Johan Hovold --- drivers/usb/serial/sierra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra

[PATCH 00/63] USB: (mostly runtime PM) patches for v3.16-rc

2014-05-26 Thread Johan Hovold
Turns out that the three current implementations of aggressive runtime power management in USB-TTY drivers were quite badly broken (and has so been since first merged in v2.6.27 and v2.6.32). These patches fix this runtime PM mess, but also do some clean up and fix a few other issues. Note that a

[PATCH 05/63] USB: sierra: fix remote wakeup

2014-05-26 Thread Johan Hovold
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 (an

[PATCH 39/63] USB: usb_wwan: remove comment from close

2014-05-26 Thread Johan Hovold
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 --- drivers/usb/serial/usb_wwan.c | 1 - 1 file changed, 1 deletion(-

[PATCH 06/63] USB: sierra: fix characters being dropped at close

2014-05-26 Thread Johan Hovold
Fix characters potentially being dropped at close due to missing chars_in_buffer implementation. Note that currently the write urbs are not even killed at close (will be fixed separately), but this could still lead to dropped data since we have lowered DTR/RTS. Signed-off-by: Johan Hovold --- d

[PATCH 03/63] USB: sierra: fix urb and memory leak in resume error path

2014-05-26 Thread Johan Hovold
Neither the transfer buffer or the urb itself were released in the resume error path for delayed writes. Also on errors, the remainder of the queue was not even processed, which leads to further urb and buffer leaks. The same error path also failed to balance the outstanding-urb counter, something

[PATCH 56/63] USB: cdc-acm: fix runtime PM imbalance at shutdown

2014-05-26 Thread Johan Hovold
Make sure only to decrement the PM counters if they were actually incremented. Note that the USB PM counter, but not necessarily the driver core PM counter, is reset when the interface is unbound. Fixes: 11ea859d64b6 ("USB: additional power savings for cdc-acm devices that support remote wakeup")

[PATCH 30/63] USB: usb_wwan: fix discarded writes on resume errors

2014-05-26 Thread Johan Hovold
There's no reason not to try sending off any further delayed write urbs, should one urb-submission fail. Signed-off-by: Johan Hovold --- drivers/usb/serial/usb_wwan.c | 27 --- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/usb/serial/usb_wwan.c b

[PATCH 44/63] USB: serial: fix potential runtime pm imbalance at device remove

2014-05-26 Thread Johan Hovold
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 cou

[PATCH 40/63] USB: usb_wwan: remove some superfluous comments

2014-05-26 Thread Johan Hovold
Remove some more outdated or superfluous comments. Signed-off-by: Johan Hovold --- drivers/usb/serial/usb_wwan.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index 5042faa5d588..c951f75891c9 100644 --- a/drivers/usb/seria

[PATCH 46/63] USB: kobil_sct: fix control requests without data stage

2014-05-26 Thread Johan Hovold
Fix incorrect pipe directions and remove bogus data buffer arguments from control requests without data stage. Signed-off-by: Johan Hovold --- drivers/usb/serial/kobil_sct.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/usb/serial/kobil_sct.

[PATCH 23/63] USB: option: add missing usb_mark_last_busy

2014-05-26 Thread Johan Hovold
We should call usb_mark_last_busy in all input paths, including the interrupt completion handler. Signed-off-by: Johan Hovold --- drivers/usb/serial/option.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 2003a66c4807..df91ea92

[PATCH 27/63] USB: usb_wwan: fix urb leak at shutdown

2014-05-26 Thread Johan Hovold
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

[PATCH 62/63] USB: cdc-acm: use tty-port dtr_rts

2014-05-26 Thread Johan Hovold
Add dtr_rts tty-port operation which implements proper DTR/RTS handling (e.g. only lower DTR/RTS during shutdown if HUPCL is set). Note that modem-control locking still needs to be added throughout the driver. Signed-off-by: Johan Hovold --- drivers/usb/class/cdc-acm.c | 32

[PATCH 48/63] USB: cdc-acm: fix write and resume race

2014-05-26 Thread Johan Hovold
Fix race between write() and resume() due to improper locking that could lead to writes being reordered. Resume must be done atomically and susp_count be protected by the write_lock in order to prevent racing with write(). This could otherwise lead to writes being reordered if write() grabs the wr

[PATCH 25/63] USB: usb_wwan: fix race between write and resume

2014-05-26 Thread Johan Hovold
From: xiao jin We find a race between write and resume. usb_wwan_resume run play_delayed() and spin_unlock, but intfdata->suspended still is not set to zero. At this time usb_wwan_write is called and anchor the urb to delay list. Then resume keep running but the delayed urb have no chance to be c

[PATCH 16/63] USB: sierra: use interface-data accessors

2014-05-26 Thread Johan Hovold
Use usb_get_serial_data() rather than accessing the private pointer directly. Signed-off-by: Johan Hovold --- drivers/usb/serial/sierra.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 3a2f5b80d875.

[PATCH 26/63] USB: usb_wwan: fix write and suspend race

2014-05-26 Thread Johan Hovold
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

[PATCH 29/63] USB: usb_wwan: fix potential blocked I/O after resume

2014-05-26 Thread Johan Hovold
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 cl

[PATCH 17/63] USB: sierra: clean up suspend

2014-05-26 Thread Johan Hovold
Clean up suspend() somewhat and make sure to always set the suspended flag (although it's only used for runtime PM) in order to match resume(). Signed-off-by: Johan Hovold --- drivers/usb/serial/sierra.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/driver

  1   2   >