Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Robert Baldyga <r.baldyga@samsung.com>
Cc: Krzysztof Opasiak <k.opasiak@samsung.com>, <balbi@ti.com>,
	<gregkh@linuxfoundation.org>, <linux-usb@vger.kernel.org>,
	<andrzej.p@samsung.com>, <stable@vger.kernel.org>
Subject: Re: [PATCH v3 1/2] usb: gadget: loopback: fix: Don't share qlen and buflen between instances
Date: Thu, 24 Sep 2015 11:51:36 -0500	[thread overview]
Message-ID: <20150924165136.GF14151@saruman.tx.rr.com> (raw)
In-Reply-To: <56041470.70306@samsung.com>

[-- Attachment #1: Type: text/plain, Size: 3737 bytes --]

On Thu, Sep 24, 2015 at 05:19:12PM +0200, Robert Baldyga wrote:
> On 09/22/2015 08:40 PM, Krzysztof Opasiak wrote:
> > Each instance of loopback function may have different qlen
> > and buflen attributes values. When linking function to
> > configuration those values had been assigned to global
> > variables. Linking other instance to config overwrites those
> > values.
> > 
> > This commit moves those values to f_loopback structure
> > to avoid overwriting. Now each function has its own instance
> > of those values.
> > 
> > Cc: <stable@vger.kernel.org> # 3.10+
> > Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
> 
> Reviewed-by: Robert Baldyga <r.baldyga@samsung.com>

doesn't seem to fit stable IMO. Care to explain why you think we need
to backport this to v3.10+ ?

> 
> > ---
> >  drivers/usb/gadget/function/f_loopback.c |   24 +++++++++++++-----------
> >  1 file changed, 13 insertions(+), 11 deletions(-)
> > 
> > diff --git a/drivers/usb/gadget/function/f_loopback.c b/drivers/usb/gadget/function/f_loopback.c
> > index 6e2fe63..e4bfed4 100644
> > --- a/drivers/usb/gadget/function/f_loopback.c
> > +++ b/drivers/usb/gadget/function/f_loopback.c
> > @@ -34,6 +34,9 @@ struct f_loopback {
> >  
> >  	struct usb_ep		*in_ep;
> >  	struct usb_ep		*out_ep;
> > +
> > +	unsigned                qlen;
> > +	unsigned                buflen;
> >  };
> >  
> >  static inline struct f_loopback *func_to_loop(struct usb_function *f)
> > @@ -41,13 +44,10 @@ static inline struct f_loopback *func_to_loop(struct usb_function *f)
> >  	return container_of(f, struct f_loopback, function);
> >  }
> >  
> > -static unsigned qlen;
> > -static unsigned buflen;
> > -
> >  /*-------------------------------------------------------------------------*/
> >  
> >  static struct usb_interface_descriptor loopback_intf = {
> > -	.bLength =		sizeof loopback_intf,
> > +	.bLength =		sizeof(loopback_intf),
> >  	.bDescriptorType =	USB_DT_INTERFACE,
> >  
> >  	.bNumEndpoints =	2,
> > @@ -253,7 +253,7 @@ static void loopback_complete(struct usb_ep *ep, struct usb_request *req)
> >  		}
> >  
> >  		/* queue the buffer for some later OUT packet */
> > -		req->length = buflen;
> > +		req->length = loop->buflen;
> >  		status = usb_ep_queue(ep, req, GFP_ATOMIC);
> >  		if (status == 0)
> >  			return;
> > @@ -290,7 +290,9 @@ static void disable_loopback(struct f_loopback *loop)
> >  
> >  static inline struct usb_request *lb_alloc_ep_req(struct usb_ep *ep, int len)
> >  {
> > -	return alloc_ep_req(ep, len, buflen);
> > +	struct f_loopback	*loop = ep->driver_data;
> > +
> > +	return alloc_ep_req(ep, len, loop->buflen);
> >  }
> >  
> >  static int enable_endpoint(struct usb_composite_dev *cdev, struct f_loopback *loop,
> > @@ -317,7 +319,7 @@ static int enable_endpoint(struct usb_composite_dev *cdev, struct f_loopback *lo
> >  	 * we buffer at most 'qlen' transfers; fewer if any need more
> >  	 * than 'buflen' bytes each.
> >  	 */
> > -	for (i = 0; i < qlen && result == 0; i++) {
> > +	for (i = 0; i < loop->qlen && result == 0; i++) {
> >  		req = lb_alloc_ep_req(ep, 0);
> >  		if (!req)
> >  			goto fail1;
> > @@ -391,10 +393,10 @@ static struct usb_function *loopback_alloc(struct usb_function_instance *fi)
> >  	lb_opts->refcnt++;
> >  	mutex_unlock(&lb_opts->lock);
> >  
> > -	buflen = lb_opts->bulk_buflen;
> > -	qlen = lb_opts->qlen;
> > -	if (!qlen)
> > -		qlen = 32;
> > +	loop->buflen = lb_opts->bulk_buflen;
> > +	loop->qlen = lb_opts->qlen;
> > +	if (!loop->qlen)
> > +		loop->qlen = 32;
> >  
> >  	loop->function.name = "loopback";
> >  	loop->function.bind = loopback_bind;
> > 
> 

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-09-24 16:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-22 18:40 [PATCH v3 1/2] usb: gadget: loopback: fix: Don't share qlen and buflen between instances Krzysztof Opasiak
2015-09-22 18:40 ` [PATCH v3 2/2] usb: gadget: loopback: Fix looping back logic implementation Krzysztof Opasiak
2015-09-30 16:11   ` Felipe Balbi
2015-09-30 16:15     ` Felipe Balbi
2015-10-13 18:11       ` Krzysztof Opasiak
2015-10-13 18:16         ` Felipe Balbi
2015-09-24 15:19 ` [PATCH v3 1/2] usb: gadget: loopback: fix: Don't share qlen and buflen between instances Robert Baldyga
2015-09-24 16:51   ` Felipe Balbi [this message]
2015-09-24 17:10     ` Krzysztof Opasiak
2015-09-30 16:08       ` Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150924165136.GF14151@saruman.tx.rr.com \
    --to=balbi@ti.com \
    --cc=andrzej.p@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=k.opasiak@samsung.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=r.baldyga@samsung.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox