From patchwork Tue Sep 2 15:50:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 36497 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 21F45203BE for ; Tue, 2 Sep 2014 15:51:10 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id vb8sf39128355obc.8 for ; Tue, 02 Sep 2014 08:51:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:message-id :reply-to:references:mime-version:content-type:content-disposition :in-reply-to:user-agent:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=mPdna/ObXt+uzP/nrM1znF1suPlRnh+Yt9BVSJ7cNuQ=; b=ZsYFn+W8BOGD2oRDfBhT8PpjnRjRQp5cZNDncxCqN1NVTn6irV3p/kzRkNMwxo//vt ySrPIOVfpKK6qidEvJDgYXpXaSB2DNJlQmVaEGuWqBTMJdNL9mRmQl+x/eEWqKXwrMZ7 9GnVjO4AFyCuEbQBYZVvpjRUh2j7xlPC0JFHInNmr6ZgOpho3l1W0NNBdk/683VKYIAT Gm2yXFihE1HSveWYpjc2l9lHRF3yxOivZ5pLM2HHaBbWFBr0VgE9bjCbS45kCr+nmC1f IYJEQ1i7wDv4N8UE40JojbSsXrpNQNRcKRksI79HA9JN7zoIFSQAX3ZJBQUVbfofyQqE W1tg== X-Gm-Message-State: ALoCoQnfkgJH8Q3ovKU3sB6Adgg+pauG14xL9qqKWAZl+rNhQJSBvu4id0uMgL2rnWEKv06ZhUqH X-Received: by 10.182.246.70 with SMTP id xu6mr20082915obc.31.1409673069721; Tue, 02 Sep 2014 08:51:09 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.82.228 with SMTP id h91ls2564756qgd.77.gmail; Tue, 02 Sep 2014 08:51:09 -0700 (PDT) X-Received: by 10.52.61.136 with SMTP id p8mr25843215vdr.15.1409673069571; Tue, 02 Sep 2014 08:51:09 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id t5si2493327vcc.32.2014.09.02.08.51.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 02 Sep 2014 08:51:09 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id la4so7111744vcb.23 for ; Tue, 02 Sep 2014 08:51:09 -0700 (PDT) X-Received: by 10.52.88.74 with SMTP id be10mr641141vdb.54.1409673069483; Tue, 02 Sep 2014 08:51:09 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp549032vcb; Tue, 2 Sep 2014 08:51:07 -0700 (PDT) X-Received: by 10.66.141.197 with SMTP id rq5mr20726926pab.124.1409673067504; Tue, 02 Sep 2014 08:51:07 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ha1si6632017pbd.98.2014.09.02.08.51.06 for ; Tue, 02 Sep 2014 08:51:07 -0700 (PDT) Received-SPF: none (google.com: linux-usb-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754338AbaIBPvF (ORCPT + 2 others); Tue, 2 Sep 2014 11:51:05 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:42970 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753526AbaIBPvE (ORCPT ); Tue, 2 Sep 2014 11:51:04 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s82FowTT019245; Tue, 2 Sep 2014 10:50:58 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s82FowBp017375; Tue, 2 Sep 2014 10:50:58 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Tue, 2 Sep 2014 10:50:57 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s82Fova3018682; Tue, 2 Sep 2014 10:50:57 -0500 Date: Tue, 2 Sep 2014 10:50:52 -0500 From: Felipe Balbi To: Felipe Balbi CC: Alan Stern , Peter Chen , USB list , Subject: Re: [RFC PATCH 0/7] usb: gadget: add reset API at usb_gadget_driver Message-ID: <20140902155051.GI16872@saruman.home> Reply-To: References: <20140829212019.GH16391@saruman.home> <20140902154337.GH16872@saruman.home> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140902154337.GH16872@saruman.home> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Tue, Sep 02, 2014 at 10:43:37AM -0500, Felipe Balbi wrote: > On Tue, Sep 02, 2014 at 11:32:52AM -0400, Alan Stern wrote: > > On Fri, 29 Aug 2014, Felipe Balbi wrote: > > > > > > I still have some old patch files lying around, adding reset callback > > > > support to dummy-hcd, net2280, and net2272. Would you like me to post > > > > them? > > > > > > Please do :-) let's get all of that sorted out soon. > > > > Patches coming up. These were written about two years ago, and > > although they have been forward-ported, I haven't tested them since > > they were written. They are based on a patch you posted on August 16, > > 2012 (usb: gadget: add reset method to struct usb_gadget_driver). > > alright, I still have my branch with that patch together with musb and > dwc3 implementation. The problem I see, though, is that all three of > your patches and my dwc3 and musb implementation conditionally calls > ->disconnect() if the gadget driver doesn't driver doesn't implement > ->reset(). If we're talking about usb_gadget_disconnect() from > ->disconnect(), than all 5 patches will cause regressions. and in fact, the way we discussed way back, ->reset() was supposed to be optinal: commit e95e07648e892bfe811ce2e68ba6e0dc64ae458d Author: Felipe Balbi Date: Wed Aug 15 20:41:40 2012 +0300 usb: gadget: add reset method to struct usb_gadget_driver Some gadget drivers might benefit from having separate ->disconnect and ->reset notifications. For those gadget drivers which don't care, they can implement only ->disconnect and UDC driver is required to call ->disconnect case ->reset isn't valid. Signed-off-by: Felipe Balbi are we changing that too ? diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index c3a6185..7b0661a 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -810,6 +810,10 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget) * when the host is disconnected. May be called in_interrupt; this * may not sleep. Some devices can't detect disconnect, so this might * not be called except as part of controller shutdown. + * @reset: Invoked from reset interrupt handler. This call may not sleep. + * Some gadget drivers might benefit from having a different @reset + * and @disconnect methods. For those which don't provide @reset, + * UDC driver is expected to call @disconnect. * @bind: the driver's bind callback * @unbind: Invoked when the driver is unbound from a gadget, * usually from rmmod (after a disconnect is reported). @@ -871,6 +875,7 @@ struct usb_gadget_driver { int (*setup)(struct usb_gadget *, const struct usb_ctrlrequest *); void (*disconnect)(struct usb_gadget *); + void (*reset)(struct usb_gadget *); void (*suspend)(struct usb_gadget *); void (*resume)(struct usb_gadget *);