From: Peter Chen <peter.chen@freescale.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: <linux-usb@vger.kernel.org>, Jun Li <jun.li@freescale.com>,
<stable@vger.kernel.org>
Subject: Re: [PATCH 1/1] usb: chipidea: host: add own hc_driver for each hcd
Date: Tue, 21 Jul 2015 07:56:55 +0800 [thread overview]
Message-ID: <20150720235654.GB5715@shlinux2> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1507201119530.10748-100000@netrider.rowland.org>
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
prev parent reply other threads:[~2015-07-21 1:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-17 7:40 [PATCH 1/1] usb: chipidea: host: add own hc_driver for each hcd Peter Chen
2015-07-17 13:52 ` Alan Stern
2015-07-20 0:37 ` Peter Chen
2015-07-20 2:22 ` Alan Stern
2015-07-20 2:07 ` Peter Chen
2015-07-20 15:37 ` Alan Stern
2015-07-20 23:56 ` Peter Chen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150720235654.GB5715@shlinux2 \
--to=peter.chen@freescale.com \
--cc=jun.li@freescale.com \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).