Re: [PATCH 23/24] USB: gadget: function: Remove redundant license text

2017-11-06 Thread Michal Nazarewicz
Felipe Balbi <ba...@kernel.org> > Cc: Laurent Pinchart <laurent.pinch...@ideasonboard.com> > Cc: Oliver Neukum <oneu...@suse.com> > Cc: Johan Hovold <jo...@kernel.org> > Cc: Michal Nazarewicz <min...@mina86.com> Acked-by: Michal Nazarewicz <min...@mina86

Re: [PATCH] usb/gadget/snps_udc_core: Convert timers to use timer_setup()

2017-10-17 Thread Michal Nazarewicz
gre...@linuxfoundation.org> > Cc: Raviteja Garimella <raviteja.garime...@broadcom.com> > Cc: Michal Nazarewicz <min...@mina86.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > Cc: "Gustavo A. R. Silva" <garsi...@embeddedor.com> > Cc: linux-

Re: [PATCH] USB: g_mass_storage: Fix deadlock when driver is unbound

2017-09-21 Thread Michal Nazarewicz
e device. Therefore the > entire mechanism responsible for this (the fsg_operations structure > with its ->thread_exits method, the fsg_common_set_ops() routine, and > the msg_thread_exits() callback routine) can all be eliminated. Even > the msg_registered bitflag can be re

Re: [PATCH v2 27/31] usb/gadget/snps_udc_core: Remove struct timer_list.data use

2017-09-21 Thread Michal Nazarewicz
list. > > Cc: Felipe Balbi <ba...@kernel.org> > Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org> > Cc: Raviteja Garimella <raviteja.garime...@broadcom.com> > Cc: Michal Nazarewicz <min...@mina86.com> Acked-by: Michal Nazarewicz <min...@mina86.com> &

Re: [PATCH v2] usb: gadget: ffs: handle I/O completion in-order

2017-09-12 Thread Michal Nazarewicz
ctionFS so that data completed > requests is passed to userspace in the order in which they complete. > > Signed-off-by: John Keeping <j...@metanate.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- > I originally sent a version of this patch back in Ju

Re: [PATCH 27/31] usb/gadget/snps_udc_core: Move timer initialization earlier

2017-09-03 Thread Michal Nazarewicz
Greg Kroah-Hartman <gre...@linuxfoundation.org> > Cc: Raviteja Garimella <raviteja.garime...@broadcom.com> > Cc: Michal Nazarewicz <min...@mina86.com> > Cc: "Gustavo A. R. Silva" <garsi...@embeddedor.com> > Cc: linux-usb@vger.kernel.org > Signed-

Re: [PATCH] usb: gadget: f_fs: Pass along set_halt errors.

2017-08-14 Thread Michal Nazarewicz
On Mon, Aug 14 2017, Jerry Zhang wrote: > On Mon, Aug 14, 2017 at 7:26 AM, Michal Nazarewicz <min...@mina86.com> wrote: >> On Fri, Aug 11 2017, Jerry Zhang wrote: >>> Users can apply i/o in the wrong direction on an >>> endpoint to stall it. In case there is

Re: [PATCH] usb: gadget: f_fs: Pass along set_halt errors.

2017-08-14 Thread Michal Nazarewicz
On Fri, Aug 11 2017, Jerry Zhang wrote: > Users can apply i/o in the wrong direction on an > endpoint to stall it. In case there is an error > that does not allow the endpoint to be stalled, > we want the user to know. > > An operation to stall the endpoint will return > EBADMSG if successful,

Re: [PATCH] usb: gadget: f_mass_storage: Fix the logic to iterate all common->luns

2017-06-09 Thread Michal Nazarewicz
On Fri, Jun 09 2017, Axel Lin wrote: > It is wrong to do --i in the for loop. > > Fixes: dd02ea5a3305 ("usb: gadget: mass_storage: Use static array for luns") > Signed-off-by: Axel Lin <axel....@ingics.com> Acked-by: Michal Nazarewicz <min...@mina86.com> &g

Re: [PATCH] gadget: Fix a sleep-in-atomic bug

2017-05-31 Thread Michal Nazarewicz
"GFP_ATOMIC". > > Signed-off-by: Jia-Ju Bai <baijiaju1...@163.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- > drivers/usb/gadget/function/f_fs.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/gadget/

Re: [PATCH] usb: gadget: f_fs: use memdup_user

2017-05-14 Thread Michal Nazarewicz
On Sat, May 13 2017, Geliang Tang wrote: > Use memdup_user() helper instead of open-coding to simplify the code. > > Signed-off-by: Geliang Tang <geliangt...@gmail.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- > drivers/usb/gadget/function/f_fs.c | 11 ++

Re: Options for improving f_fs.c performance?

2017-04-21 Thread Michal Nazarewicz
On Fri, Apr 21 2017, Felipe Balbi wrote: > why would it have to do that? We would allocate a new struct > usb_request, allocate a new buffer, copy_from_user() and > usb_ep_queue(). Why would we return -EAGAIN? Nvm. Of course you’re right. >> What if user space doesn’t want to read? If kernel

Re: Options for improving f_fs.c performance?

