Re: [PATCH v2] usb/xhci: fix compilation warning when !CONFIG_PCI && !CONFIG_PM

2014-02-18 Thread David Cohen
On Tue, Feb 18, 2014 at 12:47:41PM -0600, Felipe Balbi wrote: > On Tue, Feb 18, 2014 at 10:00:30AM -0800, David Cohen wrote: > > Hi Sarah, > > > > On Mon, Jan 06, 2014 at 07:02:19PM -0800, David Cohen wrote: > > > When CONFIG_PCI and CONFIG_PM are not selected,

Re: [PATCH v2] usb/xhci: fix compilation warning when !CONFIG_PCI && !CONFIG_PM

2014-02-18 Thread David Cohen
Hi Sarah, On Mon, Jan 06, 2014 at 07:02:19PM -0800, David Cohen wrote: > When CONFIG_PCI and CONFIG_PM are not selected, xhci.c gets this > warning: > drivers/usb/host/xhci.c:409:13: warning: ‘xhci_msix_sync_irqs’ defined > but not used [-Wunused-function] > > It happ

Re: [RFC/PATCH 1/3] pm: make PM macros more smart

2014-01-22 Thread David Cohen
On Tue, Jan 14, 2014 at 02:42:11PM -0800, David Cohen wrote: > On Fri, Dec 20, 2013 at 12:23:36PM -0800, David Cohen wrote: > > On Fri, Dec 20, 2013 at 08:55:27PM +0100, Pavel Machek wrote: > > > On Sun 2013-12-15 11:25:08, David Cohen wrote: > > > > On Sun, Dec 15, 2

Re: [PATCH 06/10] usb: chipidea: OTG fsm timers initialization.

2014-01-16 Thread David Cohen
ous patch. > [Li Jun] You are right, I will re-split my patch set to resolve this, thanks! It's difficult to read the e-mails you reply. Please, consider to quote the text messages you're replying to. Br, David Cohen -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [RFC/PATCH 1/3] pm: make PM macros more smart

2014-01-14 Thread David Cohen
On Fri, Dec 20, 2013 at 12:23:36PM -0800, David Cohen wrote: > On Fri, Dec 20, 2013 at 08:55:27PM +0100, Pavel Machek wrote: > > On Sun 2013-12-15 11:25:08, David Cohen wrote: > > > On Sun, Dec 15, 2013 at 06:51:12PM +0100, Pavel Machek wrote: > > > > On Thu 2013-12-

Re: [PATCH v2] xhci: Allocate the td array and urb_priv together.

2014-01-08 Thread 'David Cohen'
On Wed, Jan 08, 2014 at 03:29:31PM +, David Laight wrote: > > From: 'David Cohen' > ... > > I actually don't know what's the regular range of 'td_cnt'. But what got my > > attention was this comment from patch description: > > > &g

Re: [RFC/PATCH] usb/xhci: avoid kernel panic on xhci_suspend()

