From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Ohad Ben-Cohen <ohad@wizery.com>,
Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
Loic Pallardy <loic.pallardy@st.com>
Subject: [PATCH v2 3/8] remoteproc: Clone rproc_ops in rproc_alloc()
Date: Fri, 5 Jan 2018 15:58:00 -0800 [thread overview]
Message-ID: <20180105235805.9948-4-bjorn.andersson@linaro.org> (raw)
In-Reply-To: <20180105235805.9948-1-bjorn.andersson@linaro.org>
In order to allow rproc_alloc() to, in a future patch, update entries in
the "ops" struct we need to make a local copy of it.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
Changes since v1:
- None
drivers/remoteproc/remoteproc_core.c | 9 ++++++++-
include/linux/remoteproc.h | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 208ccf709cad..dbf685dbafcf 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1342,6 +1342,7 @@ static void rproc_type_release(struct device *dev)
ida_simple_remove(&rproc_dev_index, rproc->index);
kfree(rproc->firmware);
+ kfree(rproc->ops);
kfree(rproc);
}
@@ -1406,9 +1407,15 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
return NULL;
}
+ rproc->ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL);
+ if (!rproc->ops) {
+ kfree(p);
+ kfree(rproc);
+ return NULL;
+ }
+
rproc->firmware = p;
rproc->name = name;
- rproc->ops = ops;
rproc->priv = &rproc[1];
rproc->auto_boot = true;
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index 6fdc62e29d6f..cc4d30a790b3 100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -419,7 +419,7 @@ struct rproc {
const char *name;
char *firmware;
void *priv;
- const struct rproc_ops *ops;
+ struct rproc_ops *ops;
struct device dev;
const struct rproc_fw_ops *fw_ops;
atomic_t power;
--
2.15.0
next prev parent reply other threads:[~2018-01-05 23:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-05 23:57 [PATCH v2 0/8] Remoteproc cleanups Bjorn Andersson
2018-01-05 23:57 ` [PATCH v2 1/8] remoteproc: Remove depricated crash completion Bjorn Andersson
2018-01-05 23:57 ` [PATCH v2 2/8] remoteproc: Cache resource table size Bjorn Andersson
2018-01-05 23:58 ` Bjorn Andersson [this message]
2018-01-05 23:58 ` [PATCH v2 4/8] remoteproc: Merge rproc_ops and rproc_fw_ops Bjorn Andersson
2018-01-08 21:03 ` Loic PALLARDY
2018-01-05 23:58 ` [PATCH v2 5/8] remoteproc: Don't handle empty resource table Bjorn Andersson
2018-01-05 23:58 ` [PATCH v2 6/8] remoteproc: Move resource table load logic to find Bjorn Andersson
2018-01-05 23:58 ` [PATCH v2 7/8] remoteproc: Drop dangling find_rsc_table dummies Bjorn Andersson
2018-01-05 23:58 ` [PATCH v2 8/8] remoteproc: Reset table_ptr on stop Bjorn Andersson
2018-01-15 10:35 ` [PATCH v2 0/8] Remoteproc cleanups Loic PALLARDY
2018-01-15 17:30 ` 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=20180105235805.9948-4-bjorn.andersson@linaro.org \
--to=bjorn.andersson@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=loic.pallardy@st.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®