2017-04-21 Thread Michal Nazarewicz
ion_interruptible() is what's killing >>> performance. Each and every read/write waits for the USB side to >>> complete. It would've been much better to have something like: >>> >>> if (flags & O_NONBLOCK) >>> wait_for_completion_interruptib

Re: Options for improving f_fs.c performance?

2017-04-21 Thread Michal Nazarewicz
On Fri, Apr 21 2017, Felipe Balbi wrote: > Hi Jerry, > > Jerry Zhang writes: >> (reposting this question in its own subject, instead of buried in a patchset) >> >> Android has migrated to using f_fs for the mtp function, but in the >> process we ran into some performance

Re: [PATCH V3 2/3] usb: gadget: function: f_fs: Let ffs_epfile_ioctl wait for enable.

2017-04-19 Thread Michal Nazarewicz
of endpoints being enabled. > > ESHUTDOWN is now a possible return value and ENODEV is not, so change > docs accordingly. > > Signed-off-by: Jerry Zhang <zhangje...@google.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- > Changelog since v2: > - Update

Re: [PATCH V2 2/3] usb: gadget: function: f_fs: Let ffs_epfile_ioctl wait for enable.

2017-04-19 Thread Michal Nazarewicz
; Previously, calling ioctls before read/write would depending on the > timing of endpoints being enabled. > > Signed-off-by: Jerry Zhang <zhangje...@google.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- > Changelog since v1: > - Guarded against epfile->

Re: [PATCH 2/3] usb: gadget: function: f_fs: Let ffs_epfile_ioctl wait for enable.

2017-04-18 Thread Michal Nazarewicz
On Tue, Apr 18 2017, Jerry Zhang wrote: > Also change the docs to reflect that ENODEV is no longer returned. > > This allows users to make an ioctl call as the first action on a > connection. Ex, some functions might want to get endpoint size > before making any i/os. > > Previously, calling

Re: [PATCH 3/3] usb: gadget: function: f_fs: Move epfile waitqueue to ffs_data.

2017-04-18 Thread Michal Nazarewicz
fs_data makes more sense and is less redundant. > > Also use wake_up_interruptible to reflect use of > wait_event_interruptible. > > Signed-off-by: Jerry Zhang <zhangje...@google.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- > drivers/usb/gadget/func

Re: [PATCH 1/3] usb: gadget: function: f_fs: Fix doc for FUNCTIONFS_INTERFACE_REVMAP

2017-04-18 Thread Michal Nazarewicz
On Tue, Apr 18 2017, Jerry Zhang wrote: > The comment for this states that it returns -ENODEV > when the function is inactive. Really, an inactive > function is treated as having no interfaces, so -EDOM > is returned. Uh? Than what’s this: if (code == FUNCTIONFS_INTERFACE_REVMAP) {

Re: [PATCH 3/3] usb: gadget: f_mass_storage: Serialize wake and sleep execution

2017-04-07 Thread Michal Nazarewicz
sleeper. > > However, a better solution in the future would be to use wait_queue > method that takes care of managing memory barrier between waker and > waiter. > > See DEFINE_WAIT_FUNC comment in kernel scheduling wait.c as this > solution is similar to its implementation. > > Sig

[PATCHv2] usb: gadget: f_fs: simplify ffs_dev name handling

2017-03-10 Thread Michal Nazarewicz
but the actual amount is not immediately obvious and depends on pointer size and which slab buckets the structure and name would fall into). Signed-off-by: Michal Nazarewicz <min...@mina86.com> --- drivers/usb/gadget/function/f_fs.c | 72 +++--- drivers/usb/gadget/fu

[PATCH] usb: gadget: f_fs: simplify ffs_dev name handling

2017-03-01 Thread Michal Nazarewicz
but the actual amount is not immediately obvious and depends on pointer size and which slab buckets the structure and name would fall into). Signed-off-by: Michal Nazarewicz <min...@mina86.com> --- drivers/usb/gadget/function/f_fs.c | 79 -- drivers/usb/gadget/fu

[PATCH] usb: gadget: mv_udc: clarify a switch with an implicit fall-through

2017-03-01 Thread Michal Nazarewicz
Reported-by: Gustavo A. R. Silva <garsi...@embeddedor.com> Signed-off-by: Michal Nazarewicz <min...@mina86.com> --- drivers/usb/gadget/udc/mv_udc_core.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/us

Re: [PATCH 1/2] usb: gadget: udc: avoid use of freed pointer

2017-02-13 Thread Michal Nazarewicz
.@embeddedor.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- > drivers/usb/gadget/udc/amd5536udc.c | 20 +++- > 1 file changed, 11 insertions(+), 9 deletions(-) > > diff --git a/drivers/usb/gadget/udc/amd5536udc.c > b/drivers/usb/gadg

Re: [PATCH 2/2] usb: gadget: udc: remove unnecessary variable and update function prototype

2017-02-13 Thread Michal Nazarewicz
On Mon, Feb 13 2017, Gustavo A. R. Silva wrote: > Remove unnecessary variable and update function prototype. > > Reviewed-by: Greg Kroah-Hartman <gre...@linuxfoundation.org> > Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> Acked-by: Michal Nazar