2014-01-08 Thread David Cohen
On Wed, Jan 08, 2014 at 10:48:06AM -0500, Alan Stern wrote: > On Tue, 7 Jan 2014, Greg KH wrote: > > > On Tue, Jan 07, 2014 at 05:44:26PM -0800, David Cohen wrote: > > > From: jianqian > > > > > > There is a possible kernel panic faced on xhci_suspend(

Re: [PATCH v2] xhci: Allocate the td array and urb_priv together.

2014-01-08 Thread 'David Cohen'
On Wed, Jan 08, 2014 at 09:25:42AM +, David Laight wrote: > > From: 'David Cohen' > ... > > > > The new kmalloc is going to be "n * sizeof(struct) - n * > > > > sizeof(pointer)" > > > > bigger. I don't know what is the

Re: [RFC/PATCH] usb/xhci: avoid kernel panic on xhci_suspend()

2014-01-07 Thread David Cohen
m with 1 usb3 host controller + 1 usb3 OTG controller (Jianqiang, please correct me if I'm wrong). How common is this configuration out there? Br, David Cohen > > >This causes race condition during XHCI driver initialization, > > > > After USB2 hcd and USB2 r

[RFC/PATCH] usb/xhci: avoid kernel panic on xhci_suspend()

2014-01-07 Thread David Cohen
is still doing initialization, it is possible to face null pointer kernel panic in xhci_suspend() function. This patch checks if xhci->shared_hcd is null to avoid panic. Signed-off-by: jianqian Signed-off-by: David Cohen --- This is the kernel panic. The bug was discovered on current LTS kerne

Re: [PATCH v2] xhci: Allocate the td array and urb_priv together.

2014-01-07 Thread 'David Cohen'
On Tue, Jan 07, 2014 at 09:29:30AM +, David Laight wrote: > > From: 'David Cohen' > > On Mon, Jan 06, 2014 at 09:26:20AM +, David Laight wrote: > > > > From: David Cohen > > > > On Fri, Dec 20, 2013 at 09:26:35AM -0000, David Laight wrote: >

Re: [PATCH v2] xhci: Allocate the td array and urb_priv together.

2014-01-06 Thread 'David Cohen'
On Mon, Jan 06, 2014 at 09:26:20AM +, David Laight wrote: > > From: David Cohen > > On Fri, Dec 20, 2013 at 09:26:35AM -, David Laight wrote: > > > > From: David Cohen > > > The effect of this change is really to remove the first allocation and > > &g

[PATCH v2] usb/xhci: fix compilation warning when !CONFIG_PCI && !CONFIG_PM

2014-01-06 Thread David Cohen
: David Cohen --- Change v1 -> v2: - xhci_msix_sync_irqs() already uses __maybe_unused flag when CONFIG_PCI is set. Proper solution is to add same flag when !CONFIG_PCI instead of define function as inline. drivers/usb/host/xhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) d

[PATCH] usb/xhci: fix compilation warning when !CONFIG_PCI && !CONFIG_PM

2014-01-06 Thread David Cohen
When CONFIG_PCI and CONFIG_PM are not selected, xhci.c gets this warning: drivers/usb/host/xhci.c:409:13: warning: ‘xhci_msix_sync_irqs’ defined but not used [-Wunused-function] Instead of creating nested #ifdefs, this patch fixes it by defining the xHCI PCI stubs as inline. Signed-off-by: David

Re: [PATCH net-next] r8152: fix the wrong return value

2014-01-02 Thread David Cohen
On Fri, Jan 03, 2014 at 11:21:56AM +0800, Hayes Wang wrote: > The return value should be the boolean value, not the error code. > > Signed-off-by: Hayes Wang > Spotted-by: Dan Carpenter > --- > drivers/net/usb/r8152.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/dri

Re: [RFC/PATCH 1/3] pm: make PM macros more smart

2013-12-20 Thread David Cohen
On Fri, Dec 20, 2013 at 08:55:27PM +0100, Pavel Machek wrote: > On Sun 2013-12-15 11:25:08, David Cohen wrote: > > On Sun, Dec 15, 2013 at 06:51:12PM +0100, Pavel Machek wrote: > > > On Thu 2013-12-12 21:18:23, David Cohen wrote: > > > > This patch makes

Re: [PATCH] uwb: move mutex_lock to error case in uwbd_evt_handle_rc_bp_slot_change

2013-12-20 Thread David Cohen
; It could be just nitpicking, but I think it's a waste of resource to unnecessarily print to console while holding a lock. If you move this dev_err() to after mutex_unlock() you'd achieve the same result with a cheaper lock. > rc->beaconing = -1; A

Re: [PATCH v2] xhci: Allocate the td array and urb_priv together.

2013-12-20 Thread David Cohen
On Fri, Dec 20, 2013 at 09:26:35AM -, David Laight wrote: > > From: David Cohen > > On Wed, Dec 18, 2013 at 11:24:47AM -, David Laight wrote: > > > This saves a kzalloc() call on every transfer and some memory > > > indirections. > > > > > &g

Re: [PATCH] phy: core: properly handle failure of pm_runtime_get functions

2013-12-19 Thread David Cohen
On Fri, Dec 20, 2013 at 11:29:04AM +0530, Kishon Vijay Abraham I wrote: > Hi Felipe, > > On Friday 13 December 2013 12:01 AM, Felipe Balbi wrote: > > In case pm_runtime_get*() fails, it still > > increments pm usage counter, so we *must* > > make sure to pm_runtime_put() even in those > > cases. >

Re: [PATCH v2] xhci: Allocate the td array and urb_priv together.

2013-12-19 Thread David Cohen
> an additional page. If you take this to embedded world there could be a bad side effect too. The free memory isn't abundant and the fragmentation may make a bigger kmalloc() to cost more than 2 smaller ones. Br, David Cohen > > Signed-off-by: David Laight > --- > > v2:

Re: [RFC/PATCH 0/3] pm: Make SET_*_PM_OPS() macros more smart

2013-12-18 Thread David Cohen
On Thu, Dec 12, 2013 at 09:18:22PM -0800, David Cohen wrote: > Hi, > > These patches are proposal to extend the lack of #ifdef checks on PM callback > to its implementation too. > > Currently SET_*_PM_OPS() macros make #ifdefs checks not necessary when setting > the callba

Re: [PATCH 0/7] usb: dwc3: pm_runtime implementation

2013-12-17 Thread David Cohen
On Tue, Dec 17, 2013 at 03:31:40PM -0800, David Cohen wrote: > On Thu, Dec 12, 2013 at 03:38:38PM -0600, Felipe Balbi wrote: > > hi all, > > > > these patches add pm_runtime support for all glue layers. > > > > I plan to add pm_runtime support for dwc3 after thes

Re: [PATCH 0/7] usb: dwc3: pm_runtime implementation

2013-12-17 Thread David Cohen
notice you were removing #ifdef's around pm callback functions. Instead of saying DWC3 will start to have warnings when CONFIG_PM is not selected, I'd say your patch set is now a dependence of my RFC :) https://lkml.org/lkml/2013/12/13/4 Br, David Cohen > > Felipe Balbi (7): >

Re: [PATCH V3] usb: musb: Fix unstable init of OTG_INTERFSEL.

2013-12-17 Thread David Cohen
ue->initialized) Are you sure this is thread safe? If you're sending this patch it means runtime_resume can be called before omap2430_must_init(), but how about at the same time? You defined 'initialized' as u8 type, then read/write operations won't be atomic in ARM. Br,

Re: [RFC/PATCH 1/3] pm: make PM macros more smart

2013-12-15 Thread David Cohen
On Sun, Dec 15, 2013 at 06:51:12PM +0100, Pavel Machek wrote: > On Thu 2013-12-12 21:18:23, David Cohen wrote: > > This patch makes SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() more > > smart. > > > > Despite those macros check for '#ifdef CONFIG_PM_SLEEP/R

Re: [PATCH] usb: host: xhci: Move suspend ops under PM_SLEEP to avoid warning

2013-12-13 Thread David Cohen
On Fri, Dec 13, 2013 at 05:55:20PM -0500, Santosh Shilimkar wrote: > On Friday 13 December 2013 12:23 AM, David Cohen wrote: > > On Thu, Dec 12, 2013 at 07:25:55PM -0800, David Cohen wrote: > >> On Thu, Dec 12, 2013 at 09:01:04PM -0500, Santosh Shilimkar wrote: > >>>

Re: [PATCH] USB: core: Add warm reset while reset-resuming SuperSpeed HUBs

2013-12-13 Thread David Cohen
On Fri, Dec 13, 2013 at 10:00:28AM -0800, David Cohen wrote: > Hi Sarah, > > On Fri, Dec 13, 2013 at 09:48:15AM -0800, Sarah Sharp wrote: > > On Thu, Dec 12, 2013 at 11:05:04AM -0500, Alan Stern wrote: > > > On Wed, 11 Dec 2013, Julius Werner wrote: > > > >

Re: [PATCH] USB: core: Add warm reset while reset-resuming SuperSpeed HUBs

2013-12-13 Thread David Cohen
Hi Sarah, On Fri, Dec 13, 2013 at 09:48:15AM -0800, Sarah Sharp wrote: > On Thu, Dec 12, 2013 at 11:05:04AM -0500, Alan Stern wrote: > > On Wed, 11 Dec 2013, Julius Werner wrote: > > > > > >> ...although, the spec says that it does not wait for the port resets > > > >> to complete. As far as I c

Re: [RFC/PATCH 3/3] usb/xhci-plat: remove unnecessary #ifdef checks for CONFIG_PM_SLEEP

2013-12-13 Thread David Cohen
On Fri, Dec 13, 2013 at 09:19:34AM +0100, Ulf Hansson wrote: > On 13 December 2013 06:18, David Cohen wrote: > > From: Santosh Shilimkar > > > > Drivers using SET_*_PM_OPS() no longer need to #ifdef for CONFIG_PM_* > > So, let's remove the unnecessary #ifdef&#

Re: [PATCH] usb: host: xhci: Move suspend ops under PM_SLEEP to avoid warning

2013-12-12 Thread David Cohen
On Thu, Dec 12, 2013 at 07:25:55PM -0800, David Cohen wrote: > On Thu, Dec 12, 2013 at 09:01:04PM -0500, Santosh Shilimkar wrote: > > On Thursday 12 December 2013 08:51 PM, David Cohen wrote: > > > On Thu, Dec 12, 2013 at 08:06:24PM -0500, Santosh Shilimkar wrote: > > &g

[RFC/PATCH 0/3] pm: Make SET_*_PM_OPS() macros more smart

2013-12-12 Thread David Cohen
stead of fixing the #ifdefs, we remove the need for it :) Br, David Cohen --- David Cohen (2): pm: make PM macros more smart usb/xhci: implement proper static inline stubs when !CONFIG_PM Santosh Shilimkar (1): usb/xhci-plat: remove unnecessary #ifdef checks for CONFIG_PM_SLEEP drivers/usb

[RFC/PATCH 1/3] pm: make PM macros more smart

2013-12-12 Thread David Cohen
implementing them. With this patch, drivers using SET_*_PM_OPS() macros don't need to #ifdef the callbacks implementation as well. Signed-off-by: David Cohen --- include/linux/pm.h | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/include/linux/pm.h b/in

[RFC/PATCH 2/3] usb/xhci: implement proper static inline stubs when !CONFIG_PM

2013-12-12 Thread David Cohen
: David Cohen --- drivers/usb/host/xhci.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 941d5f59e4dc..6a5e7a98de7e 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1771,8 +1771,10 @@ int

[RFC/PATCH 3/3] usb/xhci-plat: remove unnecessary #ifdef checks for CONFIG_PM_SLEEP

2013-12-12 Thread David Cohen
From: Santosh Shilimkar Drivers using SET_*_PM_OPS() no longer need to #ifdef for CONFIG_PM_* So, let's remove the unnecessary #ifdef's. Signed-off-by: Santosh Shilimkar Signed-off-by: David Cohen --- drivers/usb/host/xhci-plat.c | 7 +-- 1 file changed, 1 insertion(+), 6

Re: [PATCH 3/7] usb: dwc3: pci: add pm_runtime support

