Commit be49d5b2 authored by Georgi Djakov's avatar Georgi Djakov

interconnect: qcom: Simplify the vcd compare function

Let's simplify the cmp_vcd() function and replace the conditionals
with just a single statement, which also improves readability.
Reviewed-by: default avatarMike Tipton <mdtipton@codeaurora.org>
Link: https://lore.kernel.org/r/20201013171923.7351-1-georgi.djakov@linaro.orgSigned-off-by: default avatarGeorgi Djakov <georgi.djakov@linaro.org>
parent 3cea11cd
......@@ -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)
......
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