From: sudeep.holla@arm.com (Sudeep Holla)
To: linux-arm-kernel@lists.infradead.org
Subject: [RESEND][PATCH 4/4] firmware: meson-sm: rework meson_sm_init to use module_platform_driver_probe
Date: Thu, 28 Sep 2017 11:46:02 +0100 [thread overview]
Message-ID: <1506595562-10592-5-git-send-email-sudeep.holla@arm.com> (raw)
In-Reply-To: <1506595562-10592-1-git-send-email-sudeep.holla@arm.com>
Now that of_platform_default_populate_init() takes care of populating
all the devices under the /firmware/ node, this patch reworks
meson_sm_init in favour of module_platform_driver_probe.
Cc: Carlo Caione <carlo@caione.org>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: linux-amlogic at lists.infradead.org
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
drivers/firmware/meson/meson_sm.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
index ff204421117b..ccd61be0dd49 100644
--- a/drivers/firmware/meson/meson_sm.c
+++ b/drivers/firmware/meson/meson_sm.c
@@ -17,8 +17,10 @@
#include <linux/arm-smccc.h>
#include <linux/bug.h>
#include <linux/io.h>
+#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
+#include <linux/platform_device.h>
#include <linux/printk.h>
#include <linux/types.h>
#include <linux/sizes.h>
@@ -217,17 +219,11 @@ static const struct of_device_id meson_sm_ids[] = {
{ /* sentinel */ },
};
-int __init meson_sm_init(void)
+static int __init meson_sm_probe(struct platform_device *pdev)
{
const struct meson_sm_chip *chip;
- const struct of_device_id *matched_np;
- struct device_node *np;
- np = of_find_matching_node_and_match(NULL, meson_sm_ids, &matched_np);
- if (!np)
- return -ENODEV;
-
- chip = matched_np->data;
+ chip = of_match_device(meson_sm_ids, &pdev->dev)->data;
if (!chip) {
pr_err("unable to setup secure-monitor data\n");
goto out;
@@ -257,4 +253,11 @@ int __init meson_sm_init(void)
out:
return -EINVAL;
}
-device_initcall(meson_sm_init);
+
+static struct platform_driver meson_sm_driver = {
+ .driver = {
+ .name = "meson-sm",
+ .of_match_table = of_match_ptr(meson_sm_ids),
+ },
+};
+module_platform_driver_probe(meson_sm_driver, meson_sm_probe);
--
2.7.4
next prev parent reply other threads:[~2017-09-28 10:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-28 10:45 [RESEND][PATCH 0/4] firmware: of: populate /firmware/ node during init Sudeep Holla
2017-09-28 10:45 ` [RESEND][PATCH 1/4] of: platform: populate /firmware/ node from of_platform_default_populate_init() Sudeep Holla
2017-10-16 22:44 ` Frank Rowand
2017-10-17 13:02 ` Rob Herring
2017-10-23 15:59 ` Sudeep Holla
2017-12-26 21:26 ` Bjorn Andersson
2017-09-28 10:46 ` [RESEND][PATCH 2/4] firmware: qcom_scm: drop redandant of_platform_populate Sudeep Holla
2017-09-28 10:46 ` [RESEND][PATCH 3/4] drivers: tee: rework optee_driver_{init, exit} to use platform device Sudeep Holla
2017-09-28 10:46 ` Sudeep Holla [this message]
2017-10-16 22:44 ` [RESEND][PATCH 0/4] firmware: of: populate /firmware/ node during init Frank Rowand
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=1506595562-10592-5-git-send-email-sudeep.holla@arm.com \
--to=sudeep.holla@arm.com \
--cc=linux-arm-kernel@lists.infradead.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).