Commit ba22a977 authored by Alex Elder's avatar Alex Elder Committed by Jakub Kicinski

net: ipa: use bulk operations to set up interconnects

Use of_icc_bulk_get() and icc_bulk_put(), icc_bulk_set_bw(), and
icc_bulk_enable() and icc_bulk_disable() to initialize individual
IPA interconnects.  Those functions already log messages in the
event of error so we don't need to.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 90078e63
......@@ -74,41 +74,31 @@ static int ipa_interconnect_init_one(struct device *dev,
struct icc_bulk_data *interconnect,
const struct ipa_interconnect_data *data)
{
struct icc_path *path;
int ret;
path = of_icc_get(dev, data->name);
if (IS_ERR(path)) {
ret = PTR_ERR(path);
dev_err_probe(dev, ret, "error getting %s interconnect\n",
data->name);
/* interconnect->path is filled in by of_icc_bulk_get() */
interconnect->name = data->name;
interconnect->avg_bw = data->average_bandwidth;
interconnect->peak_bw = data->peak_bandwidth;
ret = of_icc_bulk_get(dev, 1, interconnect);
if (ret)
return ret;
}
/* All interconnects are initially disabled */
(void)icc_disable(path);
icc_bulk_disable(1, interconnect);
/* Set the bandwidth values to be used when enabled */
ret = icc_set_bw(path, data->average_bandwidth, data->peak_bandwidth);
if (ret) {
dev_err(dev, "error %d setting %s interconnect bandwidths\n",
ret, data->name);
ret = icc_bulk_set_bw(1, interconnect);
if (ret)
icc_bulk_put(1, interconnect);
return ret;
}
interconnect->path = path;
interconnect->name = data->name;
interconnect->avg_bw = data->average_bandwidth;
interconnect->peak_bw = data->peak_bandwidth;
return 0;
}
static void ipa_interconnect_exit_one(struct icc_bulk_data *interconnect)
{
icc_put(interconnect->path);
icc_bulk_put(1, interconnect);
memset(interconnect, 0, sizeof(*interconnect));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment