Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4999865pxu; Tue, 13 Oct 2020 12:08:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTYLyzdpi8bDvaxtYksklAzrX8Yn3JXeo9ctXzLybc9WSw5kgSZC3wz8zBnuuwI9vkeszj X-Received: by 2002:a17:906:86c3:: with SMTP id j3mr1229827ejy.493.1602616088849; Tue, 13 Oct 2020 12:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602616088; cv=none; d=google.com; s=arc-20160816; b=mYrKBUL0Oze3DBwR+CbWeqD8kcEnIG3pgMTnXzil35GC4A9h7ct6DG19gR+X0f0m+4 Uez0loMSF/mAw9hVelp7O0d3FJjNcAn7ny6hR5NcuTJW0aldyHc6Ya8/uDc+VpsUXC5e TznudDvDQUTwBC4jR771jgNomlhndv56/6ihG8n0RtMtw0lIw/uskx4bYsr0RFs1bHEm aQxpC2hL46A7P47c2NRg9L7QQY+5NRx+7ugGpRlRk3lf551fv39087YXKxsmz+tU5KS2 YgCSF5MogB4sp8zexw56Lq+0WQu144UXp4m+9exMyNKefEKQejiCdXsBM2n0wwg47/du F9DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=hi/aqJYx9lDP1HowNRsqMAfgvbnLyBU/Tyswx0oWrYA=; b=vrdUV5PeRAkqpKfiv14qQTEmzEd7eYXujac5adpTJhb/iPmMQhNXpxZWp7lqqXsoYI BuBbsPa/+yV4nz8moIHqyHiVFECyb9B0dy1jplanLj/4CdRmWPXM/hvdEPxs1CM/qqM5 3vmWT/90lSQMCLWFCAoG329XDLsA0jHegjLOduGuaGYUJx/DieIh4VeqNh55MG/ma52F vO3rg/OSncYcqu2eSDbFbmPUAtPcH4wxmCLeSrXl31ChundNynksWq9+prPOQtNObEdV phtGj8TcetkIHPtOKNsoFHapQdrJKZ5/6f9SQ1613d9v9D9PCzq5vozt59RgHWKIM+jO SM5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=md7BnzJB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y21si454672edm.83.2020.10.13.12.07.43; Tue, 13 Oct 2020 12:08:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=md7BnzJB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388404AbgJMRTY (ORCPT + 99 others); Tue, 13 Oct 2020 13:19:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725970AbgJMRTX (ORCPT ); Tue, 13 Oct 2020 13:19:23 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AED0C0613D0 for ; Tue, 13 Oct 2020 10:19:23 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id e18so180098wrw.9 for ; Tue, 13 Oct 2020 10:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hi/aqJYx9lDP1HowNRsqMAfgvbnLyBU/Tyswx0oWrYA=; b=md7BnzJBSb99UK843T7yDU4rkdMtlCNAi8Xj418lZAwmGnFkQKgSVNzWZrCQ22kZIj 6lxtI/o3x6XOyh/kRvWMEFseyGVA8mw5T7Rkd/9QBR1AqpHldIUT4BHO493wGlCmoOpH I7yexQzoZs7X6GgN5EEmC+4Y+VlCEmJ/bMErNf1O/qyfnEXVBFit0Jdu03HrS5829HTQ NKa1Y6Fq6ehVdQrfdUUtpvgWDnX1SxuuntofQhAcpMdy2NcAr8RK8rLfzNetY0GgPJyN RpWSQVgkNBiD7+72nsJwSlq0nhz0PUZdEhJSbKreJTonlCPb8qq2UMuY6wNiG8DxQ3DI 8PTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hi/aqJYx9lDP1HowNRsqMAfgvbnLyBU/Tyswx0oWrYA=; b=kc+ll2+1EK5NWHhF9Gbh7fy5XwnWcW6BycsGVQ1WFNy/XpAh/G1gyEZyndyYWL93CZ 8lunWuhGh14rhMstIcVolx1sjbHRbY54uyD3wOVgxw/Wcd7bKyAEOSLhea+tdjza80Lg AhYpwGw6J4ZYvUMmRxUfj+DLNf6UTPkNcLiAdCVKG2VeWDBGl14azRFQ+Lq5gzdedj3R URIQCsskGok7jvRmLUUA0gJtKNPmqfDGJ4H/GqtMa7i47tgBLTLtW4C3eSild6DBpJ3q T/ptaSZUGes4ycgEhUspsp7pwnzrAz1MhbWI9XZgBKYtjb6jxXVBS8rS3tv7iPsPFTEW VH5w== X-Gm-Message-State: AOAM532JRrhHw9PHYjPwQt4bv+HaxT5PP1EW9eTikDsK9PWljSQdYDaJ 81vhuGYQwG/j5HyYDJwLjIsV+g== X-Received: by 2002:adf:e80f:: with SMTP id o15mr808126wrm.308.1602609561969; Tue, 13 Oct 2020 10:19:21 -0700 (PDT) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id c18sm317609wrq.5.2020.10.13.10.19.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Oct 2020 10:19:21 -0700 (PDT) From: Georgi Djakov To: linux-pm@vger.kernel.org Cc: mdtipton@codeaurora.org, okukatla@codeaurora.org, sibis@codeaurora.org, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, Georgi Djakov Subject: [PATCH] interconnect: qcom: Simplify the vcd compare function Date: Tue, 13 Oct 2020 20:19:23 +0300 Message-Id: <20201013171923.7351-1-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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)