Re: [PATCH v2] usb: gadget: udc: remove pointer dereference after free

2017-02-13 Thread Michal Nazarewicz
On Sat, Feb 11 2017, Gustavo A. R. Silva wrote: > Remove pointer dereference after free and set pointer to NULL after free. > > Addresses-Coverity-ID: 1091173 > Signed-off-by: Gustavo A. R. Silva <garsi...@embeddedor.com> Acked-by: Michal Nazarewicz <min...@mina86.com>

[PATCH] usb: gadget: f_fs: simplify ffs_dev name handling

2017-02-08 Thread Michal Nazarewicz
but the actual amount is not immediately obvious and depends on pointer size and which slab buckets the structure and name would fall into). Signed-off-by: Michal Nazarewicz <min...@mina86.com> --- drivers/usb/gadget/function/f_fs.c | 79 -- drivers/usb/gadget/fu

[PATCH] usb: gadget: mv_udc: clarify a switch with an implicit fall-through

2017-02-08 Thread Michal Nazarewicz
Reported-by: Gustavo A. R. Silva <garsi...@embeddedor.com> Signed-off-by: Michal Nazarewicz <min...@mina86.com> --- drivers/usb/gadget/udc/mv_udc_core.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/usb/gadget/udc/mv_udc_core.c b/drivers/us

Re: [PATCH 1/2] drivers: usb: gadget: udc: add missing break in switch

2017-02-08 Thread Michal Nazarewicz
On Wed, Feb 08 2017, Felipe Balbi wrote: > Hi, > > "Gustavo A. R. Silva" writes: >> Add missing break in switch. >> >> Addresses-Coverity-ID: 201385 >> Signed-off-by: Gustavo A. R. Silva >> --- >> drivers/usb/gadget/udc/mv_udc_core.c | 1 + >> 1

Re: [v1] usb:gadget:legacy:nokia :- Check for NULL in nokia_bind_config

2016-12-09 Thread Michal Nazarewicz
1a0e2d1d0b121fdfeccea7ace Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz <min...@mina86.com> Date: Fri, 9 Dec 2016 15:56:44 +0100 Subject: [PATCH] =?UTF-8?q?usb:=20function:=20make=20sure=20usb=5Fget=5Ffu?= =?UTF-8?q?nction*=20functions=20don=E2=80=99t=20returen=20NULL?= MIME-Version: 1

Re: [PATCH] usb: gadget: f_fs: Fix possibe deadlock

2016-12-08 Thread Michal Nazarewicz
fput+0xb0/0x1f4 > [ 52.642633] c1 [] fput+0x20/0x2c > [ 52.642636] c1 [] task_work_run+0xb4/0xe8 > [ 52.642640] c1 [] do_exit+0x360/0xb9c > [ 52.642644] c1 [] do_group_exit+0x4c/0xb0 > [ 52.642647] c1 [] get_signal+0x380/0x89c > [ 52.642651] c1 [] do_signal+0x1

[PATCH 1/2] usb: gadget: f_fs: edit epfile->ep under lock

2016-10-03 Thread Michal Nazarewicz
epfile->ep is protected by ffs->eps_lock (not epfile->mutex) so clear it while holding the spin lock. Signed-off-by: Michal Nazarewicz <min...@mina86.com> --- drivers/usb/gadget/function/f_fs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/

[PATCH 2/2] usb: gadget: f_fs: stop sleeping in ffs_func_eps_disable

2016-10-03 Thread Michal Nazarewicz
ffs_func_eps_disable is called from atomic context so it cannot sleep thus cannot grab a mutex. Change the handling of epfile->read_buffer to use non-sleeping synchronisation method. Reported-by: Chen Yu Signed-off-by: Michał Nazarewicz Fixes:

Re: BUG: scheduling while atomic in f_fs when gadget remove driver

2016-10-03 Thread Michal Nazarewicz
On Mon, Oct 03 2016, John Stultz wrote: > On Wed, Sep 28, 2016 at 2:38 PM, Michal Nazarewicz <min...@mina86.com> wrote: >> On Wed, Sep 28 2016, Michal Nazarewicz wrote: >>> With that done, the only thing which needs a mutex is >>> epfile->read_buffer. >&g

Re: BUG: scheduling while atomic in f_fs when gadget remove driver

2016-09-28 Thread Michal Nazarewicz
On Wed, Sep 28 2016, Michal Nazarewicz wrote: > With that done, the only thing which needs a mutex is > epfile->read_buffer. Perhaps this would do: >8 -- - >From 6416a1065203a39328311f6c58083089efe169aa Mon Sep 1

Re: BUG: scheduling while atomic in f_fs when gadget remove driver

2016-09-28 Thread Michal Nazarewicz
in the code and we need to do this: --- >8 - >From 0ce6cc5e2440800243eff06c6952cba0f976da2f Mon Sep 17 00:00:00 2001 From: Michal Nazarewicz <min...@mina86.com> Date: Wed, 28 Sep 2016 18:10:42 +0200 Subject: [PATCH] usb:

Re: [PATCH] usb: gadget: f_fs: use complete() instead complete_all()

