Received: by 10.223.164.221 with SMTP id h29csp2192984wrb; Thu, 2 Nov 2017 07:15:30 -0700 (PDT) X-Google-Smtp-Source: ABhQp+REzOtGVgukckId+U9naMGJ6f8/F/hxhBhuA7JyGSvD4pRH2myA/jic78cVnuhkn8yHh7sO X-Received: by 10.159.218.137 with SMTP id w9mr3430341plp.139.1509632130286; Thu, 02 Nov 2017 07:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509632130; cv=none; d=google.com; s=arc-20160816; b=SRUUGYcDZEx4KUykYa2sDRl4rhXpaSrgI2UQpQ1eg2nyLGeFqLUBpLqqm34rNlZHUl RqNsEKsgTLGQq4tiS8us63IejJ1V+2ZDsGuT9NIMwCOP4mVBnnxrRZTqdxw5BQGJrfMS RgPEC/A23oIvqQGG166GGvhSpwQQlEhK93Z0KHy5c5OIUxVrS3dBMJPv0cl1fQeoI1vr KTRSQ3jgn5jaFP4WYO7DB0vmE0SiEu+rP0XpZ/2sCzGJLGUVrbahKAk9i0GA5dK3BxGY xZWLzC+9kPTwh4u4DZ+CC8u2ByfyYvuVzU0Y+mt7LheU/VekNFwlTj1/TsMbOSUxqVd0 WcgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date:arc-authentication-results; bh=MVdz9F+SqyNkZoF5rOyKLUVZ/p48Pxkx4JkHcxl8KKg=; b=tMUOhbiLHFTC0HCq8vIkGaCZZLQipCwhX/B8BRB/7wX4O/AKM1pATScvDeb0a2QcRP H4/A6qH3nr6HPxUbvHANqgc5jz+a4NfhzxkBK0LJ2Gvw8nbXLMPCSnS1Nac4gBnyA8pK Iqhha6CMZajPlghKgyBGOKxrdH6dgfzogLarcrBJO26+J0yJ5bDwa/IQGVTwYhjaXQAH i5SvxMFs8ORnqEpoU4hGm9PNOn3gokmBQaa4iqWygT2CEVUyrglHsHQ+/2V0FTzx0YYa 4u90vkisrPc/gr7Z21QRrIdqj790V1s+mHzfneG0OqNzBSJnbj3ad8mi9SdyrAYuI8Jw gKGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 137si3587844pgd.277.2017.11.02.07.15.16; Thu, 02 Nov 2017 07:15:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933431AbdKBOOV (ORCPT + 97 others); Thu, 2 Nov 2017 10:14:21 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:54842 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S933034AbdKBOOU (ORCPT ); Thu, 2 Nov 2017 10:14:20 -0400 Received: (qmail 2001 invoked by uid 2102); 2 Nov 2017 10:14:19 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 2 Nov 2017 10:14:19 -0400 Date: Thu, 2 Nov 2017 10:14:19 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Roger Quadros cc: balbi@kernel.org, , , , "# v4 . 13+" Subject: Re: [PATCH v2][RESEND] usb: gadget: core: Fix ->udc_set_speed() speed handling In-Reply-To: <46a6dae0-b9f1-9d7b-d6c7-8f3c8f59ca6e@ti.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 From 1582943814193328827@xxx Thu Nov 02 08:54:19 +0000 2017 X-GM-THRID: 1582781792863818730 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread