From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Cc: Ohad Ben-Cohen <ohad@wizery.com>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com, julien.massot@iot.bzh
Subject: Re: [PATCH v7 02/12] rpmsg: Create the rpmsg class in core instead of in rpmsg char
Date: Thu, 2 Dec 2021 20:17:43 -0600 [thread overview]
Message-ID: <Yal+R7nd1tuBHioi@builder.lan> (raw)
In-Reply-To: <20211108141937.13016-3-arnaud.pouliquen@foss.st.com>
On Mon 08 Nov 08:19 CST 2021, Arnaud Pouliquen wrote:
> Migrate the creation of the rpmsg class from the rpmsg_char
> to the core that the class is usable by the rpmsg_char and
> the futur rpmsg_ctrl module.
>
> Suggested-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Regards,
Bjorn
> ---
> Update vs previous revision:
> - remove rpmsg_get_class API and export the rpmsg_class in rpmsg_internal.h
> ---
> drivers/rpmsg/rpmsg_char.c | 10 ----------
> drivers/rpmsg/rpmsg_core.c | 15 +++++++++++++--
> drivers/rpmsg/rpmsg_internal.h | 2 ++
> 3 files changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c
> index 44934d7fa3c4..8ab5ac23850c 100644
> --- a/drivers/rpmsg/rpmsg_char.c
> +++ b/drivers/rpmsg/rpmsg_char.c
> @@ -29,7 +29,6 @@
> #define RPMSG_DEV_MAX (MINORMASK + 1)
>
> static dev_t rpmsg_major;
> -static struct class *rpmsg_class;
>
> static DEFINE_IDA(rpmsg_ctrl_ida);
> static DEFINE_IDA(rpmsg_ept_ida);
> @@ -559,17 +558,9 @@ static int rpmsg_chrdev_init(void)
> return ret;
> }
>
> - rpmsg_class = class_create(THIS_MODULE, "rpmsg");
> - if (IS_ERR(rpmsg_class)) {
> - pr_err("failed to create rpmsg class\n");
> - unregister_chrdev_region(rpmsg_major, RPMSG_DEV_MAX);
> - return PTR_ERR(rpmsg_class);
> - }
> -
> ret = register_rpmsg_driver(&rpmsg_chrdev_driver);
> if (ret < 0) {
> pr_err("rpmsgchr: failed to register rpmsg driver\n");
> - class_destroy(rpmsg_class);
> unregister_chrdev_region(rpmsg_major, RPMSG_DEV_MAX);
> }
>
> @@ -580,7 +571,6 @@ postcore_initcall(rpmsg_chrdev_init);
> static void rpmsg_chrdev_exit(void)
> {
> unregister_rpmsg_driver(&rpmsg_chrdev_driver);
> - class_destroy(rpmsg_class);
> unregister_chrdev_region(rpmsg_major, RPMSG_DEV_MAX);
> }
> module_exit(rpmsg_chrdev_exit);
> diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
> index 9151836190ce..45227c864aa2 100644
> --- a/drivers/rpmsg/rpmsg_core.c
> +++ b/drivers/rpmsg/rpmsg_core.c
> @@ -20,6 +20,9 @@
>
> #include "rpmsg_internal.h"
>
> +struct class *rpmsg_class;
> +EXPORT_SYMBOL(rpmsg_class);
> +
> /**
> * rpmsg_create_channel() - create a new rpmsg channel
> * using its name and address info.
> @@ -629,10 +632,17 @@ static int __init rpmsg_init(void)
> {
> int ret;
>
> + rpmsg_class = class_create(THIS_MODULE, "rpmsg");
> + if (IS_ERR(rpmsg_class)) {
> + pr_err("failed to create rpmsg class\n");
> + return PTR_ERR(rpmsg_class);
> + }
> +
> ret = bus_register(&rpmsg_bus);
> - if (ret)
> + if (ret) {
> pr_err("failed to register rpmsg bus: %d\n", ret);
> -
> + class_destroy(rpmsg_class);
> + }
> return ret;
> }
> postcore_initcall(rpmsg_init);
> @@ -640,6 +650,7 @@ postcore_initcall(rpmsg_init);
> static void __exit rpmsg_fini(void)
> {
> bus_unregister(&rpmsg_bus);
> + class_destroy(rpmsg_class);
> }
> module_exit(rpmsg_fini);
>
> diff --git a/drivers/rpmsg/rpmsg_internal.h b/drivers/rpmsg/rpmsg_internal.h
> index a76c344253bf..1b6f998e1a4a 100644
> --- a/drivers/rpmsg/rpmsg_internal.h
> +++ b/drivers/rpmsg/rpmsg_internal.h
> @@ -18,6 +18,8 @@
> #define to_rpmsg_device(d) container_of(d, struct rpmsg_device, dev)
> #define to_rpmsg_driver(d) container_of(d, struct rpmsg_driver, drv)
>
> +extern struct class *rpmsg_class;
> +
> /**
> * struct rpmsg_device_ops - indirection table for the rpmsg_device operations
> * @create_channel: create backend-specific channel, optional
> --
> 2.17.1
>
next prev parent reply other threads:[~2021-12-03 2:17 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-08 14:19 [PATCH v7 00/12] Restructure the rpmsg_char driver and introduce rpmsg_ctrl driver Arnaud Pouliquen
2021-11-08 14:19 ` [PATCH v7 01/12] rpmsg: char: Export eptdev create an destroy functions Arnaud Pouliquen
2021-12-03 2:17 ` Bjorn Andersson
2021-12-03 16:37 ` Arnaud POULIQUEN
2021-12-03 16:41 ` Bjorn Andersson
2021-11-08 14:19 ` [PATCH v7 02/12] rpmsg: Create the rpmsg class in core instead of in rpmsg char Arnaud Pouliquen
2021-12-03 2:17 ` Bjorn Andersson [this message]
2021-11-08 14:19 ` [PATCH v7 03/12] rpmsg: Move the rpmsg control device from rpmsg_char to rpmsg_ctrl Arnaud Pouliquen
2021-12-03 2:25 ` Bjorn Andersson
2021-11-08 14:19 ` [PATCH v7 04/12] ARM: configs: Configs that had RPMSG_CHAR now gets RPMSG_CTRL Arnaud Pouliquen
2021-11-08 14:19 ` Arnaud Pouliquen
2021-11-08 14:19 ` [PATCH v7 05/12] RISCV: " Arnaud Pouliquen
2021-11-08 14:19 ` Arnaud Pouliquen
2021-11-08 14:19 ` [PATCH v7 06/12] rpmsg: Update rpmsg_chrdev_register_device function Arnaud Pouliquen
2021-11-08 14:19 ` [PATCH v7 07/12] rpmsg: char: Refactor rpmsg_chrdev_eptdev_create function Arnaud Pouliquen
2021-11-08 14:19 ` [PATCH v7 08/12] rpmsg: Introduce rpmsg_create_default_ept function Arnaud Pouliquen
2021-11-08 14:19 ` [PATCH v7 09/12] rpmsg: char: Add possibility to use default endpoint of the rpmsg device Arnaud Pouliquen
2021-12-03 2:32 ` Bjorn Andersson
2021-11-08 14:19 ` [PATCH v7 10/12] rpmsg: char: Introduce the "rpmsg-raw" channel Arnaud Pouliquen
2021-12-03 1:52 ` Bjorn Andersson
2021-12-03 16:43 ` Arnaud POULIQUEN
2021-11-08 14:19 ` [PATCH v7 11/12] rpmsg: ctrl: Introduce new RPMSG_CREATE/RELEASE_DEV_IOCTL controls Arnaud Pouliquen
2021-11-08 14:19 ` [PATCH v7 12/12] rpmsg: core: send a ns announcement when a default endpoint is created Arnaud Pouliquen
2021-12-03 1:58 ` Bjorn Andersson
2021-12-03 16:56 ` Arnaud POULIQUEN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yal+R7nd1tuBHioi@builder.lan \
--to=bjorn.andersson@linaro.org \
--cc=arnaud.pouliquen@foss.st.com \
--cc=julien.massot@iot.bzh \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mathieu.poirier@linaro.org \
--cc=ohad@wizery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.