linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Roger Quadros <rogerq@ti.com>
Cc: balbi@kernel.org, <Dylan.Howey@tennantco.com>,
	<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"# v4 . 13+" <stable@vger.kernel.org>
Subject: Re: [PATCH v2][RESEND] usb: gadget: core: Fix ->udc_set_speed() speed handling
Date: Thu, 2 Nov 2017 10:14:19 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1711021012070.1373-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <46a6dae0-b9f1-9d7b-d6c7-8f3c8f59ca6e@ti.com>

On Thu, 2 Nov 2017, Roger Quadros wrote:

> On 01/11/17 17:45, Alan Stern wrote:
> > On Wed, 1 Nov 2017, Roger Quadros wrote:
> > 
> >>> Roger, would you like to send in a follow-up patch that removes the now 
> >>> unnecessary code from dummy_udc_set_speed() in dummy_hcd.c?
> >>>
> >>
> >> Sure. I have a question though.
> >>
> >> In dummy_udc_set_speed() we should just set gadget.speed to whatever is passed in speed.
> >> This will be the maximum supported speed by the gadget function driver.
> > 
> > Following your patch, it will be the maximum speed supported by the 
> > gadget function driver or the maximum speed supported by the UDC 
> > driver, whichever is lower.  That's the whole point of your patch, 
> > right?
> 
> Yes.
> 
> > 
> >> However, is it possible that the gadget will be connected at a lower speed than that?
> > 
> > Yes, it is possible to connect at a speed lower than the function 
> > driver's maximum speed.  The connection speed for dummy-hcd is 
> > controlled by a pair of module parameters: is_super_speed and 
> > is_high_speed.
> > 
> >> I see gadget.speed being updated in dummy_hub_control() GetPortStatus: case, but not
> >> in case of USB_SPEED_HIGH and USB_SPEED_LOW.
> > 
> > Here's what the code does, in outline form:
> > 
> > 	switch (dum_hcd->dum->gadget.speed) {
> > 	case USB_SPEED_HIGH:
> > 		...
> > 		break;
> > 	case USB_SPEED_LOW:
> > 		...
> > 		break;
> > 	default:
> > 		dum_hcd->dum->gadget.speed = USB_SPEED_FULL;
> > 		break;
> > 	}
> > 
> > In other words, if gadget.speed isn't USB_SPEED_HIGH or USB_SPEED_LOW, 
> > set it to USB_SPEED_FULL.  And this is all under the case where the 
> > connection is USB-2, not USB-3 or higher.
> > 
> > How is this related to the requested change to dummy_udc_set_speed()?
> 
> With or without the requested change to dummy_udc_set_speed() there will
> never be a case when gadget.speed isn't already USB_SPEED_FULL
> if connection is USB-2 and gadget.speed is not USB_SPEED_HIGH or USB_SPEED_LOW.
> 
> So in the above code snippet, default: portion is redundant.
> 
> But that can be fixed in a separate patch.

Ah, I see.  Yes, you can change this too if you want.

Alan Stern

      reply	other threads:[~2017-11-02 14:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31 13:01 [PATCH] usb: dwc3: gadget: Fix .udc_set_speed() Roger Quadros
2017-10-31 13:24 ` Felipe Balbi
2017-10-31 13:27   ` Roger Quadros
2017-10-31 13:47 ` [PATCH v2] " Roger Quadros
2017-10-31 13:54   ` Roger Quadros
2017-10-31 13:56 ` [PATCH v2][RESEND] usb: gadget: core: Fix ->udc_set_speed() speed handling Roger Quadros
2017-11-01 14:24   ` Alan Stern
2017-11-01 15:11     ` Roger Quadros
2017-11-01 15:45       ` Alan Stern
2017-11-02  8:53         ` Roger Quadros
2017-11-02 14:14           ` Alan Stern [this message]

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=Pine.LNX.4.44L0.1711021012070.1373-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=Dylan.Howey@tennantco.com \
    --cc=balbi@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rogerq@ti.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;
as well as URLs for NNTP newsgroup(s).