[PATCH -next] usb: cdns3: Fix sheduling with locks held.

2019-09-26 Thread Pawel Laszczak
Patch fix issue in cdns3_ep0_feature_handle_device function. The function usleep_range can't be used there because this function is called with locks held and IRQs disabled in cdns3_device_thread_irq_handler(). To resolve this issue patch replaces usleep_range with mdelay. Reported-by: Dan Carpe

Re: [PATCH -next] usb: cdns3: Fix sheduling with locks held.

2019-09-26 Thread Greg KH
On Thu, Sep 26, 2019 at 08:00:30AM +0100, Pawel Laszczak wrote: > Patch fix issue in cdns3_ep0_feature_handle_device function. > > The function usleep_range can't be used there because this function is > called with locks held and IRQs disabled in > cdns3_device_thread_irq_handler(). > > To resol

RE: [PATCH -next] usb: cdns3: Fix sheduling with locks held.

2019-09-26 Thread Pawel Laszczak
Hi, > > >On Thu, Sep 26, 2019 at 08:00:30AM +0100, Pawel Laszczak wrote: >> Patch fix issue in cdns3_ep0_feature_handle_device function. >> >> The function usleep_range can't be used there because this function is >> called with locks held and IRQs disabled in >> cdns3_device_thread_irq_handler().

[PATCH v3 -next] usb: cdns3: Fix sheduling with locks held.

2019-09-26 Thread Pawel Laszczak
Patch fix issue in cdns3_ep0_feature_handle_device function. The function usleep_range can't be used there because this function is called with locks held and IRQs disabled in cdns3_device_thread_irq_handler(). To resolve this issue patch replaces usleep_range with mdelay. Reported-by: Dan Carpe

Re: BUG report: usb: dwc3: Link TRB triggered an intterupt without IOC being setted

2019-09-26 Thread Mathias Nyman
On 26.9.2019 8.45, Felipe Balbi wrote: Hi, David Laight writes: From: Mathias Nyman Sent: 25 September 2019 15:48 On 24.9.2019 17.45, alex zheng wrote: Hi Mathias, ... Logs show your transfer ring has four segments, but hardware fails to jump from the last segment back to first) Last TR

[PATCH 3/4] USB: usblcd: drop redundant lcd mutex

2019-09-26 Thread Johan Hovold
Drop the redundant lcd mutex introduced by commit 925ce689bb31 ("USB: autoconvert trivial BKL users to private mutex") which replaced an earlier BKL use. The lock serialised calls to open() against other open() and a custom ioctl() returning the bcdDevice (sic!), but neither is needed. Signed-off

[PATCH 4/4] USB: usblcd: use pr_err()

2019-09-26 Thread Johan Hovold
Replace the one remaining printk with pr_err(). Signed-off-by: Johan Hovold --- drivers/usb/misc/usblcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index 732eb1f81368..61e9e987fe4a 100644 --- a/drivers/usb/misc/usblc

[PATCH 0/4] USB: usblcd: disconnect fix and locking clean ups

2019-09-26 Thread Johan Hovold
This series fixes a failure to stop I/O on disconnect() in the usblcd driver. Turns out there was a lot of legacy cruft in this driver which could simply be removed. The first patch is marked for stable and could go into v5.4 while the rest is v5.5 material. Posting all at once for completeness.

[PATCH 3/4] USB: usblcd: drop redundant lcd mutex

2019-09-26 Thread Johan Hovold
Drop the redundant lcd mutex introduced by commit 925ce689bb31 ("USB: autoconvert trivial BKL users to private mutex") which replaced an earlier BKL use. The lock serialised calls to open() against other open() and a custom ioctl() returning the bcdDevice (sic!), but neither is needed. Signed-off

[PATCH 0/4] USB: usblcd: disconnect fix and locking clean ups

2019-09-26 Thread Johan Hovold
This series fixes a failure to stop I/O on disconnect() in the usblcd driver. Turns out there was a lot of legacy cruft in this driver which could simply be removed. The first patch is marked for stable and could go into v5.4 while the rest is v5.5 material. Posting all at once for completeness.

[PATCH 1/4] USB: usblcd: fix I/O after disconnect

2019-09-26 Thread Johan Hovold
Make sure to stop all I/O on disconnect by adding a disconnected flag which is used to prevent new I/O from being started and by stopping all ongoing I/O before returning. This also fixes a potential use-after-free on driver unbind in case the driver data is freed before the completion handler has

[PATCH 2/4] USB: usblcd: drop redundant disconnect mutex

2019-09-26 Thread Johan Hovold
Drop the redundant disconnect mutex which was introduced after the open-disconnect race had been addressed generally in USB core by commit d4ead16f50f9 ("USB: prevent char device open/deregister race"). Specifically, the rw-semaphore in core guarantees that all calls to open() will have completed

[PATCH 1/4] USB: usblcd: fix I/O after disconnect

2019-09-26 Thread Johan Hovold
Make sure to stop all I/O on disconnect by adding a disconnected flag which is used to prevent new I/O from being started and by stopping all ongoing I/O before returning. This also fixes a potential use-after-free on driver unbind in case the driver data is freed before the completion handler has

[PATCH 2/4] USB: usblcd: drop redundant disconnect mutex

2019-09-26 Thread Johan Hovold
Drop the redundant disconnect mutex which was introduced after the open-disconnect race had been addressed generally in USB core by commit d4ead16f50f9 ("USB: prevent char device open/deregister race"). Specifically, the rw-semaphore in core guarantees that all calls to open() will have completed

[PATCH 4/4] USB: usblcd: use pr_err()

2019-09-26 Thread Johan Hovold
Replace the one remaining printk with pr_err(). Signed-off-by: Johan Hovold --- drivers/usb/misc/usblcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index 732eb1f81368..61e9e987fe4a 100644 --- a/drivers/usb/misc/usblc

Re: [PATCH 0/4] USB: usblcd: disconnect fix and locking clean ups

2019-09-26 Thread Johan Hovold
On Thu, Sep 26, 2019 at 11:12:24AM +0200, Johan Hovold wrote: > This series fixes a failure to stop I/O on disconnect() in the usblcd > driver. Turns out there was a lot of legacy cruft in this driver which > could simply be removed. My apologies for the double post. Johan

[PATCH 09/14] usb: typec: ucsi: Simplified interface registration and I/O API

2019-09-26 Thread Heikki Krogerus
Adding more simplified API for interface registration and read and write operations. The registration is split into separate creation and registration phases. That allows the drivers to properly initialize the interface before registering it if necessary. The read and write operations are supplie

[PATCH 06/14] usb: typec: ucsi: Start using struct typec_operations

2019-09-26 Thread Heikki Krogerus
Supplying the operation callbacks as part of a struct typec_operations instead of as part of struct typec_capability during port registration. Signed-off-by: Heikki Krogerus --- drivers/usb/typec/ucsi/ucsi.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --g

[PATCH 01/14] usb: typec: Copy everything from struct typec_capability during registration

2019-09-26 Thread Heikki Krogerus
Copying everything from struct typec_capability to struct typec_port during port registration. Signed-off-by: Heikki Krogerus --- drivers/usb/typec/class.c | 55 +-- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/drivers/usb/typec/class.c b/dr

[PATCH 03/14] usb: typec: Separate the operations vector

2019-09-26 Thread Heikki Krogerus
Introducing struct typec_operations which has the same callbacks as struct typec_capability. The old callbacks are kept for now, but after all users have been converted, they will be removed. Signed-off-by: Heikki Krogerus --- drivers/usb/typec/class.c | 90 +-

[PATCH 04/14] usb: typec: tcpm: Start using struct typec_operations

2019-09-26 Thread Heikki Krogerus
Supplying the operation callbacks as part of a struct typec_operations instead of as part of struct typec_capability during port registration. Signed-off-by: Heikki Krogerus --- drivers/usb/typec/tcpm/tcpm.c | 47 --- 1 file changed, 21 insertions(+), 26 deletions

[PATCH 05/14] usb: typec: tps6598x: Start using struct typec_operations

2019-09-26 Thread Heikki Krogerus
Supplying the operation callbacks as part of a struct typec_operations instead of as part of struct typec_capability during port registration. After this there is not need to keep the capabilities stored anywhere in the driver. Signed-off-by: Heikki Krogerus --- drivers/usb/typec/tps6598x.c | 49

[PATCH 02/14] usb: typec: Introduce typec_get_drvdata()

2019-09-26 Thread Heikki Krogerus
Leaving the private driver_data pointer of the port device to the port drivers. Signed-off-by: Heikki Krogerus --- drivers/usb/typec/class.c | 11 +++ include/linux/usb/typec.h | 4 2 files changed, 15 insertions(+) diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.

[PATCH 08/14] usb: typec: ucsi: ccg: Remove run_isr flag

