From: Dmitry Baryshkov Date: Sat, 25 Jun 2022 00:30:28 +0000 (+0300) Subject: drm/msm/dpu: simplify and unify dpu_encoder_get_intf and dpu_encoder_get_wb X-Git-Tag: v6.6.17~6682^2~1^2~37^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2709935b4a9e5b2b97288b391da9fe5aab24c280;p=platform%2Fkernel%2Flinux-rpi.git 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: Stephen Boyd Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar Patchwork: https://patchwork.freedesktop.org/patch/491189/ Link: https://lore.kernel.org/r/20220625003028.383259-1-dmitry.baryshkov@linaro.org Signed-off-by: Dmitry Baryshkov --- diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index f435baa..c682d4e 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1255,12 +1255,13 @@ static enum dpu_intf dpu_encoder_get_intf(const struct dpu_mdss_cfg *catalog, { int i = 0; - if (type != INTF_WB) { - for (i = 0; i < catalog->intf_count; i++) { - if (catalog->intf[i].type == type - && catalog->intf[i].controller_id == controller_id) { - return catalog->intf[i].id; - } + if (type == INTF_WB) + return INTF_MAX; + + for (i = 0; i < catalog->intf_count; i++) { + 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, int i = 0; if (type != INTF_WB) - goto end; + return WB_MAX; for (i = 0; i < catalog->wb_count; i++) { if (catalog->wb[i].id == controller_id) return catalog->wb[i].id; } -end: return WB_MAX; }