From: Mike Tipton <mdtipton@codeaurora.org>
To: Georgi Djakov <georgi.djakov@linaro.org>, linux-pm@vger.kernel.org
Cc: okukatla@codeaurora.org, sibis@codeaurora.org,
bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] interconnect: qcom: Simplify the vcd compare function
Date: Tue, 13 Oct 2020 18:39:54 -0700 [thread overview]
Message-ID: <2e9385a0-56ea-0a2f-6389-7530c34a5364@codeaurora.org> (raw)
In-Reply-To: <20201013171923.7351-1-georgi.djakov@linaro.org>
On 10/13/2020 10:19 AM, Georgi Djakov wrote:
> Let's simplify the cmp_vcd() function and replace the conditionals
> with just a single statement, which also improves readability.
>
> Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
> ---
> drivers/interconnect/qcom/bcm-voter.c | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c
> index 887d13721e52..1cc565bce2f4 100644
> --- a/drivers/interconnect/qcom/bcm-voter.c
> +++ b/drivers/interconnect/qcom/bcm-voter.c
> @@ -41,17 +41,10 @@ struct bcm_voter {
>
> static int cmp_vcd(void *priv, struct list_head *a, struct list_head *b)
> {
> - const struct qcom_icc_bcm *bcm_a =
> - list_entry(a, struct qcom_icc_bcm, list);
> - const struct qcom_icc_bcm *bcm_b =
> - list_entry(b, struct qcom_icc_bcm, list);
> -
> - if (bcm_a->aux_data.vcd < bcm_b->aux_data.vcd)
> - return -1;
> - else if (bcm_a->aux_data.vcd == bcm_b->aux_data.vcd)
> - return 0;
> - else
> - return 1;
> + const struct qcom_icc_bcm *bcm_a = list_entry(a, struct qcom_icc_bcm, list);
> + const struct qcom_icc_bcm *bcm_b = list_entry(b, struct qcom_icc_bcm, list);
> +
> + return bcm_a->aux_data.vcd - bcm_b->aux_data.vcd;
> }
>
> static u64 bcm_div(u64 num, u32 base)
>
Reviewed-by: Mike Tipton <mdtipton@codeaurora.org>
prev parent reply other threads:[~2020-10-14 1:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-13 17:19 Georgi Djakov
2020-10-14 1:39 ` Mike Tipton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2e9385a0-56ea-0a2f-6389-7530c34a5364@codeaurora.org \
--to=mdtipton@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=georgi.djakov@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=okukatla@codeaurora.org \
--cc=sibis@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®