mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rishabh Bhatnagar <rishabhb@codeaurora.org>
To: linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org,
	bjorn.andersson@linaro.org
Cc: psodagud@codeaurora.org, tsoni@codeaurora.org,
	sidgup@codeaurora.org,
	Rishabh Bhatnagar <rishabhb@codeaurora.org>
Subject: [PATCH v2 2/2] remoteproc: core: Register the character device interface
Date: Tue, 31 Mar 2020 17:03:58 -0700	[thread overview]
Message-ID: <1585699438-14394-2-git-send-email-rishabhb@codeaurora.org> (raw)
In-Reply-To: <1585699438-14394-1-git-send-email-rishabhb@codeaurora.org>

Add the character device during rproc_add. This would create
a character device node at /dev/remoteproc<index>. Userspace
applications can interact with the remote processor using this
interface.

Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
---
 drivers/remoteproc/remoteproc_core.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 097f33e..76ba171 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1916,6 +1916,13 @@ int rproc_add(struct rproc *rproc)
 	/* create debugfs entries */
 	rproc_create_debug_dir(rproc);
 
+	/* add char device for this remoteproc */
+	ret = rproc_char_device_add(rproc);
+	if (ret) {
+		dev_err(dev, "Failed to add char dev for %s\n", rproc->name);
+		return ret;
+	}
+
 	/* if rproc is marked always-on, request it to boot */
 	if (rproc->auto_boot) {
 		ret = rproc_trigger_auto_boot(rproc);
@@ -2137,6 +2144,7 @@ int rproc_del(struct rproc *rproc)
 	mutex_unlock(&rproc->lock);
 
 	rproc_delete_debug_dir(rproc);
+	rproc_char_device_remove(rproc);
 
 	/* the rproc is downref'ed as soon as it's removed from the klist */
 	mutex_lock(&rproc_list_mutex);
@@ -2220,6 +2228,7 @@ static int __init remoteproc_init(void)
 {
 	rproc_init_sysfs();
 	rproc_init_debugfs();
+	rproc_init_cdev();
 
 	return 0;
 }
@@ -2231,6 +2240,7 @@ static void __exit remoteproc_exit(void)
 
 	rproc_exit_debugfs();
 	rproc_exit_sysfs();
+	rproc_exit_cdev();
 }
 module_exit(remoteproc_exit);
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2020-04-01  0:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-01  0:03 [PATCH v2 1/2] remoteproc: Add " Rishabh Bhatnagar
2020-04-01  0:03 ` Rishabh Bhatnagar [this message]
2020-04-01 19:52   ` [PATCH v2 2/2] remoteproc: core: Register the " Bjorn Andersson
2020-04-01  7:12 ` [PATCH v2 1/2] remoteproc: Add " Clément Leger
2020-04-01 20:08 ` Bjorn Andersson
2020-04-01 23:53   ` rishabhb
2020-04-02 17:28 ` Arnaud POULIQUEN
2020-04-03 19:13   ` rishabhb
2020-04-06  9:01     ` Arnaud POULIQUEN
2020-04-06 12:06       ` Clément Leger
2020-04-06 14:17         ` Arnaud POULIQUEN
2020-04-06 15:58           ` Clément Leger
2020-04-08 18:34             ` rishabhb
2020-04-09  8:29               ` Arnaud POULIQUEN
2020-04-10  2:00                 ` Bjorn Andersson
2020-04-10 14:51                   ` Arnaud POULIQUEN
2020-04-09 17:14               ` Mathieu Poirier
2020-04-03 20:30   ` Mathieu Poirier

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=1585699438-14394-2-git-send-email-rishabhb@codeaurora.org \
    --to=rishabhb@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=psodagud@codeaurora.org \
    --cc=sidgup@codeaurora.org \
    --cc=tsoni@codeaurora.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome