From: Sergiu Iordache <sergiu@chromium.org>
To: Marco Stornelli <marco.stornelli@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Sergiu Iordache <sergiu@chromium.org>,
"Ahmed S. Darwish" <darwish.07@gmail.com>,
Artem Bityutskiy <Artem.Bityutskiy@nokia.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] char drivers: ramoops default platform device for module parameter use
Date: Mon, 27 Jun 2011 18:21:51 -0700 [thread overview]
Message-ID: <1309224113-21818-2-git-send-email-sergiu@chromium.org> (raw)
In-Reply-To: <1309224113-21818-1-git-send-email-sergiu@chromium.org>
The introduction of platform data in ramoops resulted in the need to
define a platform device in order to use the ramoops module with module
parameters (without setting any platform data). Sadly this is not clear or
properly documented.
This patch checks if the module parameters are set and declares a platform
device if they are so that the module can be used with module parameters
without any aditional declarations out of the module.
Change-Id: I3cdb0f8e27852ac79e327e526645c9859f19efa8
Signed-off-by: Sergiu Iordache <sergiu@chromium.org>
---
drivers/char/ramoops.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c
index 1a9f5f6..0c3cb42 100644
--- a/drivers/char/ramoops.c
+++ b/drivers/char/ramoops.c
@@ -177,13 +177,33 @@ static struct platform_driver ramoops_driver = {
},
};
+struct platform_device *ramoops_device;
+
static int __init ramoops_init(void)
{
+ /*
+ * If mem_address and mem_size are set (i.e. the module parameters
+ * are used) then a default platform driver is created
+ * as there is no need to configure the platform data elsewhere.
+ */
+ if (mem_address && mem_size) {
+ ramoops_device = platform_device_register_simple("ramoops",
+ -1, NULL, 0);
+
+ if (IS_ERR(ramoops_device)) {
+ printk(KERN_ERR "Unable to register platform device\n");
+ return PTR_ERR(ramoops_device);
+ }
+ }
+
return platform_driver_probe(&ramoops_driver, ramoops_probe);
}
static void __exit ramoops_exit(void)
{
+ /* Unregister the device if it was set */
+ if (ramoops_device)
+ platform_device_unregister(ramoops_device);
platform_driver_unregister(&ramoops_driver);
}
--
1.7.3.1
next prev parent reply other threads:[~2011-06-28 1:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-28 1:21 [PATCH 0/3] char drivers: ramoops improvements Sergiu Iordache
2011-06-28 1:21 ` Sergiu Iordache [this message]
2011-06-28 17:56 ` [PATCH 1/3] char drivers: ramoops default platform device for module parameter use Daniel Baluta
2011-06-28 1:21 ` [PATCH 2/3] char drivers: ramoops dump_oops platform data Sergiu Iordache
2011-06-28 6:30 ` Marco Stornelli
2011-06-28 1:21 ` [PATCH 3/3] char drivers: ramoops record_size module parameter Sergiu Iordache
2011-06-28 6:39 ` Marco Stornelli
2011-06-28 16:38 ` Sergiu Iordache
2011-06-28 17:17 ` Marco Stornelli
2011-06-28 6:27 ` [PATCH 0/3] char drivers: ramoops improvements Marco Stornelli
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=1309224113-21818-2-git-send-email-sergiu@chromium.org \
--to=sergiu@chromium.org \
--cc=Artem.Bityutskiy@nokia.com \
--cc=akpm@linux-foundation.org \
--cc=darwish.07@gmail.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marco.stornelli@gmail.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
all inboxes | Powered by JetHome®