From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754790AbbIIDgF (ORCPT ); Tue, 8 Sep 2015 23:36:05 -0400 Received: from mail-bl2on0130.outbound.protection.outlook.com ([65.55.169.130]:29726 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754061AbbIIDfy (ORCPT ); Tue, 8 Sep 2015 23:35:54 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=freescale.com; Date: Wed, 9 Sep 2015 10:23:37 +0800 From: Peter Chen To: Roger Quadros CC: , , , , , , , , , , , Subject: Re: [PATCH v4 10/13] usb: hcd: Adapt to OTG core Message-ID: <20150909022336.GG7802@shlinux2> References: <1440422484-4737-1-git-send-email-rogerq@ti.com> <1440422484-4737-11-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1440422484-4737-11-git-send-email-rogerq@ti.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD009;1:h2lIc5PNCFtMyI/esCwW40hYtWWrfWWMe8LWU3lgMSj27ec0ruvVkSPMtBc+rjFLFKykfhv28RInWXOuS1utZJJEdxfHxdTPfu466Kcv8CpUxovKRALSRC4kFDd/BXzlvnH9vmrCYIa39tgoDXkwXHyqRH0LhcKsOvF5q/EVzq8NBVIV7kdI03Yqw6PnLMjE7XQebb8pZ6/MosXdCKsTlyguPTYGYlTeAaW9gGCMWEv6wD0FpLwsMkfGAFvuYEIS3GqtwAj3gdIfXFtAp1QKK3x47CbYeppyGA4sDKH5DJHydnhaGSfzHYFSFu1qStcSqN2TuR1kimeMUt5OPNoIv8NGVqf4JpPrOQWt+g5EWpdTJ4Y95ePwFs/3vz3kgZvHfxRayl8DPNzgxygc4GHBQjokfSDOSYNfEl1tAY1/TEA= X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(1109001)(1110001)(339900001)(24454002)(189002)(199003)(189998001)(68736005)(105606002)(5001830100001)(62966003)(5007970100001)(6806004)(46406003)(23726002)(76176999)(33656002)(106466001)(77096005)(110136002)(11100500001)(50986999)(54356999)(2950100001)(5001960100002)(5001860100001)(97736004)(85426001)(46102003)(4001350100001)(575784001)(92566002)(81156007)(19580395003)(86362001)(19580405001)(77156002)(83506001)(4001540100001)(47776003)(33716001)(97756001)(64706001)(104016003)(50466002)(87936001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR0301MB1223;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1223;2:Y8TocGaDN2TQm/QeAUU0fqtXF2nvDTi2BGFOjyHHhUaMlICotBYjCzUCINH8rbm58pBjpWjA1FU9BRDJTG8vRBUkFblXkpxdHvHElr764UKiVkmahIF+Jsm2kmlkaGKCjlWomClYWFfGubwAx3c/OvmW+CPzkrWV4AbW/aO8OwQ=;3:8O9XRC/aYrGGj2vX914frGy3MYxedXyzq//GZ64fCulYhr82xhr0KQj1SJXy2G6OsZHrpU+ZDBrYIkhT/LeGR6aQVvQursNrna1e/TCT95fhH+V551xaQMLZR5z6yHtRDCycDxES58AYCt9D5OdEz7ADtMkyLLPBXafZV+zynydDJCvRPez8RwB9qudR+g7v9D0hQEjDhmxo14d+KZZ6DFtWJnP4vgmkH/LVdgiA3RQ=;25:Cv5TJJa5+d+NvcQ91Xaqc3o3fLcjYb56X8rXWR4bAx0B+vy9ajnQJq0jAkH+jMVA3IRXP7JGC+Q6omGFpICcquGOst+nb/47j4RWlUunZr7pF7SQkZ5LykGRmJR7n7otxJD3hjg98TvTm1zekwK8Is+MEfpTIw7+oeJgqIyRv/K7eSDfybixUsurmqXg5g84IXVGfgBNkNKPTKRCk7bJPh+f2Q5pG3i88cGbtC27vpppgdcLZlYYAbKt4TqvBIPTpWz95IPwrzuJiKbWwJO7jA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1223; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1223;20:+lRG2yVEPrr44Q5wWQZBIiClYm+kbtUHQ+KKkUsxIjYFY6vJiOOzONFm9fa8x6qGcdWQAWQRr5uF4OnIjITHtn+AajTauev5lcGQtK9dyJFASF4ItJ+2Jq06cFe/MxiHeTq3raHuKl1WXbmdw/UZD4XvYtYCvo8JDe9GhTjcwEpbj/DYiXYhmJxYPUBc5n5+GXrldnW3Jnrfp03cTh5bOgI6rfiAw0fqlWnaYb0BaTBeVXDln4shLtW4/Toi6hzdAsW2Z7eUQfaJSInPybIma46F3pPH8hShnXF0RB9qe0VRpWv5HHv675cqg0WBwzAzFndlwnRND4AkZTOJ0+0PMzGzV6b5DQOsORFfnAk3vAI=;4:D1bTjQIzjawBeEDsqhIu1OPTtBMAJ3dWoVQLVlBUmpkE4tCPXiTloLh0HxIArokZo17pAMQ/qZp00TLKCzJaVDklvt399nta8aWSKBfdW/y+nFowiKSOiM3lj6i3cA3fAX2LfT66T8Qk/2n8IekmgGFUe+xTNUzWKDymXfPOUJTYIGROs1Evxk0dGTbQ/fWYPpGhDaQ7bNr4+no3cb424txEWyrxlYj2F674obG6Zxr6GwWuMn05Oa7qSfQ8I3mbr2CI2TClGAaCG/7mHwBIorY1T/GWXfNMWRbFp0QoFxFOiQaskbbYASdBAyuteH4+ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(8121501046)(3002001);SRVR:BY1PR0301MB1223;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1223; X-Forefront-PRVS: 0694C54398 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY1PR0301MB1223;23:H4nzJ9BwJMVCRrh3VRvh2npQOjtSA1kmAzZG53G?= =?us-ascii?Q?7u7ZnMPge9Rw43yAFemxKcIhtZF53z9UaNPSGoCGHmtQOCP4BuizYADm4Xpb?= =?us-ascii?Q?fAADKkNHDD+jaK+ALZck64Vjy6GC00tCVX0gt/tv33q01go3HvIRIspZ5ELI?= =?us-ascii?Q?z1OlS4nXtXf0OCQ8tqmsz+zOHM22X92Quungdv6Kp+lc8jMtjwYLcAQjuTo8?= =?us-ascii?Q?CZR8gFxwv850cvruqt3TiohkRGTZcZtuOASTo+kaUyoYfKbPFi3ERPH0YKMw?= =?us-ascii?Q?uD5Zh30bSpOnbip2cbmbb+/SnZuNbYetaVGhDj0xxqqSeUREbMv/rvdMjtPO?= =?us-ascii?Q?3eVITh1Z0Gj9vkxlr31AdO3BO3HiO6eIkya+kRQbw1WR3CMdmXqBtOn3+UGa?= =?us-ascii?Q?XxtTSucbF48Lce7KFDY/uqRRkn73NTtIZq4ETGfCRNxx+2l2XIiefIajV5j5?= =?us-ascii?Q?hzBfd0F054Lq2U+EqGWfl4z2A7QCWP/Fz+Wg/kqwOBTyLDyKC1O+pj0vYY7W?= =?us-ascii?Q?NzWPi/rLXTPdFqlq9M/ve2g/RoW74bOHC3r0HVLsuW/eXqkLyNVuJSMlCQM1?= =?us-ascii?Q?0XAaa6sdsbxpAtZnb1D5QpulM9rdx6GR0sNbn0cFu9d1q6ZhzURjhG33Te8C?= =?us-ascii?Q?1V0iQKeGIoMzBFil5EF9/ZzxBjoy77D+IZDSRJI8r9fnj4fhOgBFrIH8yHPo?= =?us-ascii?Q?8jNP/HfXupunANx88rm7G7Wx8c9PlP8p4cdPqLmfXnxxbIHT3hG1be3cY+Zl?= =?us-ascii?Q?wG1v7py9PS9+C5aJmaEKmM/LfNJDEtMI46f7eUM5S1oBbMJQKDFluaWrCmRb?= =?us-ascii?Q?YoYv7Po8tXx+M3xeded5hYrXBfdGadp+xu5aTTvWGL7ntjrvhX+9qLzD7Xr7?= =?us-ascii?Q?c9s933/W6YvVmLUUrBF8UmeFIAApYNr65nAyBKMEPEdYxhLNtJh70jo2b/RO?= =?us-ascii?Q?Kw6GjyJokLun8/nV3hOTD/fn3OWL0eiMBi9zY9z3UM2BmMD9voGMnyh6mbEF?= =?us-ascii?Q?fl8tXBj41OEKBJLLr6il3MTtv3IrA728sKtpu57FqDIXv0U21U9jWENzYH8d?= =?us-ascii?Q?Y0lQo9KbCcCTGHk/knL+Q36VHgiUa7Eagi/2J84+Wko0jSlhIWAZvz4vIUV4?= =?us-ascii?Q?pF/M6b7XU0R1yNjR+vYYlcZ2wTP57iP70c9PvzqNXM2ORLsU1jplibEKGNd/?= =?us-ascii?Q?kG3p/fNmKQpHra/Jb8//1f4TcxxvCzKfqZs4QKdzLwedvtGLxMFFkjsgGAYA?= =?us-ascii?Q?XcKmk6H2KVH8HkPSK7M6MffiUPLy78QjqKbQ+B+ef?= X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1223;5:HGKDM1PM0w7P8iDO5dwbcDQeKkXJxnBSJw/hKj5YuYrSa6oZTG9s+KKi0OAAXLlwl/8seZie/wgk4wfRLJ+uUcT+jvx0fMs2wqm7b783sV0jhv44oM6hsBS/3TuhrFTl+UP0OYoacZgL/VBQXeS59Q==;24:CXXiWYqu8d+ZUJqbnZpgXgJLbuQw58gVXaFWnt68p0HxgKbFqNUNyH98mW1SSUmyZCJTnFY7tljU180IdvM94bsXo0MgUtwgSVV+qymxWks=;20:QaSCwTmgJ5prHISH9NUVJSZhYlhzwzoa1Bnu8VOOkhel1jJSlTuctvDwPCb43j4HHaGDOO1lsa6mvmD78pf0Ig== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2015 03:35:50.3063 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1223 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 24, 2015 at 04:21:21PM +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_otg_add/remove_hcd() for use by OTG core. > These functions actually add/remove the HCD. > > Signed-off-by: Roger Quadros > --- > drivers/usb/core/hcd.c | 55 +++++++++++++++++++++++++++++++++++++++++++++----- > 1 file changed, 50 insertions(+), 5 deletions(-) > > diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c > index c0fd1f6..4851682 100644 > --- a/drivers/usb/core/hcd.c > +++ b/drivers/usb/core/hcd.c > @@ -46,6 +46,7 @@ > #include > #include > #include > +#include > > #include "usb.h" > > @@ -2625,8 +2626,8 @@ static void usb_put_invalidate_rhdev(struct usb_hcd *hcd) > * buffers of consistent memory, register the bus, request the IRQ line, > * and call the driver's reset() and start() routines. > */ > -int usb_add_hcd(struct usb_hcd *hcd, > - unsigned int irqnum, unsigned long irqflags) > +static int usb_otg_add_hcd(struct usb_hcd *hcd, > + unsigned int irqnum, unsigned long irqflags) You may change the kernel doc to this name too. > { > int retval; > struct usb_device *rhdev; > @@ -2839,17 +2840,16 @@ err_phy: > } > return retval; > } > -EXPORT_SYMBOL_GPL(usb_add_hcd); > > /** > - * usb_remove_hcd - shutdown processing for generic HCDs > + * usb_otg_remove_hcd - shutdown processing for generic HCDs > * @hcd: the usb_hcd structure to remove > * Context: !in_interrupt() > * > * Disconnects the root hub, then reverses the effects of usb_add_hcd(), > * invoking the HCD's stop() method. > */ > -void usb_remove_hcd(struct usb_hcd *hcd) > +static void usb_otg_remove_hcd(struct usb_hcd *hcd) > { > struct usb_device *rhdev = hcd->self.root_hub; > > @@ -2923,6 +2923,51 @@ void usb_remove_hcd(struct usb_hcd *hcd) > > usb_put_invalidate_rhdev(hcd); > } > + > +static struct otg_hcd_ops otg_hcd_intf = { > + .add = usb_otg_add_hcd, > + .remove = usb_otg_remove_hcd, > +}; > + > +/** > + * usb_add_hcd - finish generic HCD structure initialization and register > + * @hcd: the usb_hcd structure to initialize > + * @irqnum: Interrupt line to allocate > + * @irqflags: Interrupt type flags > + * > + * Finish the remaining parts of generic HCD initialization: allocate the > + * buffers of consistent memory, register the bus, request the IRQ line, > + * and call the driver's reset() and start() routines. > + * If it is an OTG device then it only registers the HCD with OTG core. > + * > + */ > +int usb_add_hcd(struct usb_hcd *hcd, > + unsigned int irqnum, unsigned long irqflags) > +{ > + /* If OTG device, OTG core takes care of adding HCD */ > + if (usb_otg_register_hcd(hcd, irqnum, irqflags, &otg_hcd_intf)) > + return usb_otg_add_hcd(hcd, irqnum, irqflags); > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(usb_add_hcd); > + > +/** > + * usb_remove_hcd - shutdown processing for generic HCDs > + * @hcd: the usb_hcd structure to remove > + * Context: !in_interrupt() > + * > + * Disconnects the root hub, then reverses the effects of usb_add_hcd(), > + * invoking the HCD's stop() method. > + * If it is an OTG device then it unregisters the HCD from OTG core > + * as well. > + */ > +void usb_remove_hcd(struct usb_hcd *hcd) > +{ > + /* If OTG device, OTG core takes care of stopping HCD */ > + if (usb_otg_unregister_hcd(hcd)) > + usb_otg_remove_hcd(hcd); > +} > EXPORT_SYMBOL_GPL(usb_remove_hcd); > > void > -- > 2.1.4 > -- Best Regards, Peter Chen