2016-09-22 Thread Michal Nazarewicz
complete() > > Signed-off-by: Daniel Wagner <daniel.wag...@bmw-carit.de> > Cc: Felipe Balbi <ba...@kernel.org> > Cc: Michal Nazarewicz <min...@mina86.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > Cc: Greg Kroah-Hartman <gre...@linuxfo

Re: [PATCH v3 4/9] usb: gadget: f_midi: defaults buflen sizes to 512

2016-08-06 Thread Michal Nazarewicz
onello.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- > drivers/usb/gadget/function/f_midi.c | 2 +- > drivers/usb/gadget/legacy/gmidi.c| 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/gadget/function/f_midi.c >

Re: [PATCH v3 1/9] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align

2016-08-06 Thread Michal Nazarewicz
ich does always returns the > aligned buffer size for an endpoint. This is useful to be used by USB requests > allocator functions. > > Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- > include/linux/

Re: [PATCH 0984/1285] Replace numeric parameter like 0444 with macro

2016-08-03 Thread Michal Nazarewicz
On Wed, Aug 03 2016, Oliver Neukum wrote: > Before we think about that, the basic question whether > > S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH > > is clearer and easier to read than > > 0644 > > must be decided. I would saz no, it is not. I was about to write the same thing. I dislike magic

Re: [PATCH 9/9] usb: gadget: f_hid: use alloc_ep_req()

2016-07-27 Thread Michal Nazarewicz
On Tue, Jul 26 2016, Felipe F. Tonello wrote: > Use gadget's framework allocation function instead of directly calling > usb_ep_alloc_request(). > > Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- >

Re: [PATCH 8/9] usb: gadget: f_hid: use free_ep_req()

2016-07-27 Thread Michal Nazarewicz
On Tue, Jul 26 2016, Felipe F. Tonello wrote: > We should always use free_ep_req() when allocating requests with > alloc_ep_req(). > > Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- > drivers/us

Re: [PATCH 7/9] usb: gadget: remove useless parameter in alloc_ep_req()

2016-07-27 Thread Michal Nazarewicz
me. > create an inline function to pass the same value to len and default_len. > > So this patch also removes duplicate code from few drivers. > > Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- >

Re: [PATCH 2/9] usb: gadget: align buffer size when allocating for OUT endpoint

2016-07-27 Thread Michal Nazarewicz
On Tue, Jul 26 2016, Felipe F. Tonello wrote: > Using usb_ep_align() makes sure that the buffer size for OUT endpoints is > always aligned with wMaxPacketSize (512 usually). This makes sure > that no buffer has the wrong size, which can cause nasty bugs. > > Signed-off-by: Felipe F. Tonello

Re: [PATCH 4/9] usb: gadget: f_midi: defaults buflen sizes to 512

2016-07-27 Thread Michal Nazarewicz
onello.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- > drivers/usb/gadget/function/f_midi.c | 2 +- > drivers/usb/gadget/legacy/gmidi.c| 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/gadget/function/f_midi.c >

Re: [PATCH 1/9] usb: gadget: fix usb_ep_align_maybe endianness and new usb_ep_align

2016-07-27 Thread Michal Nazarewicz
ich does always returns the > aligned buffer size for an endpoint. This is useful to be used by USB requests > allocator functions. > > Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- > include/linux/

Re: [PATCH v2] usb: gadget: f_midi: Add checking if it need align buffer's size to an ep's maxpacketsize

2016-07-11 Thread Michal Nazarewicz
s need to align > the request buffer's size to an ep's maxpacketsize. > > Signed-off-by: Baolin Wang <baolin.w...@linaro.org> > Acked-by: Michal Nazarewicz <min...@mina86.com> > --- > Changelog since v1: > - Remove the in_ep modification. > - Remove max_t() functio

Re: [PATCH] usb: gadget: f_midi: Add checking if it need align buffer's size to an ep's maxpacketsize

2016-07-08 Thread Michal Nazarewicz
[PING] > DEVICE: [NAK] > ... > HOST: [PING] > DEVICE: [NAK] > > This patch fixes this problem by setting the minimum usb_request's buffer > size > for the OUT endpoint as its wMaxPacketSize. > > Acked-by: Michal Nazarewic

Re: [PATCH] usb: gadget: f_midi: Add checking if it need align buffer's size to an ep's maxpacketsize

