Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754327AbbDTHAv (ORCPT ); Mon, 20 Apr 2015 03:00:51 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:59637 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751520AbbDTHAt (ORCPT ); Mon, 20 Apr 2015 03:00:49 -0400 Message-ID: <5534A414.4070401@ti.com> Date: Mon, 20 Apr 2015 10:00:36 +0300 From: Roger Quadros User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Alan Stern CC: Peter Chen , , , , , , , , , Subject: Re: [RFC][PATCH v2 06/13] usb: hcd: Add hcd add/remove functions for OTG use References: In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1972 Lines: 51 On 17/04/15 17:03, Alan Stern wrote: > On Fri, 17 Apr 2015, Roger Quadros wrote: > >> On 17/04/15 05:18, Peter Chen wrote: >>> On Tue, Apr 14, 2015 at 01:41:53PM +0300, Roger Quadros wrote: >>>> The existing usb_add/remove_hcd() functionality >>>> remains unchanged for non-OTG devices. For OTG >>>> devices they only register the HCD with the OTG core. >>>> >>>> Introduce _usb_add/remove_hcd() for use by OTG core. >>>> These functions actually add/remove the HCD. >>> >>> Would you please explain why additional _usb_add/remove_hcd are needed? >> >> It is to differentiate if the add/remove_hcd was called by the >> HCD drivers or by the OTG core as we want to behave a bit differently >> in both cases. >> When called by HCD drivers, we want to defer the add/remove if it is an >> OTG device. When called by OTG core, we don't want to defer the add/remove. > > I don't understand this. Why do you want to defer the add/remove if > the device is OTG? Don't host controller drivers expect these things > to execute synchronously? Sorry for the wrong information. We actually defer only the add as the OTG state machine might not yet be in Host ready mode. The remove is always synchronous and we ensure that the HCD is removed when usb_otg_unregister_hcd() returns. > > For example, what happens if you rmmod the HCD? If the remove call > gets deferred, then when it finally runs it will try to call back into > HCD code that has already been unloaded from memory! > >> HCD drivers use usb_add/remove_hcd() >> OTG core uses _usb_add/remove_hcd() > > How about a more explicit naming scheme? > > HC drivers use usb_add/remove_hcd() > OTG core uses usb_otg_add/remove_hcd() Yes, this is better. cheers, -roger -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/