Commit 8ee7c40a authored by Alex Elder's avatar Alex Elder Committed by David S. Miller

net: ipa: improve IPA clock error messages

Rearrange messages reported when errors occur in the IPA clock code,
so that the specific interconnect is identified when an error occurs
enabling or disabling it, or the core clock is indicated when an
error occurs enabling it.

Have ipa_interconnect_disable() return zero or the negative error
value returned by the first interconnect that produced an error
when disabled.  For now, the callers ignore the returned value.
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 10cc73c4
...@@ -144,8 +144,12 @@ static int ipa_interconnect_enable(struct ipa *ipa) ...@@ -144,8 +144,12 @@ static int ipa_interconnect_enable(struct ipa *ipa)
ret = icc_set_bw(interconnect->path, ret = icc_set_bw(interconnect->path,
interconnect->average_bandwidth, interconnect->average_bandwidth,
interconnect->peak_bandwidth); interconnect->peak_bandwidth);
if (ret) if (ret) {
dev_err(&ipa->pdev->dev,
"error %d enabling %s interconnect\n",
ret, icc_get_name(interconnect->path));
goto out_unwind; goto out_unwind;
}
interconnect++; interconnect++;
} }
...@@ -159,10 +163,11 @@ static int ipa_interconnect_enable(struct ipa *ipa) ...@@ -159,10 +163,11 @@ static int ipa_interconnect_enable(struct ipa *ipa)
} }
/* To disable an interconnect, we just its bandwidth to 0 */ /* To disable an interconnect, we just its bandwidth to 0 */
static void ipa_interconnect_disable(struct ipa *ipa) static int ipa_interconnect_disable(struct ipa *ipa)
{ {
struct ipa_interconnect *interconnect; struct ipa_interconnect *interconnect;
struct ipa_clock *clock = ipa->clock; struct ipa_clock *clock = ipa->clock;
struct device *dev = &ipa->pdev->dev;
int result = 0; int result = 0;
u32 count; u32 count;
int ret; int ret;
...@@ -172,13 +177,16 @@ static void ipa_interconnect_disable(struct ipa *ipa) ...@@ -172,13 +177,16 @@ static void ipa_interconnect_disable(struct ipa *ipa)
while (count--) { while (count--) {
interconnect--; interconnect--;
ret = icc_set_bw(interconnect->path, 0, 0); ret = icc_set_bw(interconnect->path, 0, 0);
if (ret && !result) if (ret) {
result = ret; dev_err(dev, "error %d disabling %s interconnect\n",
ret, icc_get_name(interconnect->path));
/* Try to disable all; record only the first error */
if (!result)
result = ret;
}
} }
if (result) return result;
dev_err(&ipa->pdev->dev,
"error %d disabling IPA interconnects\n", ret);
} }
/* Turn on IPA clocks, including interconnects */ /* Turn on IPA clocks, including interconnects */
...@@ -191,8 +199,10 @@ static int ipa_clock_enable(struct ipa *ipa) ...@@ -191,8 +199,10 @@ static int ipa_clock_enable(struct ipa *ipa)
return ret; return ret;
ret = clk_prepare_enable(ipa->clock->core); ret = clk_prepare_enable(ipa->clock->core);
if (ret) if (ret) {
ipa_interconnect_disable(ipa); dev_err(&ipa->pdev->dev, "error %d enabling core clock\n", ret);
(void)ipa_interconnect_disable(ipa);
}
return ret; return ret;
} }
...@@ -201,7 +211,7 @@ static int ipa_clock_enable(struct ipa *ipa) ...@@ -201,7 +211,7 @@ static int ipa_clock_enable(struct ipa *ipa)
static void ipa_clock_disable(struct ipa *ipa) static void ipa_clock_disable(struct ipa *ipa)
{ {
clk_disable_unprepare(ipa->clock->core); clk_disable_unprepare(ipa->clock->core);
ipa_interconnect_disable(ipa); (void)ipa_interconnect_disable(ipa);
} }
/* Get an IPA clock reference, but only if the reference count is /* Get an IPA clock reference, but only if the reference count is
...@@ -238,13 +248,8 @@ void ipa_clock_get(struct ipa *ipa) ...@@ -238,13 +248,8 @@ void ipa_clock_get(struct ipa *ipa)
goto out_mutex_unlock; goto out_mutex_unlock;
ret = ipa_clock_enable(ipa); ret = ipa_clock_enable(ipa);
if (ret) { if (!ret)
dev_err(&ipa->pdev->dev, "error %d enabling IPA clock\n", ret); refcount_set(&clock->count, 1);
goto out_mutex_unlock;
}
refcount_set(&clock->count, 1);
out_mutex_unlock: out_mutex_unlock:
mutex_unlock(&clock->mutex); mutex_unlock(&clock->mutex);
} }
......
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