From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-bn1bon0116.outbound.protection.outlook.com ([157.56.111.116]:55296 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757128AbbGUBG0 (ORCPT ); Mon, 20 Jul 2015 21:06:26 -0400 Date: Tue, 21 Jul 2015 07:56:55 +0800 From: Peter Chen To: Alan Stern CC: , Jun Li , Subject: Re: [PATCH 1/1] usb: chipidea: host: add own hc_driver for each hcd Message-ID: <20150720235654.GB5715@shlinux2> References: <20150720020732.GD4584@shlinux2> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: Sender: stable-owner@vger.kernel.org List-ID: On Mon, Jul 20, 2015 at 11:37:11AM -0400, Alan Stern wrote: > On Mon, 20 Jul 2015, Peter Chen wrote: > > > > I don't think a new use case is needed. All you have to do is add > > > something like this to host.c: > > > > > > static void ci_hdrc_host_driver_init(void) > > > { > > > ehci_init_driver(&ci_ehci_hc_driver, &ehci_ci_overrides); > > By the way, right here I forgot to include: > > orig_bus_suspend = ci_ehci_hc_driver.bus_suspend; > ci_ehci_hc_driver.bus_suspend = ci_ehci_bus_suspend; > > > > } > > > module_init(ci_hdrc_host_driver_init); > > > > > > Can you think of any reason this won't work? > > > > > > > No, it will not work. The core driver's probe will run which will > > call host_start to call ehci APIs before ci_hdrc_host_driver_init > > is called. > > Ah, I see the difficulty. core.c does > pci_register_driver(&ehci_pci_driver). That will have to be different. > Let's change that line to this: > > static int __init ci_hdrc_driver_init(void) > { > ci_hdrc_host_driver_init(); > return platform_register_driver(&ci_hdrc_driver); > } > module_init(ci_hdrc_driver_init); > > static void __exit ci_hdrc_driver_cleanup(void) > { > platform_unregister_driver(&ci_hdrc_driver); > } > module_exit(ci_hdrc_driver_cleanup); > > Then in host.c, make ci_hdrc_host_driver_init non-static. > > This should work, because the core's probe routine can't be called > before it is registered as a platform driver, and that doesn't happen > until after ehci_init_driver is called. > Yes, this should work, thanks. -- Best Regards, Peter Chen