Associate the RPMsg char to the RPMSG_RAW_SERVICE, by registering it to the RPMsg Control. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@xxxxxxxxxxx> --- drivers/rpmsg/rpmsg_char.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c index 3d77f4d5fc32..66e01b979e72 100644 --- a/drivers/rpmsg/rpmsg_char.c +++ b/drivers/rpmsg/rpmsg_char.c @@ -394,6 +394,11 @@ static struct rpmsg_driver rpmsg_chrdev_driver = { }, }; +const struct rpmsg_drv_ctrl_info rpmsg_chrdev_ctrl = { + .drv_name = "rpmsg_chrdev", + .service = RPMSG_RAW_SERVICE, +}; + static int rpmsg_chrdev_init(void) { int ret; @@ -407,15 +412,27 @@ static int rpmsg_chrdev_init(void) ret = register_rpmsg_driver(&rpmsg_chrdev_driver); if (ret < 0) { pr_err("rpmsg: failed to register rpmsg chrdev driver\n"); - unregister_chrdev_region(rpmsg_major, RPMSG_DEV_MAX); + goto free_region; } + ret = rpmsg_ctrl_register_ctl(&rpmsg_chrdev_ctrl); + if (ret < 0) + goto free_rpmsg; + + return 0; + +free_rpmsg: + unregister_rpmsg_driver(&rpmsg_chrdev_driver); +free_region: + unregister_chrdev_region(rpmsg_major, RPMSG_DEV_MAX); + return ret; } postcore_initcall(rpmsg_chrdev_init); static void rpmsg_chrdev_exit(void) { + rpmsg_ctrl_unregister_ctl(&rpmsg_chrdev_ctrl); unregister_rpmsg_driver(&rpmsg_chrdev_driver); unregister_chrdev_region(rpmsg_major, RPMSG_DEV_MAX); } -- 2.17.1