msm: qdss: separate initialization of different drivers
Let all drivers (etm, etb, funnel, tpiu, qdss) initialize separately
to allow them to initialize at different initcall levels when required.
Change-Id: I6b0a36785f2e114cb1ac209fb0c2209733ad38dd
Signed-off-by: Pratik Patel <pratikp@codeaurora.org>
diff --git a/arch/arm/mach-msm/qdss-etb.c b/arch/arm/mach-msm/qdss-etb.c
index 8b5f8db..96eba26 100644
--- a/arch/arm/mach-msm/qdss-etb.c
+++ b/arch/arm/mach-msm/qdss-etb.c
@@ -318,7 +318,7 @@
return ret;
}
-static void etb_sysfs_exit(void)
+static void __exit etb_sysfs_exit(void)
{
sysfs_remove_file(etb.kobj, &trigger_cntr_attr.attr);
kobject_put(etb.kobj);
@@ -371,7 +371,7 @@
return ret;
}
-static int etb_remove(struct platform_device *pdev)
+static int __devexit etb_remove(struct platform_device *pdev)
{
if (etb.enabled)
etb_disable();
@@ -386,18 +386,23 @@
static struct platform_driver etb_driver = {
.probe = etb_probe,
- .remove = etb_remove,
+ .remove = __devexit_p(etb_remove),
.driver = {
.name = "msm_etb",
},
};
-int __init etb_init(void)
+static int __init etb_init(void)
{
return platform_driver_register(&etb_driver);
}
+module_init(etb_init);
-void etb_exit(void)
+static void __exit etb_exit(void)
{
platform_driver_unregister(&etb_driver);
}
+module_exit(etb_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("CoreSight Embedded Trace Buffer driver");
diff --git a/arch/arm/mach-msm/qdss-etm.c b/arch/arm/mach-msm/qdss-etm.c
index eeb7519..1af6a76 100644
--- a/arch/arm/mach-msm/qdss-etm.c
+++ b/arch/arm/mach-msm/qdss-etm.c
@@ -1151,14 +1151,14 @@
return ret;
}
-static void etm_sysfs_exit(void)
+static void __exit etm_sysfs_exit(void)
{
sysfs_remove_group(etm.kobj, &etm_attr_grp);
sysfs_remove_file(etm.kobj, &enabled_attr.attr);
kobject_put(etm.kobj);
}
-static bool etm_arch_supported(uint8_t arch)
+static bool __init etm_arch_supported(uint8_t arch)
{
switch (arch) {
case PFT_ARCH_V1_1:
@@ -1286,7 +1286,7 @@
return ret;
}
-static int etm_remove(struct platform_device *pdev)
+static int __devexit etm_remove(struct platform_device *pdev)
{
if (etm.enabled)
etm_disable();
@@ -1301,7 +1301,7 @@
static struct platform_driver etm_driver = {
.probe = etm_probe,
- .remove = etm_remove,
+ .remove = __devexit_p(etm_remove),
.driver = {
.name = "msm_etm",
},
@@ -1311,8 +1311,13 @@
{
return platform_driver_register(&etm_driver);
}
+module_init(etm_init);
-void etm_exit(void)
+void __exit etm_exit(void)
{
platform_driver_unregister(&etm_driver);
}
+module_exit(etm_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("CoreSight Program Flow Trace driver");
diff --git a/arch/arm/mach-msm/qdss-funnel.c b/arch/arm/mach-msm/qdss-funnel.c
index 990295b..2d80603 100644
--- a/arch/arm/mach-msm/qdss-funnel.c
+++ b/arch/arm/mach-msm/qdss-funnel.c
@@ -159,7 +159,7 @@
return ret;
}
-static void funnel_sysfs_exit(void)
+static void __exit funnel_sysfs_exit(void)
{
sysfs_remove_file(funnel.kobj, &priority_attr.attr);
kobject_put(funnel.kobj);
@@ -197,7 +197,7 @@
return ret;
}
-static int funnel_remove(struct platform_device *pdev)
+static int __devexit funnel_remove(struct platform_device *pdev)
{
if (funnel.enabled)
funnel_disable(0x0, 0xFF);
@@ -210,18 +210,23 @@
static struct platform_driver funnel_driver = {
.probe = funnel_probe,
- .remove = funnel_remove,
+ .remove = __devexit_p(funnel_remove),
.driver = {
.name = "msm_funnel",
},
};
-int __init funnel_init(void)
+static int __init funnel_init(void)
{
return platform_driver_register(&funnel_driver);
}
+module_init(funnel_init);
-void funnel_exit(void)
+static void __exit funnel_exit(void)
{
platform_driver_unregister(&funnel_driver);
}
+module_exit(funnel_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("CoreSight Funnel driver");
diff --git a/arch/arm/mach-msm/qdss-priv.h b/arch/arm/mach-msm/qdss-priv.h
index b9f3072..f39bc52 100644
--- a/arch/arm/mach-msm/qdss-priv.h
+++ b/arch/arm/mach-msm/qdss-priv.h
@@ -58,15 +58,6 @@
#define BMVAL(val, lsb, msb) ((val & BM(lsb, msb)) >> lsb)
#define BVAL(val, n) ((val & BIT(n)) >> n)
-int etb_init(void);
-void etb_exit(void);
-int tpiu_init(void);
-void tpiu_exit(void);
-int funnel_init(void);
-void funnel_exit(void);
-int etm_init(void);
-void etm_exit(void);
-
void etb_enable(void);
void etb_disable(void);
void etb_dump(void);
diff --git a/arch/arm/mach-msm/qdss-tpiu.c b/arch/arm/mach-msm/qdss-tpiu.c
index 4481a0a..fa15635 100644
--- a/arch/arm/mach-msm/qdss-tpiu.c
+++ b/arch/arm/mach-msm/qdss-tpiu.c
@@ -108,7 +108,7 @@
return ret;
}
-static int tpiu_remove(struct platform_device *pdev)
+static int __devexit tpiu_remove(struct platform_device *pdev)
{
if (tpiu.enabled)
tpiu_disable();
@@ -119,18 +119,23 @@
static struct platform_driver tpiu_driver = {
.probe = tpiu_probe,
- .remove = tpiu_remove,
+ .remove = __devexit_p(tpiu_remove),
.driver = {
.name = "msm_tpiu",
},
};
-int __init tpiu_init(void)
+static int __init tpiu_init(void)
{
return platform_driver_register(&tpiu_driver);
}
+module_init(tpiu_init);
-void tpiu_exit(void)
+static void __exit tpiu_exit(void)
{
platform_driver_unregister(&tpiu_driver);
}
+module_exit(tpiu_exit);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("CoreSight Trace Port Interface Unit driver");
diff --git a/arch/arm/mach-msm/qdss.c b/arch/arm/mach-msm/qdss.c
index 80ec65a..effb09c 100644
--- a/arch/arm/mach-msm/qdss.c
+++ b/arch/arm/mach-msm/qdss.c
@@ -158,7 +158,7 @@
return ret;
}
-static void qdss_sysfs_exit(void)
+static void __exit qdss_sysfs_exit(void)
{
sysfs_remove_file(qdss.modulekobj, &max_clk_attr.attr);
}
@@ -172,29 +172,9 @@
ret = qdss_sysfs_init();
if (ret)
goto err_sysfs;
- ret = etb_init();
- if (ret)
- goto err_etb;
- ret = tpiu_init();
- if (ret)
- goto err_tpiu;
- ret = funnel_init();
- if (ret)
- goto err_funnel;
- ret = etm_init();
- if (ret)
- goto err_etm;
pr_info("QDSS initialized\n");
return 0;
-err_etm:
- funnel_exit();
-err_funnel:
- tpiu_exit();
-err_tpiu:
- etb_exit();
-err_etb:
- qdss_sysfs_exit();
err_sysfs:
mutex_destroy(&qdss.clk_mutex);
pr_err("QDSS init failed\n");
@@ -205,10 +185,6 @@
static void __exit qdss_exit(void)
{
qdss_sysfs_exit();
- etm_exit();
- funnel_exit();
- tpiu_exit();
- etb_exit();
mutex_destroy(&qdss.clk_mutex);
}
module_exit(qdss_exit);