Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2219159imu; Fri, 14 Dec 2018 07:37:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/UjCrC+x8dq5iRbBHrR5px4Gkar/RYvx2WqE260DSPr0caH6Xbb09yeS+4sWfEP6K6xwSLe X-Received: by 2002:a17:902:a6:: with SMTP id a35mr3281125pla.201.1544801834152; Fri, 14 Dec 2018 07:37:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544801834; cv=none; d=google.com; s=arc-20160816; b=c6XEVxDR9xIsVp8RD5QNd42OFGkg29AQ5ZL5H6iyB9cyb62Nzimsypl5VLkgDizgye pWem6QHIFA7cD4nOXxVQDF8qFxjEYPQyYhI/QF3n0ieGD9gTd1wCdOiE/rbiIr8SxUWJ /7JPmnvWcdGKXBnOuQXndQcz/U827C2tU4oYw1t+YNnciKsFhpV55+zAEJ6cpGOdcwO2 /SSpqFl5WBnuUhTc3130C42KzVzn8+yW5h5BkVER5I6LUoGOeQ2q7GWTFDJDhjbNv8DL tr7PrcQtWgvnOx72WQp/Vg6Ni4+IRjsWtoeu7e1kstqOtqDLDwlee5/Zdpgls6TApw6w 37bQ== 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; bh=sX3kszB0wWJktJHnCF6OibjypGape2uyQn4OKnvhqtk=; b=HJScPBbNSzkosnZ7Bb/h778U07qQTZmqBirbL0csbWUyGOKvtVAVaXRLwWjdjH6aSR dqR2bfMZgcWuDCJiaisWBemr+ICBKdiGauEEGgSATWGrejiHTlY4DfwRBQLB2mDCorxi 2JeKSR8haUz/hMQWjG6aHN7T82yDxPZXj3VTWkl/HOwxYshwyKiGiUdL4o9TZQ/LN1y7 nkc9TrDO4se5j+tXuKGqCqixRnNbAxQAepNbmb3ISimAuN5a25k0nvZeOFtBj2FyJfxr 1zybzFrT4LH+2LUVu62Ye+fHJd6hhWYFmOGeMOylpTaDlZQCJ34opIP0/dO9aXO353e1 yJSw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q8si4093506plr.382.2018.12.14.07.36.50; Fri, 14 Dec 2018 07:37:14 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727300AbeLNPf7 (ORCPT + 99 others); Fri, 14 Dec 2018 10:35:59 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:59568 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726494AbeLNPf7 (ORCPT ); Fri, 14 Dec 2018 10:35:59 -0500 Received: (qmail 3050 invoked by uid 2102); 14 Dec 2018 10:35:58 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 14 Dec 2018 10:35:58 -0500 Date: Fri, 14 Dec 2018 10:35:58 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Paul Elder cc: Felipe Balbi , Laurent Pinchart , Bin Liu , , , , , Subject: Re: [PATCH 4/6] usb: gadget: add functions to signal udc driver to delay status stage In-Reply-To: <20181214034754.GB7477@garnet.amanokami.net> 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, 13 Dec 2018, Paul Elder wrote: > > Suppose we have a core library routine like this: > > > > void usb_gadget_control_complete(struct usb_gadget *gadget, > > unsigned int no_implicit_status, int status) > > { > > struct usb_request *req; > > > > if (no_implicit_status || status != 0) > > return; > > > > /* Send an implicit status-stage request for ep0 */ > > req = usb_ep_alloc_request(gadget->ep0, GFP_ATOMIC); > > if (req) { > > req->length = 0; > > req->no_implicit_status = 1; > > req->complete = /* req's deallocation routine */ > > usb_ep_queue(gadget->ep0, req, GFP_ATOMIC); > > } > > } > > > > Then all a UDC driver would need to do is call > > usb_gadget_control_complete() after invoking a control request's > > completion handler. The no_implicit_status and status arguments would > > be taken from the request that was just completed. > > > > With this one call added to each UDC, all the existing function drivers > > would work correctly. Even though they don't explicitly queue > > status-stage requests, the new routine will do so for them, > > transparently. Function drivers that want to handle their own > > status-stage requests explicitly will merely have to set the > > req->no_implicit_status bit. > > I think this is a good idea. We still get the benefits of explicit > status stage without being overly intrusive in the conversion, and we > maintain the queue-based API. > > Would it be fine for me to proceed in this direction for a v2? It is as far as I'm concerned (Felipe might not agree). Knock yourself out. :-) Alan Stern > > (We might or might not need to watch out for 0-length control-OUT > > transfers. Function drivers _do_ queue status-stage requests for > > those.) > > Thanks, > > Paul Elder