lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 18 Sep 2022 11:13:01 +0800
From:   Chun-Kuang Hu <chunkuang.hu@...nel.org>
To:     Bo-Chen Chen <rex-bc.chen@...iatek.com>
Cc:     Chun-Kuang Hu <chunkuang.hu@...nel.org>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        David Airlie <airlied@...ux.ie>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Guillaume Ranquet <granquet@...libre.com>,
        Daniel Vetter <daniel@...ll.ch>,
        Jitao Shi <jitao.shi@...iatek.com>,
        AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>,
        CK Hu <ck.hu@...iatek.com>, liangxu.xu@...iatek.com,
        DRI Development <dri-devel@...ts.freedesktop.org>,
        "moderated list:ARM/Mediatek SoC support" 
        <linux-mediatek@...ts.infradead.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        Project_Global_Chrome_Upstream_Group 
        <Project_Global_Chrome_Upstream_Group@...iatek.com>
Subject: Re: [PATCH v2 1/3] drm/mediatek: dp: Reduce indentation in mtk_dp_bdg_detect()

Bo-Chen Chen <rex-bc.chen@...iatek.com> 於 2022年9月16日 週五 晚上9:38寫道:
>
> In order to improve human readability, reduce the indentation by
> returning early if the dp/edp cable is not plugged in.

Acked-by: Chun-Kuang Hu <chunkuang.hu@...nel.org>

>
> Signed-off-by: Bo-Chen Chen <rex-bc.chen@...iatek.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_dp.c | 66 ++++++++++++++++---------------
>  1 file changed, 34 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
> index dfa942ca62da..c72c646e25e9 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dp.c
> @@ -1933,39 +1933,41 @@ static enum drm_connector_status mtk_dp_bdg_detect(struct drm_bridge *bridge)
>         bool enabled = mtk_dp->enabled;
>         u8 sink_count = 0;
>
> -       if (mtk_dp->train_info.cable_plugged_in) {
> -               if (!enabled) {
> -                       /* power on aux */
> -                       mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
> -                                          DP_PWR_STATE_BANDGAP_TPLL_LANE,
> -                                          DP_PWR_STATE_MASK);
> -
> -                       /* power on panel */
> -                       drm_dp_dpcd_writeb(&mtk_dp->aux, DP_SET_POWER, DP_SET_POWER_D0);
> -                       usleep_range(2000, 5000);
> -               }
> -               /*
> -                * Some dongles still source HPD when they do not connect to any
> -                * sink device. To avoid this, we need to read the sink count
> -                * to make sure we do connect to sink devices. After this detect
> -                * function, we just need to check the HPD connection to check
> -                * whether we connect to a sink device.
> -                */
> -               drm_dp_dpcd_readb(&mtk_dp->aux, DP_SINK_COUNT, &sink_count);
> -               if (DP_GET_SINK_COUNT(sink_count))
> -                       ret = connector_status_connected;
> -
> -               if (!enabled) {
> -                       /* power off panel */
> -                       drm_dp_dpcd_writeb(&mtk_dp->aux, DP_SET_POWER, DP_SET_POWER_D3);
> -                       usleep_range(2000, 3000);
> -
> -                       /* power off aux */
> -                       mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
> -                                          DP_PWR_STATE_BANDGAP_TPLL,
> -                                          DP_PWR_STATE_MASK);
> -               }
> +       if (!mtk_dp->train_info.cable_plugged_in)
> +               return ret;
> +
> +       if (!enabled) {
> +               /* power on aux */
> +               mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
> +                                  DP_PWR_STATE_BANDGAP_TPLL_LANE,
> +                                  DP_PWR_STATE_MASK);
> +
> +               /* power on panel */
> +               drm_dp_dpcd_writeb(&mtk_dp->aux, DP_SET_POWER, DP_SET_POWER_D0);
> +               usleep_range(2000, 5000);
>         }
> +       /*
> +        * Some dongles still source HPD when they do not connect to any
> +        * sink device. To avoid this, we need to read the sink count
> +        * to make sure we do connect to sink devices. After this detect
> +        * function, we just need to check the HPD connection to check
> +        * whether we connect to a sink device.
> +        */
> +       drm_dp_dpcd_readb(&mtk_dp->aux, DP_SINK_COUNT, &sink_count);
> +       if (DP_GET_SINK_COUNT(sink_count))
> +               ret = connector_status_connected;
> +
> +       if (!enabled) {
> +               /* power off panel */
> +               drm_dp_dpcd_writeb(&mtk_dp->aux, DP_SET_POWER, DP_SET_POWER_D3);
> +               usleep_range(2000, 3000);
> +
> +               /* power off aux */
> +               mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE,
> +                                  DP_PWR_STATE_BANDGAP_TPLL,
> +                                  DP_PWR_STATE_MASK);
> +       }
> +
>         return ret;
>  }
>
> --
> 2.18.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