2019-09-26 Thread Heikki Krogerus
The "run_isr" flag is used for preventing the driver from calling the interrupt service routine in its runtime resume callback when the driver is expecting completion to a command, but what that basically does is that it hides the real problem. The real problem is that the controller is allowed to

[PATCH 00/14] usb: typec: UCSI driver overhaul

2019-09-26 Thread Heikki Krogerus
Hi Ajay, Here's the pretty much complete rewrite of the I/O handling that I was talking about. The first seven patches are not actually related to this stuff, but I'm including them here because the rest of the series is made on top of them. I'm including also that fix patch I send you earlier. A

[PATCH 07/14] usb: typec: Remove the callback members from struct typec_capability

2019-09-26 Thread Heikki Krogerus
There are no more users for them. Signed-off-by: Heikki Krogerus --- drivers/usb/typec/class.c | 65 +-- include/linux/usb/typec.h | 17 -- 2 files changed, 22 insertions(+), 60 deletions(-) diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/c

Re: [PATCH 1/1] usb: host: xhci: update event ring dequeue pointer on purpose

2019-09-26 Thread Mathias Nyman
On 24.9.2019 11.35, Peter Chen wrote: On some situations, the software handles TRB events slower than adding TRBs, then xhci_handle_event can't return zero long time, the xHC will consider the event ring is full, and trigger "Event Ring Full" error, but in fact, the software has already finished

Re: BUG report: usb: dwc3: Link TRB triggered an intterupt without IOC being setted

2019-09-26 Thread alex zheng
Hi, Mathias Nyman 于2019年9月26日周四 下午4:19写道: > > On 26.9.2019 8.45, Felipe Balbi wrote: > > > > Hi, > > > > David Laight writes: > >> From: Mathias Nyman > >>> Sent: 25 September 2019 15:48 > >>> > >>> On 24.9.2019 17.45, alex zheng wrote: > Hi Mathias, > >> ... > >>> Logs show your transfer r

[PATCH 10/14] usb: typec: ucsi: acpi: Move to the new API

2019-09-26 Thread Heikki Krogerus
Replacing the old "cmd" and "sync" callbacks with an implementation of struct ucsi_operations. The ACPI notification (interrupt) handler will from now on read the CCI (Command Status and Connector Change Indication) register, and call ucsi_connector_change() function and/or complete pending command

[PATCH 11/14] usb: typec: ucsi: ccg: Move to the new API

2019-09-26 Thread Heikki Krogerus
Replacing the old "cmd" and "sync" callbacks with an implementation of struct ucsi_operations. The interrupt handler will from now on read the CCI (Command Status and Connector Change Indication) register, and call ucsi_connector_change() function and/or complete pending command completions based o

[PATCH 13/14] usb: typec: ucsi: Remove struct ucsi_control

2019-09-26 Thread Heikki Krogerus
That data structure was used for constructing the commands before executing them, but it was never really useful. Using the structure just complicated the driver. The commands are 64-bit wide, so it is enough to simply fill a u64 variable. No data structures needed. This simplifies the driver cons

[PATCH 12/14] usb: typec: ucsi: Remove the old API

2019-09-26 Thread Heikki Krogerus
The drivers now only use the new API, so removing the old one. Signed-off-by: Heikki Krogerus --- drivers/usb/typec/ucsi/displayport.c | 8 +- drivers/usb/typec/ucsi/trace.h | 17 -- drivers/usb/typec/ucsi/ucsi.c| 346 +++ drivers/usb/typec/ucsi/ucsi.h

[PATCH 14/14] usb: typec: ucsi: Remove all bit-fields

2019-09-26 Thread Heikki Krogerus
We can't use bit fields with data that is received or send to/from the device. Signed-off-by: Heikki Krogerus --- drivers/usb/typec/ucsi/trace.h | 12 ++--- drivers/usb/typec/ucsi/ucsi.c | 52 +++ drivers/usb/typec/ucsi/ucsi.h | 93 +- 3 files ch

RE: [PATCH 00/14] usb: typec: UCSI driver overhaul

2019-09-26 Thread Ajay Gupta
Hi Heikki, > -Original Message- > From: Heikki Krogerus > Sent: Thursday, September 26, 2019 3:07 AM > To: Ajay Gupta > Cc: linux-usb@vger.kernel.org > Subject: [PATCH 00/14] usb: typec: UCSI driver overhaul > > Hi Ajay, > > Here's the pretty much complete rewrite of the I/O handling th