2016-07-08 Thread Michal Nazarewicz
> Baolin Wang writes: >> @@ -359,10 +361,12 @@ static int f_midi_set_alt(struct usb_function *f, >> unsigned intf, unsigned alt) >> >> /* allocate a bunch of read buffers and queue them all at once. */ >> for (i = 0; i < midi->qlen && err == 0; i++) { >> -

Re: [PATCH] usb: gadget: f_midi: Add checking if it need align buffer's size to an ep's maxpacketsize

2016-07-08 Thread Michal Nazarewicz
On Fri, Jul 08 2016, Baolin Wang wrote: > On 7 July 2016 at 20:51, Michal Nazarewicz <min...@mina86.com> wrote: >> On Thu, Jul 07 2016, Baolin Wang wrote: >>> Some gadget device (such as dwc3 gadget) requires quirk_ep_out_aligned_size >>> attribute, which m

Re: [PATCH] usb: gadget: f_midi: Add checking if it need align buffer's size to an ep's maxpacketsize

2016-07-07 Thread Michal Nazarewicz
s need to align > the request buffer's size to an ep's maxpacketsize. > > Signed-off-by: Baolin Wang <baolin.w...@linaro.org> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- > drivers/usb/gadget/function/f_midi.c | 18 +++--- > 1 file changed, 11

Re: [patch] usb: gadget: f_fs: check for allocation failure

2016-06-24 Thread Michal Nazarewicz
On Fri, Jun 24 2016, Dan Carpenter wrote: > Return -ENOMEM if kmalloc() fails. > > Fixes: 9353afbbfa7b ('usb: gadget: f_fs: buffer data from ‘oversized’ OUT > requests') > Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> > Acked-by: Michal Nazarewicz <min..

[PATCHv2 2/4] usb: gadget: m66592: fix unused-but-set-variable warnings

2016-05-31 Thread Michal Nazarewicz
that are needed. Signed-off-by: Michal Nazarewicz <min...@mina86.com> --- drivers/usb/gadget/udc/m66592-udc.c | 24 ++-- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m66592-udc.c index b1cfa96..6e977dc

[PATCHv2 4/4] usb: gadget: mv_u3d: fix unused-but-set-variable warnings

2016-05-31 Thread Michal Nazarewicz
; ^ In doing so, it removes calls to ioread32 function which does I/O with the device, but I hope the reads don’t have any side effects that are needed. Signed-off-by: Michal Nazarewicz <min...@mina86.com> --- drivers/usb/gadget/udc/mv_u3d_core.c | 23 +++ 1 file changed, 3 inse

[PATCHv2 3/4] usb: gadget: r8a66597: fix unused-but-set-variable warnings

2016-05-31 Thread Michal Nazarewicz
that are needed. Signed-off-by: Michal Nazarewicz <min...@mina86.com> --- drivers/usb/gadget/udc/r8a66597-udc.c | 24 ++-- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/udc/r8a66597-udc.c index 8

Re: [PATCH 0/4] usb: gadget: fix most of W=1 warinngs

2016-05-31 Thread Michal Nazarewicz
On Tue, May 31 2016, Felipe Balbi wrote: > This series doesn't seem to apply to v4.7-rc1. Care to rebase on > testing/fixes? Sure. Only the first patch needs fixing (by skipping failed hunks). Michal Nazarewicz (4): usb: gadget: fix unused-but-set-variale warnings usb: gadget: m6659

[PATCHv2 1/4] usb: gadget: fix unused-but-set-variale warnings

2016-05-31 Thread Michal Nazarewicz
Those are enabled with W=1 make option. The patch leaves of some type-limits warnings which are caused by generic macros used in a way where they produce always-false conditions. Signed-off-by: Michal Nazarewicz <min...@mina86.com> --- drivers/usb/gadget/function/f_fs.c | 3 +-- d

Re: [patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-28 Thread Michal Nazarewicz
On Sat, May 28 2016, Dan Carpenter wrote: > Try compiling the code you suggested. I find this amusing to be perfectly honest. Kernel uses designated initialisers, flexible array members, stdint.h, compound literals and variadic macros, yet still for some reason sticks to -std=gnu89. No matter,

Re: [patch v2] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-28 Thread Michal Nazarewicz
8abd25994 ('USB: f_fs: the FunctionFS driver') > Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> Acked-by: Michal Nazarewicz <min...@mina86.com> > --- > v2: move the eps_ptr assignment outside the loop. > > diff --git a/drivers/usb/gadget/function/f_fs.c > b/drivers/

Re: [patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-28 Thread Michal Nazarewicz
On Sat, May 28 2016, Dan Carpenter wrote: > Also in the kernel we have to declare variables at the start of the > block. /me shrugs I looked at this out of curiosity and there are precedents: $ git grep 'for (\(int\|unsigned\|signed\|long\|char\)[[:space:]]' |wc -l 19 (albeit mostly in

Re: [patch] usb: f_fs: off by one bug in _ffs_func_bind()

2016-05-27 Thread Michal Nazarewicz
wrong variable to use for an iterator. > > Fixes: ddf8abd25994 ('USB: f_fs: the FunctionFS driver') > Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> Acked-by: Michal Nazarewicz <min...@mina86.com> How on Earth could I have made that mistake is beyond my comprehension.

[PATCH 1/4] usb: gadget: fix unused-but-set-variale warnings

2016-05-23 Thread Michal Nazarewicz
igned-off-by: Michal Nazarewicz <min...@mina86.com> --- drivers/usb/gadget/function/f_fs.c | 3 +- drivers/usb/gadget/function/u_serial.c | 3 +- drivers/usb/gadget/legacy/g_ffs.c | 15 -- drivers/usb/gadget/udc/amd5536udc.c| 9 +- drivers/usb/gadget/udc/bdc/b

[PATCH 2/4] usb: gadget: m66592: fix unused-but-set-variable warnings

2016-05-23 Thread Michal Nazarewicz
that are needed. Signed-off-by: Michal Nazarewicz <min...@mina86.com> Cc: Yoshihiro Shimoda <shimoda.yoshih...@renesas.com> --- drivers/usb/gadget/udc/m66592-udc.c | 24 ++-- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/usb/gadget/udc/m66592-udc.c b

[PATCH 3/4] usb: gadget: r8a66597: fix unused-but-set-variable warnings

2016-05-23 Thread Michal Nazarewicz
that are needed. Signed-off-by: Michal Nazarewicz <min...@mina86.com> Cc: Yoshihiro Shimoda <shimoda.yoshih...@renesas.com> --- drivers/usb/gadget/udc/r8a66597-udc.c | 24 ++-- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/usb/gadget/udc/r8a66

[PATCH 4/4] usb: gadget: mv_u3d: fix unused-but-set-variable warnings

2016-05-23 Thread Michal Nazarewicz
; ^ In doing so, it removes calls to ioread32 function which does I/O with the device, but I hope the reads don’t have any side effects that are needed. Signed-off-by: Michal Nazarewicz <min...@mina86.com> Cc: Yu Xu <y...@marvell.com> --- drivers/usb/gadget/udc/mv_u3d_core.c | 23 +++---

[PATCH 0/4] usb: gadget: fix most of W=1 warinngs

2016-05-23 Thread Michal Nazarewicz
Fixes all of the unused-but-set-variable warnings enabled when building with W=1. As described in the first patch, some warnings are left off. See said patch for more description. Michal Nazarewicz (4): usb: gadget: fix unused-but-set-variale warnings usb: gadget: m66592: fix unused-but-set

[PATCH 0/2] f_fs: better handle excess data on read

2016-05-21 Thread Michal Nazarewicz
UDC does and * breaks one read -> one request model which has been true so far. Michal Nazarewicz (2): usb: gadget: f_fs: printk error when excess data is dropped on read usb: gadget: f_fs: buffer data from ‘oversized’ OUT requests drivers/usb/gadget/function/f_fs.c |

[PATCH 2/2] usb: gadget: f_fs: buffer data from ‘oversized’ OUT requests

2016-05-21 Thread Michal Nazarewicz
ignored. Signed-off-by: Michal Nazarewicz <min...@mina86.com> --- drivers/usb/gadget/function/f_fs.c | 130 +++-- 1 file changed, 109 insertions(+), 21 deletions(-) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index e

[PATCH 1/2] usb: gadget: f_fs: printk error when excess data is dropped on read

2016-05-21 Thread Michal Nazarewicz
Add a pr_err when host sent more data then the size of the buffer user space gave us. This may happen on UDCs which require OUT requests to be aligned to max packet size. The patch includes a description of the situation. Signed-off-by: Michal Nazarewicz <min...@mina86.com> --- drive

Re: [PATCH] usb: gadget: f_fs: report error if excess data received

2016-05-19 Thread Michal Nazarewicz
On Thu, May 19 2016, Changbin Du wrote: >> On Wed, May 18 2016, Felipe Balbi wrote: >> > we've been through this before. This needs to be done at the gadget >> > layer. Gadget driver can over-allocate ahead of time if >> > gadget->quirk_ep_out_aligned_size is true, then we avoid memcpy() at >> >

Re: [PATCH] usb: gadget: f_fs: report error if excess data received

2016-05-18 Thread Michal Nazarewicz
On Wed, May 18 2016, Felipe Balbi wrote: > we've been through this before. This needs to be done at the gadget > layer. Gadget driver can over-allocate ahead of time if > gadget->quirk_ep_out_aligned_size is true, then we avoid memcpy() at > the UDC driver level. Right, all right, so let’s look

Re: [PATCH] usb: gadget: f_fs: report error if excess data received

2016-05-18 Thread Michal Nazarewicz
On Tue, May 17 2016, Changbin Du wrote: >> There appears to be no kfifo support for iov_iter though, so I just went >> with a simple buffer. >> >> I haven’t looked at the patch too carefully so this is an RFC rather >> than an actual patch at this point. It does compile at least. >> >>

Re: [PATCH] usb: gadget: f_fs: report error if excess data received

2016-05-16 Thread Michal Nazarewicz
On Mon, May 16 2016, Felipe Balbi wrote: > Michal Nazarewicz <min...@mina86.com> writes: > >>> Alan Stern <st...@rowland.harvard.edu> writes: >>>> The point is that you don't know whether the host sent more data than >>>> expected. All you

Re: [PATCH] usb: gadget: f_fs: report error if excess data received

2016-05-16 Thread Michal Nazarewicz
> On 05/16/2016 06:05 PM, Michal Nazarewicz wrote: >> So I’ve been looking at AIO handling in f_fs and either I’m stupid or >> the code is broken. On Mon, May 16 2016, Lars-Peter Clausen wrote: > The code was broken. Fixed in commit 332a5b446b791 ("usb: gadget: > f

Re: [PATCH] usb: gadget: f_fs: report error if excess data received

2016-05-16 Thread Michal Nazarewicz
So I’ve been looking at AIO handling in f_fs and either I’m stupid or the code is broken. Here’s part of ffs_user_copy_worker: int ret = io_data->req->status ? io_data->req->status : io_data->req->actual; if (io_data->read && ret > 0) {

Re: [PATCH] usb: gadget: f_fs: report error if excess data received

2016-05-16 Thread Michal Nazarewicz
> Alan Stern writes: >> The point is that you don't know whether the host sent more data than >> expected. All you know is that the host sent more data than the user >> asked the kernel for -- but maybe the user didn't ask for all the >> data that he expected. Maybe

Re: [PATCH] usb: gadget: f_fs: report error if excess data received

2016-05-14 Thread Michal Nazarewicz
On Fri, May 13 2016, Alan Stern wrote: > The point is that you don't know whether the host sent more data than > expected. All you know is that the host sent more data than the user > asked the kernel for -- but maybe the user didn't ask for all the data > that he expected. Maybe the user wanted

Re: [PATCH] usb: gadget: f_fs: report error if excess data received

2016-05-11 Thread Michal Nazarewicz
On Wed, May 11 2016, Felipe Balbi wrote: > Also, returning -EOVERFLOW is not exactly correct here, because you'd > violate POSIX specification of read(), right ? Maybe we could piggyback on: EINVAL fd was created via a call to timerfd_create(2) and the wrong size buffer was

Re: [PATCH] usb: gadget: f_fs: Fix use-after-free

2016-04-19 Thread Michal Nazarewicz
_fs: add aio support") > Signed-off-by: Lars-Peter Clausen <l...@metafoo.de> And obviously, moments after I sent an email asking a question I tracked down ki_complete. The commit message could benefit from being more detailed regardless. Acked-by: Michal Nazarewicz <min...@mina86.com>

Re: [PATCH] usb: gadget: f_fs: Fix use-after-free

2016-04-19 Thread Michal Nazarewicz
On Thu, Apr 14 2016, Lars-Peter Clausen wrote: > Calling the ki_complete() callback will free the underlying data structure. > Make sure that it is no longer accessed beyond that point, otherwise > undefined behaviour might occur. To be honest I have trouble tracking what ki_complete is. Could

Re: [PATCH] usb: f_mass_storage: test whether thread is running before starting another

2016-04-19 Thread Michal Nazarewicz
On Mon, Apr 18 2016, Andrzej Pietrasiewicz wrote: > The function responsible for verifying if a symlink can be made is in > drivers/usb/gadget/configfs.c: config_usb_cfg_link() > > There is a comment from the author: > >* Also a function instance can only be linked once. > > This is the

[PATCHv2] usb: f_mass_storage: test whether thread is running before starting another

2016-04-08 Thread Michal Nazarewicz
not mistaken, configfs gadget doesn’t even allow it to be expressed. ¹ I have no example failure though. Conclusion that legacy/multi has a bug is based purely on me reading the code. Signed-off-by: Michal Nazarewicz <min...@mina86.com> Tested-by: Ivaylo Dimitrov <ivo.g.dimitrov...@gmai

Re: [PATCH] usb: f_mass_storage: test whether thread is running before starting another

2016-04-07 Thread Michal Nazarewicz
> On Thu, 7 Apr 2016, Michal Nazarewicz wrote: >> This makes me suspect it’s not possible to link a function instance to >> the same configuration twice, but now that I think about it, I’m not >> quite sure what would happen if one did: >> >> ln -s functio

Re: [PATCH] usb: f_mass_storage: test whether thread is running before starting another

2016-04-07 Thread Michal Nazarewicz
>> On Tue, Apr 05 2016, Alan Stern wrote: >>> Suppose one usb_function is carrying out an I/O operation while >>> another one in the same config gets a Set-Interface request from the >>> host. > On Wed, 6 Apr 2016, Michal Nazarewicz wrote: >> That cannot

Re: [PATCH] usb: gadget: f_fs: Fix EFAULT generation for async read operations

2016-04-07 Thread Michal Nazarewicz
9b8639 ("gadget/function/f_fs.c: use put iov_iter into io_data") > Signed-off-by: Lars-Peter Clausen <l...@metafoo.de> Acked-by: Michal Nazarewicz <min...@mina86.com> (I thought I’ve already acked it). > --- > Changes since v1: > * copy_to_iter() can fail,

Re: [PATCH] usb: f_mass_storage: test whether thread is running before starting another

2016-04-05 Thread Michal Nazarewicz
On Tue, Apr 05 2016, Alan Stern wrote: > Suppose one usb_function is carrying out an I/O operation while > another one in the same config gets a Set-Interface request from the > host. That cannot happen. A single instance of mass_storage cannot¹ be added twice to the same configuration. ¹ To be

Re: [PATCH] usb: f_mass_storage: test whether thread is running before starting another

2016-04-05 Thread Michal Nazarewicz
> On Tue, 5 Apr 2016, Michal Nazarewicz wrote: >> When binding the function to usb_configuration, check whether the thread >> is running before starting another one. Without that, when function >> instance is added to multiple configurations, fsg_bing starts multipl

[PATCH] usb: f_mass_storage: test whether thread is running before starting another

2016-04-05 Thread Michal Nazarewicz
need to worry about starting the thread by themselves (which was where bug in legacy/multi was in the first place). ¹ I have no example failure though. Conclusion that legacy/multi has a bug is based purely on me reading the code. Signed-off-by: Michal Nazarewicz <min...@mina86.com> --- d

Re: USB gadgets with configfs hang reboot

2016-04-05 Thread Michal Nazarewicz
On Fri, Apr 01 2016, Michal Nazarewicz wrote: > For legacy/nokia setting no_configfs should be a valid solution: > > >8 > diff --git a/drivers/usb/gadget/legacy/nokia.c > b/drivers/usb/gadget/legacy/nokia

Re: [patch] usb: gadget: f_midi: unlock on error

2016-04-04 Thread Michal Nazarewicz
> On 04/04/16 13:11, Michal Nazarewicz wrote: >> Or maybe even this which gets away with gotos all together: >> >> diff --git a/drivers/usb/gadget/function/f_midi.c >> b/drivers/usb/gadget/function/f_midi.c >> index 56e2dde..91cae60 100644 >> --- a/driver

Re: USB gadgets with configfs hang reboot

2016-04-04 Thread Michal Nazarewicz
On Mon, Apr 04 2016, Ivaylo Dimitrov wrote: > Who and when is going to destroy the thread if one does > "/sys/bus/platform/drivers/musb-hdrc# echo musb-hdrc.0.auto > unbind"? > Wouldn't some kind of refcounting make sense here? Currently the thread is killed when fsg_common structure is released

Re: USB gadgets with configfs hang reboot

2016-04-04 Thread Michal Nazarewicz
On Mon, Apr 04 2016, Alan Stern wrote: > So there is no way to add a single function to several configurations? There is. f_mass_storage (and any other usb_function_instance) simply has to have multiple usb_function structures. > It sounds like there are two problems then. The first problem is

Re: USB gadgets with configfs hang reboot

2016-04-04 Thread Michal Nazarewicz
On Sat, Apr 02 2016, Alan Stern wrote: > On Sat, 2 Apr 2016, Michal Nazarewicz wrote: >> At the same time, mass storage should work fine if it’s bound to >> multiple configurations. Only one configuration can be active at any >> given time so interfaces on different

Re: [patch] usb: gadget: f_midi: unlock on error

2016-04-04 Thread Michal Nazarewicz
On Sat, Apr 02 2016, Dan Carpenter wrote: > We added some new locking here, but missed an error path where we need > to unlock. > > Fixes: 9acdf4df2fc4 ('usb: gadget: f_midi: added spinlock on transmit > function') > Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com

Re: USB gadgets with configfs hang reboot

2016-04-01 Thread Michal Nazarewicz
> On Fri, 1 Apr 2016, Michal Nazarewicz wrote: >> @@ -3050,9 +3053,11 @@ static int fsg_bind(struct usb_configuration *c, >> struct usb_function *f) >> if (ret) >> return ret; >> fsg_common_set_inqui

Re: USB gadgets with configfs hang reboot

2016-04-01 Thread Michal Nazarewicz
On Thu, Mar 31 2016, Alan Stern wrote: > Michal, I'm not sure how you intended to handle this. For legacy/nokia setting no_configfs should be a valid solution: >8 diff --git a/drivers/usb/gadget/legacy/nokia.c

Re: [PATCH v2] usb: gadget: f_midi: fixed a bug when buflen was smaller than wMaxPacketSize

2016-03-28 Thread Michal Nazarewicz
wMaxPacketSize > because that can cause bugs (this bug) or performance issues. Thus, this patch > fixes this problem by eliminating buflen entirely and replacing it with > wMaxPacketSize of the appropriate endpoint where needed. > > Signed-off-by: Felipe F. Tonello <e...@felipetonell

Re: [PATCH] usb: gadget: f_midi: Fixed a bug when buflen was smaller than wMaxPacketSize

2016-03-11 Thread Michal Nazarewicz
ffer size > for the OUT endpoint as its wMaxPacketSize. > > Signed-off-by: Felipe F. Tonello <e...@felipetonello.com> Acked-by: Michal Nazarewicz <min...@mina86.com> But see comment below: > --- > drivers/usb/gadget/function/f_midi.c | 4 +++- > 1 file changed, 3 ins

Re: [PATCH 4/5] usb: gadget: f_midi: cleanups and typos fixes

2016-03-05 Thread Michal Nazarewicz
;> + * Licensed under the GPLv2. > On March 4, 2016 7:17:31 PM GMT+00:00, Michal Nazarewicz <min...@mina86.com> > wrote: >> Any particular reason to do that? On Fri, Mar 04 2016, Felipe Ferreri Tonello wrote: > Because the kernel is v2 only and not later. Linux as a

Re: [PATCH 4/5] usb: gadget: f_midi: cleanups and typos fixes

2016-03-04 Thread Michal Nazarewicz
On Wed, Mar 02 2016, Felipe F. Tonello wrote: > Signed-off-by: Felipe F. Tonello > --- > drivers/usb/gadget/function/f_midi.c | 77 > +++- > 1 file changed, 40 insertions(+), 37 deletions(-) > > diff --git

  1   2   3   4   5   6   >