From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Georgi Djakov <georgi.djakov@linaro.org>
Cc: linux-pm@vger.kernel.org, evgreen@chromium.org,
akashast@codeaurora.org, mka@chromium.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] interconnect: Add bulk API helpers
Date: Mon, 27 Jul 2020 10:38:18 -0700 [thread overview]
Message-ID: <20200727173818.GE63496@builder.lan> (raw)
In-Reply-To: <20200528162542.30158-1-georgi.djakov@linaro.org>
On Thu 28 May 09:25 PDT 2020, Georgi Djakov wrote:
> diff --git a/drivers/interconnect/bulk.c b/drivers/interconnect/bulk.c
> new file mode 100644
> index 000000000000..9bd418594665
> --- /dev/null
> +++ b/drivers/interconnect/bulk.c
> @@ -0,0 +1,119 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <linux/interconnect-provider.h>
> +#include <linux/device.h>
> +#include <linux/export.h>
> +
> +/**
> + * of_icc_bulk_get - get interconnect paths
Parenthesis on the function name here, and on the other functions below.
> + * @dev: the device requesting the path
> + * @num_paths: the number of icc_bulk_data
> + * @paths: the table with the paths we want to get
> + *
> + * Returns 0 on success or -EERROR otherwise.
s/-EERROR/negative errno/
> + */
> +int __must_check of_icc_bulk_get(struct device *dev, int num_paths,
> + struct icc_bulk_data *paths)
> +{
> + int ret, i;
> +
> + for (i = 0; i < num_paths; i++) {
> + paths[i].path = of_icc_get(dev, paths[i].name);
> + if (IS_ERR(paths[i].path)) {
> + ret = PTR_ERR(paths[i].path);
> + dev_err(dev, "of_icc_get() failed on path %s (%d)\n",
> + paths[i].name, ret);
I think you only should print this error if ret != -EPROBE_DEFER.
> + paths[i].path = NULL;
> + goto err;
> + }
> + }
> +
> + return 0;
> +
> +err:
> + icc_bulk_put(i, paths);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(of_icc_bulk_get);
> +
> +/**
> + * icc_bulk_put - put a list of interconnect paths
> + * @num_paths: the number of icc_bulk_data
> + * @paths: the icc_bulk_data table with the paths being put
> + */
> +void icc_bulk_put(int num_paths, struct icc_bulk_data *paths)
> +{
> + while (--num_paths >= 0) {
> + icc_put(paths[num_paths].path);
> + paths[num_paths].path = NULL;
> + }
> +}
> +EXPORT_SYMBOL_GPL(icc_bulk_put);
> +
> +/**
> + * icc_bulk_set - set bandwidth to a set of paths
> + * @num_paths: the number of icc_bulk_data
> + * @paths: the icc_bulk_data table containing the paths and bandwidth
> + *
> + * Returns 0 on success or -EERROR otherwise.
> + */
> +int icc_bulk_set_bw(int num_paths, const struct icc_bulk_data *paths)
> +{
> + int ret = 0;
> + int i;
> +
> + for (i = 0; i < num_paths; i++) {
> + ret = icc_set_bw(paths[i].path, paths[i].avg_bw,
> + paths[i].peak_bw);
You can unwrap this line.
Regards,
Bjorn
prev parent reply other threads:[~2020-07-27 17:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-28 16:25 [PATCH] interconnect: Add bulk API helpers Georgi Djakov
2020-07-27 17:38 ` Bjorn Andersson [this message]
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=20200727173818.GE63496@builder.lan \
--to=bjorn.andersson@linaro.org \
--cc=akashast@codeaurora.org \
--cc=evgreen@chromium.org \
--cc=georgi.djakov@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mka@chromium.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).