From: Bjorn Helgaas <helgaas@kernel.org>
To: Wei Yongjun <weiyj.lk@gmail.com>
Cc: Pratyush Anand <pratyush.anand@gmail.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Wei Yongjun <weiyongjun1@huawei.com>,
linux-pci@vger.kernel.org,
Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: Re: [PATCH -next] PCI: spear: Use builtin_platform_driver to simplify the code
Date: Wed, 14 Sep 2016 16:50:03 -0500 [thread overview]
Message-ID: <20160914215003.GE16581@localhost> (raw)
In-Reply-To: <1473510634-23872-1-git-send-email-weiyj.lk@gmail.com>
[+cc Paul]
On Sat, Sep 10, 2016 at 12:30:34PM +0000, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
>
> Use the builtin_platform_driver() macro to make the code simpler.
>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
> drivers/pci/host/pcie-spear13xx.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-spear13xx.c b/drivers/pci/host/pcie-spear13xx.c
> index 09aed85..1c957eb 100644
> --- a/drivers/pci/host/pcie-spear13xx.c
> +++ b/drivers/pci/host/pcie-spear13xx.c
> @@ -364,8 +364,4 @@ static struct platform_driver spear13xx_pcie_driver = {
> },
> };
>
> -static int __init spear13xx_pcie_init(void)
> -{
> - return platform_driver_register(&spear13xx_pcie_driver);
> -}
> -device_initcall(spear13xx_pcie_init);
> +builtin_platform_driver(spear13xx_pcie_driver);
Hmm. It looks like maybe we could use builtin_platform_driver_probe()?
In most or all of the drivers/pci/host drivers?
If you want to do that, please base your patches on my
pci/demodularize branch, since that's where I would apply them.
I have to say that the plethora of helper macros is getting a little
confusing:
module_driver
module_platform_driver
module_platform_driver_probe
module_pci_driver
...
builtin_driver
builtin_platform_driver
builtin_platform_driver_probe
builtin_pci_driver
...
Actually, seeing the list organized like this makes me feel better,
like there really is some underlying structure here. It's just hard
to discover in the middle of all the comments and CPP magic.
It is kind of amusing that each one has a big comment header like:
/* module_platform_driver_probe() - Helper macro for drivers that don't do
* anything special in module init/exit. This eliminates a lot of
* boilerplate. Each module may only use this macro once, and
* calling it replaces module_init() and module_exit()
*/
It amuses me that the comments about eliminating boilerplate are
*themselves* boilerplate. I guess I'm easily amused.
Bjorn
prev parent reply other threads:[~2016-09-14 21:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-10 12:30 [PATCH -next] PCI: spear: Use builtin_platform_driver to simplify the code Wei Yongjun
2016-09-14 21:50 ` Bjorn Helgaas [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=20160914215003.GE16581@localhost \
--to=helgaas@kernel.org \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
--cc=paul.gortmaker@windriver.com \
--cc=pratyush.anand@gmail.com \
--cc=weiyj.lk@gmail.com \
--cc=weiyongjun1@huawei.com \
/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).