linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: linux-gpio@vger.kernel.org
Cc: linux-mips@linux-mips.org, gregory.0xf0@gmail.com,
	jaedon.shin@gmail.com, linus.walleij@linaro.org,
	gnurou@gmail.com, bcm-kernel-feedback-list@broadcom.com,
	Jim Quinlan <jim2101024@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH 1/3] gpio: brcmstb: have driver register during subsys_initcall()
Date: Wed,  6 Jan 2016 10:55:21 -0800	[thread overview]
Message-ID: <1452106523-11556-2-git-send-email-f.fainelli@gmail.com> (raw)
In-Reply-To: <1452106523-11556-1-git-send-email-f.fainelli@gmail.com>

From: Jim Quinlan <jim2101024@gmail.com>

Because regulators are started with subsys_initcall(), and gpio references may
be contained in the regulators, it makes sense to start the brcmstb-gpio's with
a subsys_initcall(). The order within the drivers/Makefile ensures that the
gpio initialization happens prior to the regulator's initialization.

We need to unroll module_platform_driver() now to allow this and have custom
exit and init module functions to control the initialization level.

Signed-off-by: Jim Quinlan <jim2101024@gmail.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/gpio/gpio-brcmstb.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c
index dc3f0395693b..3618b9fd0cba 100644
--- a/drivers/gpio/gpio-brcmstb.c
+++ b/drivers/gpio/gpio-brcmstb.c
@@ -535,7 +535,18 @@ static struct platform_driver brcmstb_gpio_driver = {
 	.probe = brcmstb_gpio_probe,
 	.remove = brcmstb_gpio_remove,
 };
-module_platform_driver(brcmstb_gpio_driver);
+
+static int __init brcmstb_gpio_init(void)
+{
+	return platform_driver_register(&brcmstb_gpio_driver);
+}
+subsys_initcall(brcmstb_gpio_init);
+
+static void __exit brcmstb_gpio_exit(void)
+{
+	platform_driver_unregister(&brcmstb_gpio_driver);
+}
+module_exit(brcmstb_gpio_exit);
 
 MODULE_AUTHOR("Gregory Fong");
 MODULE_DESCRIPTION("Driver for Broadcom BRCMSTB SoC UPG GPIO");
-- 
2.1.0


  reply	other threads:[~2016-01-06 18:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-06 18:55 [PATCH 0/3] gpio: brcmstb: Misc changes Florian Fainelli
2016-01-06 18:55 ` Florian Fainelli [this message]
2016-01-07  6:05   ` [PATCH 1/3] gpio: brcmstb: have driver register during subsys_initcall() Gregory Fong
2016-01-07 18:12     ` Florian Fainelli
2016-01-19 21:18       ` Jim Quinlan
2016-01-20  9:40         ` Gregory Fong
2016-01-20 15:30           ` Jim Quinlan
2016-01-07 15:28   ` Linus Walleij
2016-01-06 18:55 ` [PATCH 2/3] gpio: brcmstb: Set endian flags for big-endian MIPS Florian Fainelli
2016-01-07  8:08   ` Gregory Fong
2016-01-07 15:26   ` Linus Walleij
2016-01-06 18:55 ` [PATCH 3/3] gpio: brcmstb: Allow building driver for BMIPS_GENERIC Florian Fainelli
2016-01-07  8:12   ` Gregory Fong
2016-01-07 15:27   ` Linus Walleij

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=1452106523-11556-2-git-send-email-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=gnurou@gmail.com \
    --cc=gregory.0xf0@gmail.com \
    --cc=jaedon.shin@gmail.com \
    --cc=jim2101024@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    /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).