net: ipa: use bulk interconnect initialization
The previous patch used bulk interconnect operations to initialize IPA interconnects one at a time. This rearranges things to use the bulk interfaces as intended--on all interconnects together. As a result ipa_interconnect_init_one() and ipa_interconnect_exit_one() are no longer needed. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
ba22a9778d
commit
63ac8cce50
@ -70,38 +70,6 @@ struct ipa_power {
|
|||||||
struct icc_bulk_data *interconnect;
|
struct icc_bulk_data *interconnect;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int ipa_interconnect_init_one(struct device *dev,
|
|
||||||
struct icc_bulk_data *interconnect,
|
|
||||||
const struct ipa_interconnect_data *data)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* 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 */
|
|
||||||
icc_bulk_disable(1, interconnect);
|
|
||||||
|
|
||||||
/* Set the bandwidth values to be used when enabled */
|
|
||||||
ret = icc_bulk_set_bw(1, interconnect);
|
|
||||||
if (ret)
|
|
||||||
icc_bulk_put(1, interconnect);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ipa_interconnect_exit_one(struct icc_bulk_data *interconnect)
|
|
||||||
{
|
|
||||||
icc_bulk_put(1, interconnect);
|
|
||||||
memset(interconnect, 0, sizeof(*interconnect));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize interconnects required for IPA operation */
|
/* Initialize interconnects required for IPA operation */
|
||||||
static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
|
static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
|
||||||
const struct ipa_interconnect_data *data)
|
const struct ipa_interconnect_data *data)
|
||||||
@ -116,18 +84,34 @@ static int ipa_interconnect_init(struct ipa_power *power, struct device *dev,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
power->interconnect = interconnect;
|
power->interconnect = interconnect;
|
||||||
|
|
||||||
|
/* Initialize our interconnect data array for bulk operations */
|
||||||
while (count--) {
|
while (count--) {
|
||||||
ret = ipa_interconnect_init_one(dev, interconnect, data++);
|
/* interconnect->path is filled in by of_icc_bulk_get() */
|
||||||
if (ret)
|
interconnect->name = data->name;
|
||||||
goto out_unwind;
|
interconnect->avg_bw = data->average_bandwidth;
|
||||||
|
interconnect->peak_bw = data->peak_bandwidth;
|
||||||
|
data++;
|
||||||
interconnect++;
|
interconnect++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = of_icc_bulk_get(dev, power->interconnect_count,
|
||||||
|
power->interconnect);
|
||||||
|
if (ret)
|
||||||
|
goto err_free;
|
||||||
|
|
||||||
|
/* All interconnects are initially disabled */
|
||||||
|
icc_bulk_disable(power->interconnect_count, power->interconnect);
|
||||||
|
|
||||||
|
/* Set the bandwidth values to be used when enabled */
|
||||||
|
ret = icc_bulk_set_bw(power->interconnect_count, power->interconnect);
|
||||||
|
if (ret)
|
||||||
|
goto err_bulk_put;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_unwind:
|
err_bulk_put:
|
||||||
while (interconnect-- > power->interconnect)
|
icc_bulk_put(power->interconnect_count, power->interconnect);
|
||||||
ipa_interconnect_exit_one(interconnect);
|
err_free:
|
||||||
kfree(power->interconnect);
|
kfree(power->interconnect);
|
||||||
power->interconnect = NULL;
|
power->interconnect = NULL;
|
||||||
|
|
||||||
@ -137,11 +121,7 @@ out_unwind:
|
|||||||
/* Inverse of ipa_interconnect_init() */
|
/* Inverse of ipa_interconnect_init() */
|
||||||
static void ipa_interconnect_exit(struct ipa_power *power)
|
static void ipa_interconnect_exit(struct ipa_power *power)
|
||||||
{
|
{
|
||||||
struct icc_bulk_data *interconnect;
|
icc_bulk_put(power->interconnect_count, power->interconnect);
|
||||||
|
|
||||||
interconnect = power->interconnect + power->interconnect_count;
|
|
||||||
while (interconnect-- > power->interconnect)
|
|
||||||
ipa_interconnect_exit_one(interconnect);
|
|
||||||
kfree(power->interconnect);
|
kfree(power->interconnect);
|
||||||
power->interconnect = NULL;
|
power->interconnect = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user