mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 06:14:39 +01:00
coresight: Add helpers registering/removing both AMBA and platform drivers
This adds two different helpers i.e coresight_init_driver()/remove_driver() enabling coresight devices to register or remove AMBA and platform drivers. This changes replicator and funnel devices to use above new helpers. Cc: Suzuki K Poulose <[email protected]> Cc: Mike Leach <[email protected]> Cc: James Clark <[email protected]> Cc: Leo Yan <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Reviewed-by: James Clark <[email protected]> Signed-off-by: Anshuman Khandual <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected]
This commit is contained in:
1 parent
3ab210297c
commit
075b7cd7ad
4 files changed
+41
-34
No files matched your search
@@ -1398,6 +1398,35 @@ static void __exit coresight_exit(void)
|
||||
module_init(coresight_init);
|
||||
module_exit(coresight_exit);
|
||||
|
||||
int coresight_init_driver(const char *drv, struct amba_driver *amba_drv,
|
||||
struct platform_driver *pdev_drv)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = amba_driver_register(amba_drv);
|
||||
if (ret) {
|
||||
pr_err("%s: error registering AMBA driver\n", drv);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = platform_driver_register(pdev_drv);
|
||||
if (!ret)
|
||||
return 0;
|
||||
|
||||
pr_err("%s: error registering platform driver\n", drv);
|
||||
amba_driver_unregister(amba_drv);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(coresight_init_driver);
|
||||
|
||||
void coresight_remove_driver(struct amba_driver *amba_drv,
|
||||
struct platform_driver *pdev_drv)
|
||||
{
|
||||
amba_driver_unregister(amba_drv);
|
||||
platform_driver_unregister(pdev_drv);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(coresight_remove_driver);
|
||||
|
||||
MODULE_LICENSE("GPL v2");
|
||||
MODULE_AUTHOR("Pratik Patel <[email protected]>");
|
||||
MODULE_AUTHOR("Mathieu Poirier <[email protected]>");
|
||||
|
||||
@@ -410,27 +410,12 @@ static struct amba_driver dynamic_funnel_driver = {
|
||||
|
||||
static int __init funnel_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = platform_driver_register(&static_funnel_driver);
|
||||
if (ret) {
|
||||
pr_info("Error registering platform driver\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = amba_driver_register(&dynamic_funnel_driver);
|
||||
if (ret) {
|
||||
pr_info("Error registering amba driver\n");
|
||||
platform_driver_unregister(&static_funnel_driver);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return coresight_init_driver("funnel", &dynamic_funnel_driver, &static_funnel_driver);
|
||||
}
|
||||
|
||||
static void __exit funnel_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&static_funnel_driver);
|
||||
amba_driver_unregister(&dynamic_funnel_driver);
|
||||
coresight_remove_driver(&dynamic_funnel_driver, &static_funnel_driver);
|
||||
}
|
||||
|
||||
module_init(funnel_init);
|
||||
|
||||
@@ -416,27 +416,13 @@ static struct amba_driver dynamic_replicator_driver = {
|
||||
|
||||
static int __init replicator_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = platform_driver_register(&static_replicator_driver);
|
||||
if (ret) {
|
||||
pr_info("Error registering platform driver\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = amba_driver_register(&dynamic_replicator_driver);
|
||||
if (ret) {
|
||||
pr_info("Error registering amba driver\n");
|
||||
platform_driver_unregister(&static_replicator_driver);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return coresight_init_driver("replicator", &dynamic_replicator_driver,
|
||||
&static_replicator_driver);
|
||||
}
|
||||
|
||||
static void __exit replicator_exit(void)
|
||||
{
|
||||
platform_driver_unregister(&static_replicator_driver);
|
||||
amba_driver_unregister(&dynamic_replicator_driver);
|
||||
coresight_remove_driver(&dynamic_replicator_driver, &static_replicator_driver);
|
||||
}
|
||||
|
||||
module_init(replicator_init);
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/perf_event.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/amba/bus.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
/* Peripheral id registers (0xFD0-0xFEC) */
|
||||
#define CORESIGHT_PERIPHIDR4 0xfd0
|
||||
@@ -658,4 +660,9 @@ coresight_find_output_type(struct coresight_platform_data *pdata,
|
||||
enum coresight_dev_type type,
|
||||
union coresight_dev_subtype subtype);
|
||||
|
||||
int coresight_init_driver(const char *drv, struct amba_driver *amba_drv,
|
||||
struct platform_driver *pdev_drv);
|
||||
|
||||
void coresight_remove_driver(struct amba_driver *amba_drv,
|
||||
struct platform_driver *pdev_drv);
|
||||
#endif /* _LINUX_COREISGHT_H */
|
||||
Reference in new issue
Block a user