From patchwork Fri Oct 21 15:10:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13014902 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7DF38C43217 for ; Fri, 21 Oct 2022 15:11:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=PkaCzmAY/OEmk4ts7qpqP/cj4FvEJVB11/8waJ1D7ZE=; b=XDLfSyByI+cUID qcuNDi3LNq3PyT4+NlEYx8lWUu3T2+12dU3LBt5L2wPXlazIjrI2kHV083+39zn7SquM3PT7YCiUH PKj6IEvE6/CFjgQ5jKmP+Fij8K+RhDyJrzj5tcYtbKaDkPFK8Zp1DDidvM9+YnQG6XsfaILWMWWas lKxEm+gJtVPHM1ivmCIxQPPz/JNTLSz6Ix18MHaD/9Gs37jjZ7Ha86f76KaA4DQ2mXjk1DI+7AJxY 26EkK32pOCK7GRc7jXZIWgPTNcU+04ZiMhvPgg+OXlL1TYcRdzJtkTPI/YcDVtHRo8dgJyg0WM0r4 J2I1AeNbXuxjA+RqGXYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oltfK-008dot-95; Fri, 21 Oct 2022 15:10:30 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oltfG-008dnz-Kh for linux-arm-kernel@lists.infradead.org; Fri, 21 Oct 2022 15:10:28 +0000 Received: by mail-lf1-x133.google.com with SMTP id bp15so5566222lfb.13 for ; Fri, 21 Oct 2022 08:10:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TF6XEvFWOEgGd45xR42b2Ik4eFRVeWARvUbr71hDMcE=; b=KRmXFvyHUTg36Lgc4C6cPZqipnlxJ3e5OcYFJ4U0hCUoBED3qsJB6IxneioiSPfARF Rwbds9KpGW2mFOw0qbHD33d/ya85qVIKVGAq05kp6OyMIvtgII6O+tJeW9Aip9iy3RVF xjzZnET80g30lvQpHQDr6O34ocKDoy+aKAYLo9EZ2L8jsUdHfhZhlC659RFyJamBwgo6 1qs3muh+x4kkc+r6awAAXP4gp9EaaP6KeN00AlLJy7JaBd2O/hD0qZruhkU2SZWvmFI6 zJLSWvnEXbHqnNHfws7AGmVl6x4/1A/+VCIirmG9DFDkOn/qsxnER+YRYA6TWbScsxPz PCPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TF6XEvFWOEgGd45xR42b2Ik4eFRVeWARvUbr71hDMcE=; b=aiJW/cxZYmWKSqS8l6NxlWpNwh3v8SmZ1dLCrN1+CgUVfsG5UMzsQ1Cb2noicQ3MF+ HtFi5bHwjLuUeOXpmZogqQ7SooXEwuWa6Ogze0N6V4XXrYhSj137RyIk02+AwtBm5Rp/ OxRzMhuPxaAxwg6SiFLr/JnUXnpOM0It5itCeTh3AXKfU24ZcYzcsdUlSdCHWueV01NT f6553k4euFysetK/3ikaRRsdZB8hFCnMBFuDF1xY76DCM5SHAk1uGhsEm0XhyLTvSziK prM4IzL2h9yWgUTHQG9zJv7gZ4gsSsz/MExaahqsUKmISrQnsecjedQ5yjwt5gMLrCc7 Zq5Q== X-Gm-Message-State: ACrzQf26sglp1COUfHn7QlUM/bDNN0g1p1yXglyuDtaB5X63DD+rsAqW hVGhXI7MCtwHKxlBDP9bNvfd4Q== X-Google-Smtp-Source: AMsMyM40Jny5+piUfDJS2esIl3pFcwenmI+hi4WYUHDOJI5I6NyvqyD45We26A1PjdeXicfFtq4NYA== X-Received: by 2002:ac2:5e9d:0:b0:4a0:5828:6cf8 with SMTP id b29-20020ac25e9d000000b004a058286cf8mr6450268lfq.567.1666365021804; Fri, 21 Oct 2022 08:10:21 -0700 (PDT) Received: from uffe-XPS13.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id s10-20020a056512202a00b0049476667228sm3199764lfs.65.2022.10.21.08.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 08:10:20 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Daniel Lezcano , linux-pm@vger.kernel.org Cc: Sudeep Holla , Lorenzo Pieralisi , Catalin Marinas , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] cpuidle: dt: Return the correct numbers of parsed idle states Date: Fri, 21 Oct 2022 17:10:12 +0200 Message-Id: <20221021151013.148457-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221021_081026_702707_C105B348 X-CRM114-Status: GOOD ( 12.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org While we correctly skips to initialize an idle state from a disabled idle state node in DT, the returned value from dt_init_idle_driver() don't get adjusted accordingly. Instead the number of found idle state nodes are returned, while the callers are expecting the number of successfully initialized idle states from DT. This leads to cpuidle drivers unnecessarily continues to initialize their idle state specific data. Moreover, in the case when all idle states have been disabled in DT, we would end up registering a cpuidle driver, rather than relying on the default arch specific idle call. Fixes: 9f14da345599 ("drivers: cpuidle: implement DT based idle states infrastructure") Signed-off-by: Ulf Hansson Reviewed-by: Sudeep Holla --- drivers/cpuidle/dt_idle_states.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c index 252f2a9686a6..448bc796b0b4 100644 --- a/drivers/cpuidle/dt_idle_states.c +++ b/drivers/cpuidle/dt_idle_states.c @@ -223,6 +223,6 @@ int dt_init_idle_driver(struct cpuidle_driver *drv, * also be 0 on platforms with missing DT idle states or legacy DT * configuration predating the DT idle states bindings. */ - return i; + return state_idx - start_idx; } EXPORT_SYMBOL_GPL(dt_init_idle_driver);