Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755800AbcDGKk4 (ORCPT ); Thu, 7 Apr 2016 06:40:56 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:42432 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755683AbcDGKky (ORCPT ); Thu, 7 Apr 2016 06:40:54 -0400 Subject: Re: [PATCH v6 01/12] usb: hcd: Initialize hcd->flags to 0 To: Peter Chen References: <1459865117-7032-1-git-send-email-rogerq@ti.com> <1459865117-7032-2-git-send-email-rogerq@ti.com> <87zit72rqz.fsf@intel.com> <5704AD76.9080806@ti.com> <20160407094246.GA9963@shlinux2.ap.freescale.net> CC: Felipe Balbi , , , , , , , , , , , , From: Roger Quadros Message-ID: <57063915.7000700@ti.com> Date: Thu, 7 Apr 2016 13:40:21 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160407094246.GA9963@shlinux2.ap.freescale.net> 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: 1516 Lines: 42 On 07/04/16 12:42, Peter Chen wrote: > On Wed, Apr 06, 2016 at 09:32:22AM +0300, Roger Quadros wrote: >> On 06/04/16 09:09, Felipe Balbi wrote: >>> >>> Hi, >>> >>> Roger Quadros writes: >>>> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c >>>> index 2ca2cef..6b1930d 100644 >>>> --- a/drivers/usb/core/hcd.c >>>> +++ b/drivers/usb/core/hcd.c >>>> @@ -2706,6 +2706,7 @@ int usb_add_hcd(struct usb_hcd *hcd, >>>> int retval; >>>> struct usb_device *rhdev; >>>> >>>> + hcd->flags = 0; >>> > > I am not sure if this usb_add(remove)_hcd pair is safe and clean enough > for start/stop host role. From my point, we may need to do like > .probe/.remove host platform driver interface. In that case, we can make probe and remove are meant to be called from bus layer. I do not see a way how OTG framework can call probe/remove of HCD driver. Some HCDs may be platform devices, some PCI, so different entities are calling the HCD .probe hook. > sure the clocks and regulators are off, and hcd will be zero-initialized why can't we make that sure that is taken care of within the hcd_ops? Why should some driver keep its regulators and clocks enabled when hcd is stopped? It doesn't need to. If it is doing so now, it needs to be fixed. > next time. Assume we are at gadget mode, we may not hope the vbus regulator > is still on which is for host only. So, this part may need to implement > by each user. > Yes, correctness of this has to be taken care by each driver. cheers, -roger