From: Alex Elder <elder@linaro.org>
To: Mathieu Poirier <mathieu.poirier@linaro.org>,
bjorn.andersson@linaro.org, ohad@wizery.com
Cc: s-anna@ti.com, linux-remoteproc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] remoteproc: Split rproc_ops allocation from rproc_alloc()
Date: Mon, 13 Apr 2020 15:56:40 -0500 [thread overview]
Message-ID: <21c577b1-df9c-8017-e0be-22ede5e21ac3@linaro.org> (raw)
In-Reply-To: <20200413193401.27234-4-mathieu.poirier@linaro.org>
On 4/13/20 2:34 PM, Mathieu Poirier wrote:
> Make the rproc_ops allocation a function on its own in order to
> introduce more flexibility to function rproc_alloc().
>
> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Looks good.
Reviewed-by: Alex Elder <elder@linaro.org>
> ---
> drivers/remoteproc/remoteproc_core.c | 32 +++++++++++++++++-----------
> 1 file changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index 4dee63f319ba..c272d78f07e8 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -2006,6 +2006,25 @@ static int rproc_alloc_firmware(struct rproc *rproc,
> return 0;
> }
>
> +static int rproc_alloc_ops(struct rproc *rproc, const struct rproc_ops *ops)
> +{
> + rproc->ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL);
> + if (!rproc->ops)
> + return -ENOMEM;
> +
> + /* Default to ELF loader if no load function is specified */
> + if (!rproc->ops->load) {
> + rproc->ops->load = rproc_elf_load_segments;
> + rproc->ops->parse_fw = rproc_elf_load_rsc_table;
> + rproc->ops->find_loaded_rsc_table =
> + rproc_elf_find_loaded_rsc_table;
> + rproc->ops->sanity_check = rproc_elf_sanity_check;
I'm glad you made this unconditional, the sanity check function
is always null when the load function is null.
> + rproc->ops->get_boot_addr = rproc_elf_get_boot_addr;
> + }
> +
> + return 0;
> +}
> +
> /**
> * rproc_alloc() - allocate a remote processor handle
> * @dev: the underlying device
> @@ -2045,8 +2064,7 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
> if (rproc_alloc_firmware(rproc, name, firmware))
> goto free_rproc;
>
> - rproc->ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL);
> - if (!rproc->ops)
> + if (rproc_alloc_ops(rproc, ops))
> goto free_firmware;
>
> rproc->name = name;
> @@ -2073,16 +2091,6 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
>
> atomic_set(&rproc->power, 0);
>
> - /* Default to ELF loader if no load function is specified */
> - if (!rproc->ops->load) {
> - rproc->ops->load = rproc_elf_load_segments;
> - rproc->ops->parse_fw = rproc_elf_load_rsc_table;
> - rproc->ops->find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table;
> - if (!rproc->ops->sanity_check)
> - rproc->ops->sanity_check = rproc_elf32_sanity_check;
> - rproc->ops->get_boot_addr = rproc_elf_get_boot_addr;
> - }
> -
> mutex_init(&rproc->lock);
>
> INIT_LIST_HEAD(&rproc->carveouts);
>
next prev parent reply other threads:[~2020-04-13 20:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-13 19:33 [PATCH 0/4] remoteproc: Refactor function rproc_alloc() Mathieu Poirier
2020-04-13 19:33 ` [PATCH 1/4] remoteproc: Fix a bug in rproc_alloc() Mathieu Poirier
2020-04-13 19:33 ` [PATCH 2/4] remoteproc: Split firmware name allocation from rproc_alloc() Mathieu Poirier
2020-04-13 20:56 ` Alex Elder
2020-04-14 0:55 ` Bjorn Andersson
2020-04-14 12:36 ` Alex Elder
2020-04-14 15:43 ` Mathieu Poirier
2020-04-14 19:48 ` Bjorn Andersson
2020-04-14 19:44 ` Mathieu Poirier
2020-04-14 23:16 ` Bjorn Andersson
2020-04-15 19:34 ` Mathieu Poirier
2020-04-14 16:11 ` Mathieu Poirier
2020-04-13 19:34 ` [PATCH 3/4] remoteproc: Split rproc_ops " Mathieu Poirier
2020-04-13 20:56 ` Alex Elder [this message]
2020-04-13 19:34 ` [PATCH 4/4] remoteproc: Get rid of tedious error path Mathieu Poirier
2020-04-13 20:56 ` Alex Elder
2020-04-13 20:56 ` Alex Elder
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=21c577b1-df9c-8017-e0be-22ede5e21ac3@linaro.org \
--to=elder@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=ohad@wizery.com \
--cc=s-anna@ti.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®