msm: rtb: Convert RTB to platform device
Rather than have the size for rtb fixed in the driver,
make rtb be a platform device so the size can be passed
in as platform data. A module parameter isn't enough
since the contiguous block of memory needs to be pre-reserved.
Change-Id: I0c8f9534bb5a86f2573c85df6be7a236ff1d3691
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
diff --git a/arch/arm/mach-msm/msm_rtb.c b/arch/arm/mach-msm/msm_rtb.c
index f93a79b..6e79dfe 100644
--- a/arch/arm/mach-msm/msm_rtb.c
+++ b/arch/arm/mach-msm/msm_rtb.c
@@ -16,6 +16,7 @@
#include <linux/kernel.h>
#include <linux/memory_alloc.h>
#include <linux/module.h>
+#include <linux/platform_device.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/string.h>
@@ -64,7 +65,6 @@
#endif
struct msm_rtb_state msm_rtb = {
- .size = SZ_1M,
.filter = 1 << LOGK_LOGBUF,
};
@@ -107,16 +107,6 @@
start->data = data;
}
-static int __init msm_rtb_set_buffer_size(char *p)
-{
- int s;
-
- s = memparse(p, NULL);
- msm_rtb.size = ALIGN(s, SZ_4K);
- return 0;
-}
-early_param("msm_rtb_size", msm_rtb_set_buffer_size);
-
#if defined(CONFIG_MSM_RTB_SEPARATE_CPUS)
static int msm_rtb_get_idx(void)
{
@@ -178,12 +168,15 @@
}
EXPORT_SYMBOL(uncached_logk);
-int msm_rtb_init(void)
+int msm_rtb_probe(struct platform_device *pdev)
{
+ struct msm_rtb_platform_data *d = pdev->dev.platform_data;
#if defined(CONFIG_MSM_RTB_SEPARATE_CPUS)
unsigned int cpu;
#endif
+ msm_rtb.size = d->size;
+
if (msm_rtb.size <= 0 || msm_rtb.size > SZ_1M)
return -EINVAL;
@@ -227,4 +220,22 @@
msm_rtb.enabled = 1;
return 0;
}
+
+static struct platform_driver msm_rtb_driver = {
+ .driver = {
+ .name = "msm_rtb",
+ .owner = THIS_MODULE
+ },
+};
+
+static int __init msm_rtb_init(void)
+{
+ return platform_driver_probe(&msm_rtb_driver, msm_rtb_probe);
+}
+
+static void __exit msm_rtb_exit(void)
+{
+ platform_driver_unregister(&msm_rtb_driver);
+}
module_init(msm_rtb_init)
+module_exit(msm_rtb_exit)