linux-remoteproc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Siddharth Gupta <sidgup@codeaurora.org>
To: agross@kernel.org, bjorn.andersson@linaro.org, ohad@wizery.com,
	corbet@lwn.net
Cc: Siddharth Gupta <sidgup@codeaurora.org>,
	linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, tsoni@codeaurora.org,
	psodagud@codeaurora.org, rishabhb@codeaurora.org,
	linux-doc@vger.kernel.org
Subject: [PATCH v4 2/2] remoteproc: core: Register the character device interface
Date: Tue,  7 Jul 2020 12:07:50 -0700	[thread overview]
Message-ID: <1594148870-27276-3-git-send-email-sidgup@codeaurora.org> (raw)
In-Reply-To: <1594148870-27276-1-git-send-email-sidgup@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>
Signed-off-by: Siddharth Gupta <sidgup@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 0f95e02..ec7fb49 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1966,6 +1966,13 @@ int rproc_add(struct rproc *rproc)
 	struct device *dev = &rproc->dev;
 	int ret;
 
+	/* 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;
+	}
+
 	ret = device_add(dev);
 	if (ret < 0)
 		return ret;
@@ -2241,6 +2248,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);
@@ -2409,6 +2417,7 @@ static int __init remoteproc_init(void)
 {
 	rproc_init_sysfs();
 	rproc_init_debugfs();
+	rproc_init_cdev();
 	rproc_init_panic();
 
 	return 0;
@@ -2420,6 +2429,7 @@ static void __exit remoteproc_exit(void)
 	ida_destroy(&rproc_dev_index);
 
 	rproc_exit_panic();
+	rproc_exit_cdev();
 	rproc_exit_debugfs();
 	rproc_exit_sysfs();
 }
-- 
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


  parent reply	other threads:[~2020-07-07 19:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 19:07 [PATCH v4 0/2] Add character device interface to remoteproc Siddharth Gupta
2020-07-07 19:07 ` [PATCH v4 1/2] remoteproc: Add remoteproc character device interface Siddharth Gupta
2020-07-15 20:18   ` Mathieu Poirier
2020-07-15 21:51     ` Mathieu Poirier
     [not found]       ` <81d7514c-727e-b4dc-e4ac-74a25966ccaf@codeaurora.org>
2020-07-21 20:56         ` Bjorn Andersson
2020-07-22 17:18           ` Mathieu Poirier
2020-07-22 17:33             ` Siddharth Gupta
2020-07-22 18:01             ` Bjorn Andersson
2020-07-17  5:46     ` Bjorn Andersson
2020-07-20 16:44       ` Mathieu Poirier
2020-07-17  5:32   ` Bjorn Andersson
2020-07-07 19:07 ` Siddharth Gupta [this message]
2020-07-17  5:49   ` [PATCH v4 2/2] remoteproc: core: Register the " Bjorn Andersson

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=1594148870-27276-3-git-send-email-sidgup@codeaurora.org \
    --to=sidgup@codeaurora.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=corbet@lwn.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=ohad@wizery.com \
    --cc=psodagud@codeaurora.org \
    --cc=rishabhb@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;
as well as URLs for NNTP newsgroup(s).