Re: [PATCH 1/1] usb: chipidea: host: add own hc_driver for each hcd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]