@@ -1142,16 +1142,6 @@ int coresight_timeout(void __iomem *addr, u32 offset, int position, int value)
return -EAGAIN;
}
-struct bus_type coresight_bustype = {
- .name = "coresight",
-};
-
-static int __init coresight_init(void)
-{
- return bus_register(&coresight_bustype);
-}
-postcore_initcall(coresight_init);
-
/*
* coresight_release_platform_data: Release references to the devices connected
* to the output port of this device.
@@ -1336,3 +1326,34 @@ char *coresight_alloc_device_name(struct coresight_dev_list *dict,
return name;
}
EXPORT_SYMBOL_GPL(coresight_alloc_device_name);
+
+struct bus_type coresight_bustype = {
+ .name = "coresight",
+};
+
+static int __init coresight_init(void)
+{
+ int ret;
+
+ ret = bus_register(&coresight_bustype);
+ if (ret)
+ return ret;
+
+ ret = etm_perf_init();
+ if (ret)
+ bus_unregister(&coresight_bustype);
+
+ return ret;
+}
+
+static void __exit coresight_exit(void)
+{
+ /* TODO: perf_pmu_unregister() */
+ bus_unregister(&coresight_bustype);
+}
+
+module_init(coresight_init);
+module_exit(coresight_exit);
+
+MODULE_DESCRIPTION("Coresight bus and pmu driver");
+MODULE_LICENSE("GPL v2");
@@ -579,7 +579,7 @@ void etm_perf_del_symlink_sink(struct coresight_device *csdev)
csdev->ea = NULL;
}
-static int __init etm_perf_init(void)
+int __init etm_perf_init(void)
{
int ret;
@@ -606,4 +606,3 @@ static int __init etm_perf_init(void)
return ret;
}
-device_initcall(etm_perf_init);
@@ -82,4 +82,6 @@ static inline void *etm_perf_sink_config(struct perf_output_handle *handle)
#endif /* CONFIG_CORESIGHT */
+int __init etm_perf_init(void);
+
#endif
There is no need to initialize coresight bus at postcore level since coresight API is private now. Moreover, call etm_perf_init() from coresight_init() to combine bus and PMU into a single module. There are circular dependencies between them. Signed-off-by: Mian Yousaf Kaukab <ykaukab@suse.de> --- drivers/hwtracing/coresight/coresight-bus.c | 41 ++++++++++++++++++------ drivers/hwtracing/coresight/coresight-etm-perf.c | 3 +- drivers/hwtracing/coresight/coresight-etm-perf.h | 2 ++ 3 files changed, 34 insertions(+), 12 deletions(-)