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]
Message-ID: <0dc457cbd13ea76a3aa3c70b2a31a537.sboyd@kernel.org>
Date:   Wed, 19 Apr 2023 14:37:10 -0700
From:   Stephen Boyd <sboyd@...nel.org>
To:     Andy Gross <agross@...nel.org>,
        Bjorn Andersson <andersson@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Michael Turquette <mturquette@...libre.com>,
        Richard Cochran <richardcochran@...il.com>,
        Rob Herring <robh+dt@...nel.org>,
        Taniya Das <quic_tdas@...cinc.com>
Cc:     quic_skakitap@...cinc.com, Imran Shaik <quic_imrashai@...cinc.com>,
        linux-arm-msm@...r.kernel.org, linux-clk@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        Taniya Das <quic_tdas@...cinc.com>, quic_rohiagar@...cinc.com,
        netdev@...r.kernel.org
Subject: Re: [PATCH 1/4] clk: qcom: branch: Extend the invert logic for branch2 clocks

Quoting Taniya Das (2023-04-19 06:30:10)
> From: Imran Shaik <quic_imrashai@...cinc.com>
> 
> Add support to handle the invert logic for branch2 clocks.
> Invert branch halt would indicate the clock ON when CLK_OFF
> bit is '1' and OFF when CLK_OFF bit is '0'.
> 
> Signed-off-by: Imran Shaik <quic_imrashai@...cinc.com>
> Signed-off-by: Taniya Das <quic_tdas@...cinc.com>
> ---
>  drivers/clk/qcom/clk-branch.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/clk/qcom/clk-branch.c b/drivers/clk/qcom/clk-branch.c
> index f869fc6aaed6..4b24d45be771 100644
> --- a/drivers/clk/qcom/clk-branch.c
> +++ b/drivers/clk/qcom/clk-branch.c
> @@ -48,6 +48,7 @@ static bool clk_branch2_check_halt(const struct clk_branch *br, bool enabling)
>  {
>         u32 val;
>         u32 mask;
> +       bool invert = (br->halt_check == BRANCH_HALT_ENABLE);
>  
>         mask = BRANCH_NOC_FSM_STATUS_MASK << BRANCH_NOC_FSM_STATUS_SHIFT;
>         mask |= BRANCH_CLK_OFF;
> @@ -56,9 +57,16 @@ static bool clk_branch2_check_halt(const struct clk_branch *br, bool enabling)
>  
>         if (enabling) {
>                 val &= mask;
> +
> +               if (invert)
> +                       return (val & BRANCH_CLK_OFF) == BRANCH_CLK_OFF;
> +
>                 return (val & BRANCH_CLK_OFF) == 0 ||
>                         val == BRANCH_NOC_FSM_STATUS_ON;

Do these clks have a NOC_FSM_STATUS bit? I think it would be better to
make a local variable for the val we're looking for, and then test for
that. We may need a mask as well, but the idea is to not duplicate the
test and return from multiple places.

>         } else {
> +               if (invert)
> +                       return (val & BRANCH_CLK_OFF) == 0;
> +
>                 return val & BRANCH_CLK_OFF;
>         }

While at it, I'd get rid of this else and de-indent the code because if
we're 'enabling' we'll return from the function regardless.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