2013-12-12 Thread David Cohen
On Thu, Dec 12, 2013 at 10:17:19PM -0600, Felipe Balbi wrote: > On Thu, Dec 12, 2013 at 05:56:05PM -0800, David Cohen wrote: > > On Thu, Dec 12, 2013 at 03:38:41PM -0600, Felipe Balbi wrote: > > > teach the PCI glue about pm_runtime so that > > > it's easier to teac

Re: [PATCH] usb: host: xhci: Move suspend ops under PM_SLEEP to avoid warning

2013-12-12 Thread David Cohen
On Thu, Dec 12, 2013 at 09:01:04PM -0500, Santosh Shilimkar wrote: > On Thursday 12 December 2013 08:51 PM, David Cohen wrote: > > On Thu, Dec 12, 2013 at 08:06:24PM -0500, Santosh Shilimkar wrote: > >> Otherwise you get below build warnings > >> > >> drivers/

Re: [PATCH 3/7] usb: dwc3: pci: add pm_runtime support

2013-12-12 Thread David Cohen
On Thu, Dec 12, 2013 at 03:38:41PM -0600, Felipe Balbi wrote: > teach the PCI glue about pm_runtime so that > it's easier to teach dwc3 core about it > later. > > No functional changes otherwise. > > Signed-off-by: Felipe Balbi I was able to test this one with Intel M

Re: [PATCH] usb: host: xhci: Move suspend ops under PM_SLEEP to avoid warning

