Re: [PATCH 6/9] ALSA: usb: caiaq: use usb_fill_int_urb()

2018-06-21 Thread Sebastian Andrzej Siewior
On 2018-06-21 22:19:32 [+0200], Daniel Mack wrote: > On Tuesday, June 19, 2018 11:55 PM, Sebastian Andrzej Siewior wrote: > > Using usb_fill_int_urb() helps to find code which initializes an > > URB. A grep for members of the struct (like ->complete) reveal lots > > of other things, too. > >

Re: [PATCH 6/9] ALSA: usb: caiaq: use usb_fill_int_urb()

2018-06-21 Thread Daniel Mack
On Tuesday, June 19, 2018 11:55 PM, Sebastian Andrzej Siewior wrote: Using usb_fill_int_urb() helps to find code which initializes an URB. A grep for members of the struct (like ->complete) reveal lots of other things, too. Acked-by: Daniel Mack Cc: Jaroslav Kysela Cc: Takashi Iwai

Re: [PATCH 5/9] ALSA: usb: caiaq: audio: use irqsave() in USB's complete callback

2018-06-21 Thread Daniel Mack
On Tuesday, June 19, 2018 11:55 PM, Sebastian Andrzej Siewior wrote: From: John Ogness 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

Re: [PATCH v2] USB: serial: ftdi_sio: Add MTP NVM support

2018-06-21 Thread Ajay Gupta
Hi Loic On 6/21/18, Loic Poulain wrote: > Most of FTDI's devices have an EEPROM which records FTDI devices > configuration setting (e.g. the VID, PID, I/O config...) and user > data. FT230R chip integrates a 128-byte eeprom, FT230X a 2048-byte > eeprom... > > This patch adds support for FTDI

[PATCH v2] USB: serial: ftdi_sio: Add MTP NVM support

2018-06-21 Thread Loic Poulain
Most of FTDI's devices have an EEPROM which records FTDI devices configuration setting (e.g. the VID, PID, I/O config...) and user data. FT230R chip integrates a 128-byte eeprom, FT230X a 2048-byte eeprom... This patch adds support for FTDI EEPROM read/write via USB control transfers and register

[PATCH 5/7] usb: gadget: u_audio: remove cached period bytes value

2018-06-21 Thread Eugeniu Rosca
From: Vladimir Zapolskiy Substream period size potentially can be changed in runtime, however this is not accounted in the data copying routine, the change replaces the cached value with an actual value from substream runtime. As a side effect the change also removes a potential division by

[PATCH 6/7] usb: gadget: f_uac2: disable IN/OUT ep if unused

2018-06-21 Thread Eugeniu Rosca
From: Andreas Pape Via p_chmask/c_chmask the user can define whether uac2 shall support playback and/or capture. This has only effect on the created ALSA device, but not on the USB descriptor. This patch adds playback/capture descriptors dependent on that parameter. Signed-off-by: Andreas Pape

[PATCH 7/7] usb: gadget: u_audio: protect stream runtime fields with stream spinlock

2018-06-21 Thread Eugeniu Rosca
From: Vladimir Zapolskiy The change protects almost the whole body of u_audio_iso_complete() function by PCM stream lock, this is mainly sufficient to avoid a race between USB request completion and stream termination, the change prevents a possibility of invalid memory access in interrupt

[PATCH 4/7] usb: gadget: u_audio: remove caching of stream buffer parameters

