[PATCH 08/13] rpmsg: raw: register service to the rpmsg control
From: Arnaud Pouliquen
Date: Fri Jul 31 2020 - 08:11:51 EST
Register the RPMSG_RAW_SERVICE service to the RPMsg control
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@xxxxxx>
---
drivers/rpmsg/rpmsg_raw.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/rpmsg/rpmsg_raw.c b/drivers/rpmsg/rpmsg_raw.c
index 8684a78ab4d1..117da0c566ed 100644
--- a/drivers/rpmsg/rpmsg_raw.c
+++ b/drivers/rpmsg/rpmsg_raw.c
@@ -315,6 +315,11 @@ static struct rpmsg_driver rpmsg_raw_client = {
.remove = rpmsg_raw_remove,
};
+const struct rpmsg_drv_ctrl_info rpmsg_raw_ctl_info = {
+ .drv_name = KBUILD_MODNAME,
+ .service = RPMSG_RAW_SERVICE,
+};
+
static int rpmsg_raw_init(void)
{
int ret;
@@ -328,7 +333,18 @@ static int rpmsg_raw_init(void)
ret = register_rpmsg_driver(&rpmsg_raw_client);
if (ret < 0)
- unregister_chrdev_region(rpmsg_raw_major, RPMSG_DEV_MAX);
+ goto free_region;
+
+ ret = rpmsg_ctrl_register_ctl(&rpmsg_raw_ctl_info);
+ if (ret < 0)
+ goto free_rpmsg;
+
+ return 0;
+
+free_rpmsg:
+ unregister_rpmsg_driver(&rpmsg_raw_client);
+free_region:
+ unregister_chrdev_region(rpmsg_raw_major, RPMSG_DEV_MAX);
return ret;
}
@@ -336,6 +352,7 @@ module_init(rpmsg_raw_init);
static void rpmsg_raw_exit(void)
{
+ rpmsg_ctrl_unregister_ctl(&rpmsg_raw_ctl_info);
unregister_rpmsg_driver(&rpmsg_raw_client);
unregister_chrdev_region(rpmsg_raw_major, RPMSG_DEV_MAX);
}
--
2.17.1