2013-12-12 Thread David Cohen
truct usb_hcd *hcd = dev_get_drvdata(dev); > @@ -220,7 +220,7 @@ static const struct dev_pm_ops xhci_plat_pm_ops = { > #define DEV_PM_OPS (&xhci_plat_pm_ops) > #else > #define DEV_PM_OPS NULL > -#endif /* CONFIG_PM */ > +#endif /* CONFIG_PM_SLEEP */ Ditto. Br, David Cohen >

Re: [PATCH] usb: musb: omap2430: fix occasional musb breakage on boot

2013-12-11 Thread David Cohen
On Thu, Dec 12, 2013 at 02:20:59AM +0200, Grazvydas Ignotas wrote: > This is a hard to reproduce problem which leads to non-functional > USB-OTG port in 0.1%-1% of all boots. Tracked it down to commit > e25bec160158abe86c "omap2+: save and restore OTG_INTERFSEL", > which introduces save/restore of

Re: [PATCH v7 2/5] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-12-10 Thread David Cohen
/** + * usb_ep_align_maybe - returns @len aligned to ep's maxpacketsize if gadget + *requires quirk_ep_out_aligned_size, otherwise reguens len. >>> >>> “returns” >> >> I've got no idea how returns became reguens :) >> But maybe Felipe can fix it when applying? > > Sur

Re: [PATCH v7 2/5] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-12-10 Thread David Cohen
On 12/10/2013 07:01 AM, Michal Nazarewicz wrote: > On Tue, Dec 10 2013, David Cohen wrote: >> I've got no idea how returns became reguens :) > > The keys are like right next to each other <http://bash.org/?5300>. ;) I'll remember this excuse if I need some day :)

Re: [PATCH v7 2/5] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-12-09 Thread David Cohen
On 12/09/2013 06:34 PM, Michal Nazarewicz wrote: > dOn Tue, Dec 10 2013, David Cohen wrote: >> Due to USB controllers may have different restrictions, usb gadget layer >> needs to provide a generic way to inform gadget functions to complain >> with non-standard requirements.

[PATCH v7 3/5] usb: gadget: f_fs: remove loop from I/O function

2013-12-09 Thread David Cohen
From: Michal Nazarewicz When endpoint changes (due to it being disabled or alt setting changed), mimic the action as if the change happened after the request has been queued, instead of retrying with the new endpoint. Signed-off-by: Michal Nazarewicz Cc: David Cohen --- drivers/usb/gadget

[PATCH v7 2/5] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-12-09 Thread David Cohen
requires buffer size to be aligned to MaxPacketSize. A helper is also provided to align buffer size when necessary. Signed-off-by: David Cohen Cc: Alan Stern Cc: Michal Nazarewicz --- include/linux/usb/gadget.h | 20 1 file changed, 20 insertions(+) diff --git a/include/lin

[PATCH v7 0/5] add gadget quirk to adapt f_fs for DWC3

2013-12-09 Thread David Cohen
g compilation warning: $ drivers/usb/gadget/f_fs.c: In function 'ffs_epfile_io': $ drivers/usb/gadget/f_fs.c:857:124: warning: comparison of distinct pointer types lacks a cast [enabled by default] --- David Cohen (3): usb: gadget: move bitflags to the end of usb_gadget st

[PATCH v7 1/5] usb: gadget: move bitflags to the end of usb_gadget struct

2013-12-09 Thread David Cohen
This patch moves all bitflags to the end of usb_gadget struct in order to improve readability. Signed-off-by: David Cohen Acked-by: Michal Nazarewicz --- include/linux/usb/gadget.h | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/include/linux/usb

[PATCH v7 5/5] usb: dwc3: set gadget's quirk ep_out_align_size

2013-12-09 Thread David Cohen
DWC3 requires epout to have buffer size aligned to MaxPacketSize value. This patch sets necessary quirk for it. Signed-off-by: David Cohen --- drivers/usb/dwc3/gadget.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index

[PATCH v7 4/5] usb: f_fs: check quirk to pad epout buf size when not aligned to maxpacketsize

2013-12-09 Thread David Cohen
From: Michal Nazarewicz Check gadget.quirk_ep_out_aligned_size to decide if buffer size requires to be aligned to maxpacketsize of an out endpoint. ffs_epfile_io() needs to pad epout buffer to match above condition if quirk is found. Signed-off-by: Michal Nazarewicz Signed-off-by: David Cohen

Re: [PATCH v5 2/5] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-12-06 Thread David Cohen
On 12/06/2013 12:13 PM, Felipe Balbi wrote: > On Tue, Nov 12, 2013 at 01:54:28PM +0100, Michal Nazarewicz wrote: >> On Tue, Nov 12 2013, David Cohen wrote: >>> On 11/11/2013 03:55 PM, Michal Nazarewicz wrote: >>>> Come to think of it, perhaps even better helper wou

Re: [PATCH v6 5/5] usb: dwc3: implement gadget's quirk ep_out_align_size

2013-12-03 Thread David Cohen
r directions. Probably you want the v5 I sent (disregarding the v5.1 4/5 amend): http://marc.info/?l=linux-usb&m=138420082526804&w=2 Br, David Cohen signature.asc Description: OpenPGP digital signature

Re: [PATCH v6 5/5] usb: dwc3: implement gadget's quirk ep_out_align_size

2013-12-02 Thread David Cohen
On 11/25/2013 01:06 PM, Felipe Balbi wrote: > Hi, > > On Tue, Nov 12, 2013 at 01:04:46PM -0800, David Cohen wrote: >> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c >> index 5452c0fce360..7c2d36f6ad4b 100644 >> --- a/drivers/usb/dwc3/gadget.c >>

Re: [PATCHv2 2/2] check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-13 Thread David Cohen
On 11/13/2013 07:52 AM, Alan Stern wrote: On Tue, 12 Nov 2013, Paul Zimmerman wrote: @@ -824,7 +832,7 @@ static ssize_t ffs_epfile_io(struct file *file, req->context = &done; req->complete = ffs_epfile_io_complete; req->buf = data; -

Re: [PATCHv2 2/2] check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-12 Thread David Cohen
Hi Paul, On 11/12/2013 03:09 PM, Paul Zimmerman wrote: From: linux-usb-ow...@vger.kernel.org [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Alan Stern Sent: Tuesday, November 12, 2013 7:51 AM On Mon, 11 Nov 2013, David Cohen wrote: Hi Alan, Michal, On 11/11/2013 01:09 PM, Michal

[PATCH v6 5/5] usb: dwc3: implement gadget's quirk ep_out_align_size

2013-11-12 Thread David Cohen
DWC3 requires epout to have buffer size aligned to MaxPacketSize value. This patch implements necessary quirk for it. Signed-off-by: David Cohen --- drivers/usb/dwc3/core.h | 6 ++ drivers/usb/dwc3/gadget.c | 23 +++ 2 files changed, 29 insertions(+) diff --git a

Re: [PATCH v6 0/5] add gadget quirk to adapt f_fs for DWC3

2013-11-12 Thread David Cohen
On 11/12/2013 01:04 PM, David Cohen wrote: Hi, These patches are a proposal to add gadget quirks in an immediate objective to adapt f_fs when using DWC3 controller. But the quirk solution is generic and can be used by other controllers to adapt gadget functions to their non-standard

[PATCH v6 3/5] usb: gadget: f_fs: remove loop from I/O function

2013-11-12 Thread David Cohen
From: Michal Nazarewicz When endpoint changes (due to it being disabled or alt setting changed), mimic the action as if the change happened after the request has been queued, instead of retrying with the new endpoint. Signed-off-by: Michal Nazarewicz Cc: David Cohen --- drivers/usb/gadget

[PATCH v6 4/5] check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-12 Thread David Cohen
From: Michal Nazarewicz Check gadget.quirk_ep_out_aligned_size to decide if buffer size requires to be aligned to maxpacketsize of an out endpoint. ffs_epfile_io() needs to pad epout buffer to match above condition if quirk is found. Signed-off-by: Michal Nazarewicz Acked-by: David Cohen

[PATCH v6 1/5] usb: gadget: move bitflags to the end of usb_gadget struct

2013-11-12 Thread David Cohen
This patch moves all bitflags to the end of usb_gadget struct in order to improve readability. Signed-off-by: David Cohen Acked-by: Michal Nazarewicz --- include/linux/usb/gadget.h | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/include/linux/usb

[PATCH v6 2/5] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-11-12 Thread David Cohen
requires buffer size to be aligned to MaxPacketSize. A helper is also provided to align buffer size when necessary. Signed-off-by: David Cohen Acked-by: Alan Stern Acked-by: Michal Nazarewicz --- include/linux/usb/gadget.h | 16 1 file changed, 16 insertions(+) diff --git a/in

[PATCH v6 0/5] add gadget quirk to adapt f_fs for DWC3

2013-11-12 Thread David Cohen
rom Michal Nazarewicz to address comments from Alan Stern and mine. - Modified patch 5/5 to apply request->length's pad internally to DWC3. --- David Cohen (3): usb: gadget: move bitflags to the end of usb_gadget struct usb: gadget: add quirk_ep_out_aligned_size field to struct usb_

Re: [PATCHv5.1 4/5] check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-12 Thread David Cohen
On 11/12/2013 04:59 AM, Michal Nazarewicz wrote: > On Tue, Nov 12 2013, David Cohen wrote: >> You need to update req->length otherwise it's going to crash DWC3. >> I'd rather to keep your previous version. > > That's unfortunate. Do you want me to resend

Re: [PATCHv2 2/2] check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-12 Thread David Cohen
IIUC, req->length should still be set to len, not to data_len. >> >> I misunderstood the first time I read it: >> In order to avoid DWC3 to stall, we need to update req->length (this is >> the most important fix). kmalloc() is updated too to prevent USB >> controller to overflow buffer boundar

Re: [PATCHv5.1 4/5] check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-11 Thread David Cohen
Nazarewicz --- drivers/usb/gadget/f_fs.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) On Tue, Nov 12 2013, David Cohen wrote: One curiosity here. This patch prints the following warning: In file included from (...)/drivers/usb/gadget/g_ffs.c:55:0: (...)/drivers/usb/gadget

Re: [PATCH v5 2/5] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-11-11 Thread David Cohen
On 11/11/2013 03:55 PM, Michal Nazarewicz wrote: On Mon, Nov 11 2013, David Cohen wrote: Due to USB controllers may have different restrictions, usb gadget layer needs to provide a generic way to inform gadget functions to complain with non-standard requirements. This patch adds

Re: [PATCH v5 3/5] usb: gadget: f_fs: remove loop from I/O function

2013-11-11 Thread David Cohen
On 11/11/2013 12:16 PM, David Cohen wrote: From: Michal Nazarewicz When endpoint changes (due to it being disabled or alt setting changed), mimic the action as if the change happened after the request has been queued, instead of retrying with the new endpoint. Signed-off-by: Michal Nazarewicz

Re: [PATCHv2 2/2] check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-11 Thread David Cohen
>ep, len) : len; + data = kmalloc(len, GFP_KERNEL); On Mon, Nov 11 2013, David Cohen wrote: Shouldn't this kmalloc() allocate 'data_len' bytes, instead of 'len'? Yes, of coures. diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index e496b72..fd7

Re: [PATCH 1/2] usb: gadget: f_fs: remove loop from I/O function

2013-11-11 Thread David Cohen
Hi Michal, On 11/10/2013 08:50 AM, Michal Nazarewicz wrote: From: Michal Nazarewicz When endpoint changes (due to it being disabled or alt setting changed), mimic the action as if the change happened after the request has been queued, instead of retrying with the new endpoint. Signed-off-by:

Re: [PATCHv2 2/2] check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-11 Thread David Cohen
kes more sense then my understanding of the quirk. The main reason of this quirk it to prevent DWC3 to stall or to overflow buffer after usb_ep_queue() above. Since req->length has to be updated, I disagree with Alan in this case and give my ack to this Michal's approach. Br, David Cohen

[PATCH v5 0/5] add gadget quirk to adapt f_fs for DWC3

2013-11-11 Thread David Cohen
rom Michal Nazarewicz to address comments from Alan Stern on f_fs driver. --- David Cohen (3): usb: gadget: move bitflags to the end of usb_gadget struct usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget usb: dwc3: set gadget's quirk ep_out_align_size Michal Nazare

[PATCH v5 2/5] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-11-11 Thread David Cohen
requires buffer size to be aligned to MaxPacketSize. A helper is also provided to align buffer size when necessary. Signed-off-by: David Cohen Acked-by: Alan Stern --- Michal, I added prefix 'usb: f_fs: ' to patch's subject. I did not add 'usb: gadget: f_fs' due to it

[PATCH v5 3/5] usb: gadget: f_fs: remove loop from I/O function

2013-11-11 Thread David Cohen
From: Michal Nazarewicz When endpoint changes (due to it being disabled or alt setting changed), mimic the action as if the change happened after the request has been queued, instead of retrying with the new endpoint. Signed-off-by: Michal Nazarewicz Cc: David Cohen --- drivers/usb/gadget

[PATCH v5 4/5] usb: f_fs: check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-11 Thread David Cohen
From: Michal Nazarewicz Check gadget.quirk_ep_out_aligned_size to decide if buffer size requires to be aligned to maxpacketsize of an out endpoint. ffs_epfile_io() needs to pad epout buffer to match above condition if quirk is found. Signed-off-by: Michal Nazarewicz Acked-by: David Cohen

[PATCH v5 5/5] usb: dwc3: set gadget's quirk ep_out_align_size

2013-11-11 Thread David Cohen
DWC3 requires epout to have buffer size aligned to MaxPacketSize value. This patch sets necessary quirk for it. Signed-off-by: David Cohen --- drivers/usb/dwc3/gadget.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index

[PATCH v5 1/5] usb: gadget: move bitflags to the end of usb_gadget struct

2013-11-11 Thread David Cohen
This patch moves all bitflags to the end of usb_gadget struct in order to improve readability. Signed-off-by: David Cohen --- include/linux/usb/gadget.h | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/include/linux/usb/gadget.h b/include/linux/usb

Re: [PATCH 1/2] usb: gadget: f_fs: remove loop from I/O function

2013-11-11 Thread David Cohen
ked Since you're just moving that line here, you may want (or not) to clean this up in a new patch for 3.13. Br, David Cohen -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCHv2 2/2] check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-11 Thread David Cohen
>ep, len) : len; + data = kmalloc(len, GFP_KERNEL); On Mon, Nov 11 2013, David Cohen wrote: Shouldn't this kmalloc() allocate 'data_len' bytes, instead of 'len'? Yes, of coures. Thanks. It looks fine. I'll test these patches now. But the whole series becam

Re: [PATCH 2/2] check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-10 Thread David Cohen
Hi Michal, On 11/10/2013 08:50 AM, Michal Nazarewicz wrote: > From: Michal Nazarewicz > > Check gadget.quirk_ep_out_aligned_size to decide if buffer size requires > to be aligned to maxpacketsize of an out endpoint. ffs_epfile_io() needs > to pad epout buffer to match above condition if quirk i

Re: [PATCH v4 3/4] usb: ffs: check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-08 Thread David Cohen
mine on top of yours. Br, David Cohen -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[PATCH v4.1 2/4] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-11-05 Thread David Cohen
requires buffer size to be aligned to MaxPacketSize. A helper is also provided to align buffer size when necessary. Signed-off-by: David Cohen --- Changes from v4 to v4.1: - Simplified usb_ep_align_maxpacketsize() macro as per Alen Stern's request include/linux/usb/gadget.h | 16

Re: [PATCH v4 2/4] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-11-05 Thread David Cohen
On 11/05/2013 10:13 AM, David Cohen wrote: On 11/05/2013 07:41 AM, Alan Stern wrote: On Tue, 5 Nov 2013, David Cohen wrote: +static inline size_t usb_ep_align_maxpacketsize(struct usb_ep *ep, size_t len) +{ + int aligned; + + if (ep->desc->bmAttributes & USB_ENDPOIN

Re: [PATCH v4 2/4] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-11-05 Thread David Cohen
On 11/05/2013 07:41 AM, Alan Stern wrote: > On Tue, 5 Nov 2013, David Cohen wrote: > >>>> +static inline size_t usb_ep_align_maxpacketsize(struct usb_ep *ep, size_t >>>> len) >>>> +{ >>>> + int aligned; >>>

Re: [PATCH v4 3/4] usb: ffs: check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-05 Thread David Cohen
Hi Alan, On 11/05/2013 07:38 AM, Alan Stern wrote: > On Tue, 5 Nov 2013, David Cohen wrote: > >>>> + /* >>>> + * Controller requires buffer size to be aligned to >>>> + * maxpacketsize of an out endpoint. >

Re: [PATCH v4 2/4] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-11-05 Thread David Cohen
On 11/05/2013 06:50 AM, Alan Stern wrote: > On Mon, 4 Nov 2013, David Cohen wrote: > >> Due to USB controllers may have different restrictions, usb gadget layer >> needs to provide a generic way to inform gadget functions to complain >> with non-standard requirement

Re: [PATCH v4 2/4] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-11-05 Thread David Cohen
On 11/05/2013 06:50 AM, Alan Stern wrote: > On Mon, 4 Nov 2013, David Cohen wrote: > >> Due to USB controllers may have different restrictions, usb gadget layer >> needs to provide a generic way to inform gadget functions to complain >> with non-standard requirement

Re: [PATCH v4 3/4] usb: ffs: check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-05 Thread David Cohen
On 11/05/2013 06:52 AM, Alan Stern wrote: > On Mon, 4 Nov 2013, David Cohen wrote: > >> Check gadget.quirk_ep_out_aligned_size to decide if buffer size requires >> to be aligned to maxpacketsize of an out endpoint. ffs_epfile_io() needs >> to pad epout buffer to match abo

[PATCH v4.1 4/4] usb: dwc3: set gadget's quirk ep_out_align_size

2013-11-04 Thread David Cohen
DWC3 requires epout to have buffer size aligned to MaxPacketSize value. This patch sets necessary quirk for it. Signed-off-by: David Cohen --- Changes from v4 to v4.1: - just updated patch's subject. No actual code changed. drivers/usb/dwc3/gadget.c | 6 ++ 1 file changed, 6 inser

[PATCH v4 0/4] add gadget quirk to adapt f_fs for DWC3

2013-11-04 Thread David Cohen
Android's adbd service to work on Intel Merrifield with f_fs instead of out-of-tree android gadget. Changes from v3 to v4: - replace u32 quirk flags by single unsigned:1 flag for ep out aligned size quirk on usb_gadget - add static inline helper to align ep out buf size --- David Cohen (4):

[PATCH v4 3/4] usb: ffs: check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-04 Thread David Cohen
Check gadget.quirk_ep_out_aligned_size to decide if buffer size requires to be aligned to maxpacketsize of an out endpoint. ffs_epfile_io() needs to pad epout buffer to match above condition if quirk is found. Signed-off-by: David Cohen --- drivers/usb/gadget/f_fs.c | 22

[PATCH v4 1/4] usb: gadget: move bitflags to the end of usb_gadget struct

2013-11-04 Thread David Cohen
This patch moves all bitflags to the end of usb_gadget struct in order to improve readability. Signed-off-by: David Cohen --- include/linux/usb/gadget.h | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/include/linux/usb/gadget.h b/include/linux/usb

[PATCH v4 4/4] usb: dwc3: add quirk USB_GADGET_QUIRK_EP_OUT_ALIGNED_SIZE to gadget driver

2013-11-04 Thread David Cohen
DWC3 requires epout to have buffer size aligned to MaxPacketSize value. This patch adds necessary quirk for it. Signed-off-by: David Cohen --- drivers/usb/dwc3/gadget.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index

[PATCH v4 2/4] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-11-04 Thread David Cohen
requires buffer size to be aligned to MaxPacketSize. A helper is also provided to align buffer size when necessary. Signed-off-by: David Cohen --- include/linux/usb/gadget.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/include/linux/usb/gadget.h b/include/linux/usb

Re: [PATCH v3 2/3] usb: ffs: check quirk to pad epout buf size when not aligned to maxpacketsize

2013-11-04 Thread David Cohen
Hi Alan, Appreciate your comments. Please, see my reply. On 10/30/2013 10:35 AM, Alan Stern wrote: On Wed, 30 Oct 2013, David Cohen wrote: Check gadget.quirk_ep_out_aligned_size to decide if buffer size requires to be aligned to maxpacketsize of an out endpoint. ffs_epfile_io() needs to pad

Re: [PATCH v3 3/3] usb: dwc3: add quirk USB_GADGET_QUIRK_EP_OUT_ALIGNED_SIZE to gadget driver

2013-10-31 Thread David Cohen
On 10/30/2013 10:35 AM, Felipe Balbi wrote: > On Wed, Oct 30, 2013 at 10:06:18AM -0700, David Cohen wrote: >> DWC3 requires epout to have buffer size aligned to MaxPacketSize value. >> This patch adds necessary quirk for it. >> >> Signed-off-by: David Cohen >>

[PATCH v3 2/3] usb: ffs: check quirk to pad epout buf size when not aligned to maxpacketsize

2013-10-30 Thread David Cohen
Check gadget.quirk_ep_out_aligned_size to decide if buffer size requires to be aligned to maxpacketsize of an out endpoint. ffs_epfile_io() needs to pad epout buffer to match above condition if quirk is found. Signed-off-by: David Cohen --- drivers/usb/gadget/f_fs.c | 17 + 1

[PATCH v3 3/3] usb: dwc3: add quirk USB_GADGET_QUIRK_EP_OUT_ALIGNED_SIZE to gadget driver

2013-10-30 Thread David Cohen
DWC3 requires epout to have buffer size aligned to MaxPacketSize value. This patch adds necessary quirk for it. Signed-off-by: David Cohen --- drivers/usb/dwc3/gadget.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 5452c0f

[PATCH v3 0/3] add gadget quirk to adapt f_fs for DWC3

2013-10-30 Thread David Cohen
Android's adbd service to work on Intel Merrifield with f_fs instead of out-of-tree android gadget. --- David Cohen (3): usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget usb: ffs: check quirk to pad epout buf size when not aligned to maxpacketsize usb: dwc3: add

[PATCH v3 1/3] usb: gadget: add quirk_ep_out_aligned_size field to struct usb_gadget

2013-10-30 Thread David Cohen
requires buffer size to be aligned to MaxPacketSize. Signed-off-by: David Cohen --- include/linux/usb/gadget.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 942ef5e..9405d0f 100644 --- a/include/linux/usb/gadget.h +++ b/in

Re: [RFC/PATCH v2 0/3] add gadget quirk to adapt f_fs for DWC3

2013-10-30 Thread David Cohen
On 10/29/2013 03:47 PM, Paul Zimmerman wrote: From: David Cohen Sent: Tuesday, October 29, 2013 2:53 PM These patches are a proposal to add gadget quirks in an immediate objective to adapt f_fs when using DWC3 controller. But the quirk solution is generic and can be used by other controllers to

Re: [RFC/PATCH v2 1/3] usb: gadget: add quirks field to struct usb_gadget

2013-10-30 Thread David Cohen
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 942ef5e..7014ad9 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -540,6 +540,11 @@ struct usb_gadget { struct device dev; unsignedout_epn

[RFC/PATCH v2 3/3] usb: dwc3: add quirk USB_GADGET_QUIRK_EP_OUT_ALIGNED_SIZE to gadget driver

2013-10-29 Thread David Cohen
DWC3 requires epout to have buffer size aligned to MaxPacketSize value. This patch adds necessary quirk for it. Signed-off-by: David Cohen --- drivers/usb/dwc3/gadget.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 5452c0f

<    1   2   3   >