2018-06-21 Thread Eugeniu Rosca
From: Vladimir Zapolskiy There is no necessity to copy PCM stream ring buffer area and size properties to UAC private data structure, these values can be got from substream itself. The change gives more control on substream and avoid stale caching. Fixes: 132fcb460839 ("usb: gadget: Add Audio

Re: [PATCH] Bluetooth: btusb: use irqsave() in URB's complete callback

2018-06-21 Thread Alan Stern
On Thu, 21 Jun 2018, Sebastian Andrzej Siewior wrote: > On 2018-06-21 14:43:41 [+0200], Marcel Holtmann wrote: > > Hi Sebastian, > Hi Marcel, > > > > The USB completion callback does not disable interrupts while acquiring > > > the ->lock. We want to remove the local_irq_disable() invocation

Re: usb: gadget: ffs: Fix BUG when userland exits with submitted AIO transfers

2018-06-21 Thread Alan Stern
On Thu, 21 Jun 2018, Roger Quadros wrote: > >> Can we avoid the spin_lock() and the work-queue and call usb_ep_dequeue() > >> directly from here? > >>> What is the purpose of the spin_lock()? > > > > I agree that the lock doesn't seem to be necessary. But I believe the whole > > thing is

[PATCH 3/7] usb: gadget: u_audio: update hw_ptr in iso_complete after data copied

2018-06-21 Thread Eugeniu Rosca
From: Joshua Frkuska In u_audio_iso_complete, the runtime hw_ptr is updated before the data is actually copied over to/from the buffer/dma area. When ALSA uses this hw_ptr, the data may not actually be available to be used. This causes trash/stale audio to play/record. This patch updates the

[PATCH 2/7] usb: gadget: u_audio: fix pcm/card naming in g_audio_setup()

2018-06-21 Thread Eugeniu Rosca
Fix below smatch (v0.5.0-4443-g69e9094e11c1) warnings: drivers/usb/gadget/function/u_audio.c:607 g_audio_setup() warn: strcpy() 'pcm_name' of unknown size might be too large for 'pcm->name' drivers/usb/gadget/function/u_audio.c:614 g_audio_setup() warn: strcpy() 'card_name' of unknown size might

[PATCH 0/7] Fix issues in UAC2 gadget driver

2018-06-21 Thread Eugeniu Rosca
Hello Felipe and linux-usb community, This is a collection of UAC fixes, some of which have been written back in 2016 on top of v3.14. v4.13-rc1 commit eb9fecb9e69b ("usb: gadget: f_uac2: split out audio core") made forward-porting of these patches to recent kernels quite painful and

[PATCH 1/7] usb: gadget: f_uac2: fix error handling in afunc_bind (again)

2018-06-21 Thread Eugeniu Rosca
If usb_ep_autoconfig() fails (i.e. returns a null endpoint descriptor), we expect afunc_bind() to fail (i.e. return a negative error code). However, due to v4.10-rc1 commit f1d3861d63a5 ("usb: gadget: f_uac2: fix error handling at afunc_bind"), afunc_bind() returns zero, telling the caller that

Re: make a confirm for [usb: dwc3: gadget: skip Set/Clear Halt when invalid]

2018-06-21 Thread Alan Stern
On Thu, 21 Jun 2018, Felipe Balbi wrote: > > Hi, > > that patch is not 100% correct. You can revert it in your tree. I added > that because of a problem I found when running adb against macOS. > > It's actually okay to send Clear Halt at any time, but for some reason > dwc3 was hanging when

Re: [PATCH] usb: dwc3: of-simple: fix use-after-free on remove

2018-06-21 Thread Alan Stern
On Thu, 21 Jun 2018, Roger Quadros wrote: > >>> probe() > >>> pm_runtime_forbid() 1 > > Can you call pm_runtime_forbid() before pm_runtime_enable()? > Wouldn't it fail with -EACCES as dev->power.disable_depth > 0? Look, there has been a lot of confusion in this email thread.

[PATCH 3/3] usb: typec: ucsi: Fix for incorrect status data issue

2018-06-21 Thread Heikki Krogerus
According to UCSI Specification, Connector Change Event only means a change in the Connector Status and Operation Mode fields of the STATUS data structure. So any other change should create another event. Unfortunately on some platforms the firmware acting as PPM (platform policy manager -

[PATCH 2/3] usb: typec: ucsi: acpi: Workaround for cache mode issue

2018-06-21 Thread Heikki Krogerus
This fixes an issue where the driver fails with an error: ioremap error for 0x3f799000-0x3f79a000, requested 0x2, got 0x0 On some platforms the UCSI ACPI mailbox SystemMemory Operation Region may be setup before the driver has been loaded. That will lead into the driver failing to map

[PATCH 0/3] usb: typec: fixes for UCSI issues

2018-06-21 Thread Heikki Krogerus
Hi, The two first patches provide a workaround for the issue that Paul reported [1], where the driver fails with error: ioremap error for 0x3f799000-0x3f79a000, requested 0x2, got 0x0 [1] https://lkml.org/lkml/2018/5/15/569 Heikki Krogerus (3): acpi: Add helper for deactivating

[PATCH 1/3] acpi: Add helper for deactivating memory region

2018-06-21 Thread Heikki Krogerus
Sometimes memory resource may be overlapping with SystemMemory Operation Region by design, for example if the memory region is used as a mailbox for communication with a firmware in the system. One occasion of such mailboxes is USB Type-C Connector System Software Interface (UCSI). With regions

[PATCH 1/5] xhci: Fix perceived dead host due to runtime suspend race with event handler

2018-06-21 Thread Mathias Nyman
Don't rely on event interrupt (EINT) bit alone to detect pending port change in resume. If no change event is detected the host may be suspended again, oterwise roothubs are resumed. There is a lag in xHC setting EINT. If we don't notice the pending change in resume, and the controller is runtime

[PATCH 0/5] xhci fixes for usb-linus

2018-06-21 Thread Mathias Nyman
Hi Greg A few xhci fixes for usb-linus. Fixing a oops in xhci tracing, a race in S3 resume event handling, tegra runtime PM, and other small fixes. -Mathias Ajay Gupta (1): usb: xhci: increase CRS timeout value Dongjiu Geng (1): usb: xhci: remove the code build warning Mathias Nyman (1):

[PATCH 3/5] usb: xhci: remove the code build warning

2018-06-21 Thread Mathias Nyman
From: Dongjiu Geng Initialize the 'err' variate to remove the build warning, the warning is shown as below: drivers/usb/host/xhci-tegra.c: In function 'tegra_xusb_mbox_thread': drivers/usb/host/xhci-tegra.c:552:6: warning: 'err' may be used uninitialized in this function [-Wuninitialized]

[PATCH 2/5] xhci: Fix kernel oops in trace_xhci_free_virt_device

2018-06-21 Thread Mathias Nyman
From: Zhengjun Xing commit 44a182b9d177 ("xhci: Fix use-after-free in xhci_free_virt_device") set dev->udev pointer to NULL in xhci_free_dev(), it will cause kernel panic in trace_xhci_free_virt_device. This patch reimplement the trace function trace_xhci_free_virt_device, remove dev->udev

[PATCH 5/5] usb: xhci: increase CRS timeout value

2018-06-21 Thread Mathias Nyman
From: Ajay Gupta Some controllers take almost 55ms to complete controller restore state (CRS). There is no timeout limit mentioned in xhci specification so fixing the issue by increasing the timeout limit to 100ms [reformat code comment -Mathias] Signed-off-by: Ajay Gupta Signed-off-by:

[PATCH 4/5] usb: xhci: tegra: fix runtime PM error handling

2018-06-21 Thread Mathias Nyman
From: Stefan Agner The address-of operator will always evaluate to true. However, power should be explicitly disabled if no power domain is used. Remove the address-of operator. Fixes: 58c38116c6cc ("usb: xhci: tegra: Add support for managing powergates") Signed-off-by: Stefan Agner Acked-by:

Re: [PATCH] Bluetooth: btusb: use irqsave() in URB's complete callback

2018-06-21 Thread Sebastian Andrzej Siewior
On 2018-06-21 14:43:41 [+0200], Marcel Holtmann wrote: > Hi Sebastian, Hi Marcel, > > 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

Re: [PATCH] Bluetooth: btusb: use irqsave() in URB's complete callback

2018-06-21 Thread Marcel Holtmann
Hi Sebastian, > 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. >

Re: usb: gadget: ffs: Fix BUG when userland exits with submitted AIO transfers

2018-06-21 Thread Roger Quadros
On 21/06/18 13:52, Lars-Peter Clausen wrote: > On 06/21/2018 10:29 AM, Roger Quadros wrote: > [...] static int ffs_aio_cancel(struct kiocb *kiocb) { struct ffs_io_data *io_data = kiocb->private; - struct ffs_epfile *epfile = kiocb->ki_filp->private_data; +

Re: usb: gadget: ffs: Fix BUG when userland exits with submitted AIO transfers

2018-06-21 Thread Lars-Peter Clausen
On 06/21/2018 10:29 AM, Roger Quadros wrote: [...] >>> static int ffs_aio_cancel(struct kiocb *kiocb) >>> { >>> struct ffs_io_data *io_data = kiocb->private; >>> - struct ffs_epfile *epfile = kiocb->ki_filp->private_data; >>> + struct ffs_data *ffs = io_data->ffs; >>>

Re: [PATCH] usb: dwc3: of-simple: fix use-after-free on remove

2018-06-21 Thread Johan Hovold
On Thu, Jun 21, 2018 at 11:17:36AM +0300, Roger Quadros wrote: > On 21/06/18 01:55, Rafael J. Wysocki wrote: > > On Thu, Jun 21, 2018 at 12:32 AM, Rafael J. Wysocki > > wrote: > >> On Wed, Jun 20, 2018 at 5:46 PM, Johan Hovold wrote: > >>> On Wed, Jun 20, 2018 at 02:54:10PM +0200, Rafael J.

Re: [PATCH] usb: dwc3: of-simple: fix use-after-free on remove

2018-06-21 Thread Johan Hovold
On Thu, Jun 21, 2018 at 12:55:26AM +0200, Rafael J. Wysocki wrote: > On Thu, Jun 21, 2018 at 12:32 AM, Rafael J. Wysocki wrote: > > On Wed, Jun 20, 2018 at 5:46 PM, Johan Hovold wrote: > >> On Wed, Jun 20, 2018 at 02:54:10PM +0200, Rafael J. Wysocki wrote: > >>> On Wednesday, June 20, 2018

Re: make a confirm for [usb: dwc3: gadget: skip Set/Clear Halt when invalid]

2018-06-21 Thread Felipe Balbi
Hi, that patch is not 100% correct. You can revert it in your tree. I added that because of a problem I found when running adb against macOS. It's actually okay to send Clear Halt at any time, but for some reason dwc3 was hanging when running adb against macOS. If you can revert the patch and

Re: [PATCH] usb: cdc-acm: Decrement tty port's refcount if probe() fail

2018-06-21 Thread Oliver Neukum
On Do, 2018-06-21 at 17:45 +0900, Jaejoong Kim wrote: > The cdc-acm driver does not have a refcount of itself, but uses a > tty_port's refcount. That is, if the refcount of tty_port is '0', we > can clean up the cdc-acm driver by calling the .destruct() > callback function of struct

Re: [PATCH] usb: cdc-acm: Decrement tty port's refcount if probe() fail

2018-06-21 Thread Oliver Neukum
On Do, 2018-06-21 at 17:45 +0900, Jaejoong Kim wrote: > The cdc-acm driver does not have a refcount of itself, but uses a > tty_port's refcount. That is, if the refcount of tty_port is '0', we > can clean up the cdc-acm driver by calling the .destruct() > callback function of struct

[PATCH] usb: cdc-acm: Decrement tty port's refcount if probe() fail

2018-06-21 Thread Jaejoong Kim
The cdc-acm driver does not have a refcount of itself, but uses a tty_port's refcount. That is, if the refcount of tty_port is '0', we can clean up the cdc-acm driver by calling the .destruct() callback function of struct tty_port_operations. The problem is the destruct() callback function is not

Re: usb: gadget: ffs: Fix BUG when userland exits with submitted AIO transfers

2018-06-21 Thread Roger Quadros
+Lars-Peter Vincent, On 14/06/18 16:23, Sam Protsenko wrote: > + Roger Quadros > + Praneeth Bajjuri > > Tested-by: Sam Protsenko > > I've tested it on X15 board (DWC3 controller) on Android master, by > doing "adb root". Without this patch I see backtrace and kernel panic > (the same error as

Re: [PATCH] usb: dwc3: of-simple: fix use-after-free on remove

2018-06-21 Thread Johan Hovold
On Thu, Jun 21, 2018 at 12:32:59AM +0200, Rafael J. Wysocki wrote: > On Wed, Jun 20, 2018 at 5:46 PM, Johan Hovold wrote: > > On Wed, Jun 20, 2018 at 02:54:10PM +0200, Rafael J. Wysocki wrote: > >> On Wednesday, June 20, 2018 2:23:46 PM CEST Johan Hovold wrote: > >> > On Wed, Jun 20, 2018 at

Re: [PATCH] usb: dwc3: of-simple: fix use-after-free on remove

2018-06-21 Thread Roger Quadros
On 21/06/18 01:55, Rafael J. Wysocki wrote: > On Thu, Jun 21, 2018 at 12:32 AM, Rafael J. Wysocki wrote: >> On Wed, Jun 20, 2018 at 5:46 PM, Johan Hovold wrote: >>> On Wed, Jun 20, 2018 at 02:54:10PM +0200, Rafael J. Wysocki wrote: On Wednesday, June 20, 2018 2:23:46 PM CEST Johan Hovold

RE: UAC2 gadget not recognized on Windows 10

2018-06-21 Thread Felipe Balbi
Hi, Robert Bielik writes: >> Enabling SOF interrupts will be a big pain :-) Well, enabling the >> interrupt itself is a no-brainer, but it'll cause terrible CPU overload. > > Oh, I see. Hmm... would it be possible to allow upper levels to config > this dynamically ? I.e. for the ALSA subsystem