Commit 2709935b authored by Dmitry Baryshkov's avatar Dmitry Baryshkov

drm/msm/dpu: simplify and unify dpu_encoder_get_intf and dpu_encoder_get_wb

Remove extra nestting level from the dpu_encoder_get_intf(), replacing it
with the explicit return in case the INTF_WB was passed to the function.

While we are at it, also change dpu_encoder_get_wb() to also use
explicit return rather than the goto.
Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/491189/
Link: https://lore.kernel.org/r/20220625003028.383259-1-dmitry.baryshkov@linaro.orgSigned-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
parent b1665047
...@@ -1255,12 +1255,13 @@ static enum dpu_intf dpu_encoder_get_intf(const struct dpu_mdss_cfg *catalog, ...@@ -1255,12 +1255,13 @@ static enum dpu_intf dpu_encoder_get_intf(const struct dpu_mdss_cfg *catalog,
{ {
int i = 0; int i = 0;
if (type != INTF_WB) { if (type == INTF_WB)
for (i = 0; i < catalog->intf_count; i++) { return INTF_MAX;
if (catalog->intf[i].type == type
&& catalog->intf[i].controller_id == controller_id) { for (i = 0; i < catalog->intf_count; i++) {
return catalog->intf[i].id; if (catalog->intf[i].type == type
} && catalog->intf[i].controller_id == controller_id) {
return catalog->intf[i].id;
} }
} }
...@@ -1273,14 +1274,13 @@ static enum dpu_wb dpu_encoder_get_wb(const struct dpu_mdss_cfg *catalog, ...@@ -1273,14 +1274,13 @@ static enum dpu_wb dpu_encoder_get_wb(const struct dpu_mdss_cfg *catalog,
int i = 0; int i = 0;
if (type != INTF_WB) if (type != INTF_WB)
goto end; return WB_MAX;
for (i = 0; i < catalog->wb_count; i++) { for (i = 0; i < catalog->wb_count; i++) {
if (catalog->wb[i].id == controller_id) if (catalog->wb[i].id == controller_id)
return catalog->wb[i].id; return catalog->wb[i].id;
} }
end:
return WB_MAX; return WB_MAX;
} }
......
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