Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1560567iob; Sat, 14 May 2022 12:34:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyw+Dm/KWhLx6XkWUoXJr7Z6sN/mgVH7vNw1C2rUaGE5dbHUXRF+SuQWqzt2YDc7uy4ZAsP X-Received: by 2002:a5d:47c5:0:b0:20c:5a48:7162 with SMTP id o5-20020a5d47c5000000b0020c5a487162mr8879558wrc.32.1652556873976; Sat, 14 May 2022 12:34:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652556873; cv=none; d=google.com; s=arc-20160816; b=tod2UWJvamOvvuDidzaYWBWwJZQ2qzUzv1/wiGhmzDsFN+WaB/PndZEmYEq0Q28yS9 LowrZVCtPk1MDeGUf4vHGsx3wfF2liUxAcTqzqR8NJwQTviFV+wH6WQkyzY1kgYnA+Jk 4yqE4Ffqw4I+OSnclgDrBN6xCePbXby5UWxfqcBDIk+TPHWtrMsVEUXnaXoNm2c32HhC jk6wxA5zo9QUoAb3yFnkxlkXoUU+bXIWfJxkMS1GQq7n4uKuZ8TXz+eWTwPcDTTs2hPy ONX9HwOwN/y26XB4EghOAabkeNacNkhXg+w7IHphA5iN1el0P4ABtH8ch90nn45KQcJa /+Qg== 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=jN8Cl5mMVbr+UVzRRSRn5vcrJAUsBCcLDo+azLgnVmQ=; b=z+XeTFmdkkwXySYXIzmBsBUrVAXyXKdosBBGFWRh2nbONLicP34Q9jtu4L227zGL+1 k0QrLZ0uM8pVy+z/uhEycXaPjzdbdepCdmDKVfvEbxA2wHzXnaE/pnip0lCPzqi9fmRm XkF7LvzjkjlMwyMfO3IeQYkwk29WPq/NpUasvSAHP3RQR0wClzFhQZM7mIBIjh1b8ZDN yADwcnFLawU13lFIlyoGVNy2siCkoKWQzg0HooiiPELkFmQ6ouACUxVL0Egl1T3FTOvj KIqpVFCVAU2G6fM3Vp0Ca2OoSt9TyfL3yJsoa4Equk+bNCh4+vILNIn/MOiY8qrQqHnf sB+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZGnFOk9h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a5-20020adfeec5000000b0020c3e1cd371si5126361wrp.17.2022.05.14.12.34.07; Sat, 14 May 2022 12:34:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZGnFOk9h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233870AbiENPUy (ORCPT + 99 others); Sat, 14 May 2022 11:20:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233782AbiENPUv (ORCPT ); Sat, 14 May 2022 11:20:51 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 765B22F3A5 for ; Sat, 14 May 2022 08:20:50 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id 4so13434707ljw.11 for ; Sat, 14 May 2022 08:20:50 -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=jN8Cl5mMVbr+UVzRRSRn5vcrJAUsBCcLDo+azLgnVmQ=; b=ZGnFOk9hnpw6WfZAAwaIom/4T/t0E3RIw3N5rrztcNKF1+cnTHgUXQ5eAksdWhd8F8 LL0Hp6hlh1rBhZ8SpqPVGfvIw1MIfkwUwzEuLT4zYmqW6XfwWdjbxmugBH1rWe5FqKDc /qih7U8rfz8MXQKbPbRmdkUNl+VZR0fZnSe8Q4oWjwleOFkxqjHQ/eJrOdyGQDvcczNR uGhzOiBs06Bu55Kp2793VRtPn+Ke5pCYovkRcYRg8YBg0l1vBMPZuK4oTnnzOcVgfDBl fNQiOTkxaUGgmBGs3YjN5kH6dZHJKibKoPXPqoxNpBYmiG4gQRpsZF3hN6DD9NrCN8f0 YkDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jN8Cl5mMVbr+UVzRRSRn5vcrJAUsBCcLDo+azLgnVmQ=; b=CKevCcYJ+SqZCzHxAJPJHcIghmiASBc7blK/qtr8NqpXAsmTfuyk9XRIUlov25NB/I kD/pRsHtxEzMHO2g2vpJjlcuzA1zk4Y9F50xxqGpsZjugl8MTeJReR6SK+4ffbqsEsO2 ss3jCvAO1KSqeMAIrnSpeDRlIPb3BX3av4YnNH4BFNiV63i7ouGpFk37NfIesvLpiQGO Ok2D6QkIyE7oSXodIDZTqklBsazZBYnMXiFggeHKZMg67yKmT0nWNnvnz6l78H3wxo99 3cKSF6FFdJSw0IhKfMEtWbaWgtEsKeKxlESVgKlwP1RWt0c7oLC6iFKQ5p7B8Uig527T Pepw== X-Gm-Message-State: AOAM532c3kc0sGUl5BKCnEy7eBJ9Fubg1wm16idE0J4C/Mg7NLsdRMSD lg5qfE3wFgoC7ghHoWp6JleL8g== X-Received: by 2002:a2e:84c7:0:b0:24b:6842:1923 with SMTP id q7-20020a2e84c7000000b0024b68421923mr6306348ljh.166.1652541648677; Sat, 14 May 2022 08:20:48 -0700 (PDT) Received: from localhost.localdomain (h-98-128-181-154.NA.cust.bahnhof.se. [98.128.181.154]) by smtp.gmail.com with ESMTPSA id j18-20020ac24552000000b0047255d211d4sm734170lfm.259.2022.05.14.08.20.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 May 2022 08:20:47 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Anup Patel , linux-pm@vger.kernel.org Cc: Sudeep Holla , Lorenzo Pieralisi , Maulik Shah , Daniel Lezcano , Paul Walmsley , Palmer Dabbelt , Albert Ou , Atish Patra , Ulf Hansson , linux-arm-kernel@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] cpuidle: riscv-sbi: Fix code to allow a genpd governor to be used Date: Sat, 14 May 2022 17:20:44 +0200 Message-Id: <20220514152044.758802-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The intent is to use a genpd governor when there are some states that needs to be managed. Although, the current code ends up to never assign a governor, let's fix this. Fixes: 6abf32f1d9c50 ("cpuidle: Add RISC-V SBI CPU idle driver") Signed-off-by: Ulf Hansson --- drivers/cpuidle/cpuidle-riscv-sbi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpuidle/cpuidle-riscv-sbi.c b/drivers/cpuidle/cpuidle-riscv-sbi.c index b459eda2cd37..478970fa3b0c 100644 --- a/drivers/cpuidle/cpuidle-riscv-sbi.c +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c @@ -413,7 +413,7 @@ static int sbi_pd_init(struct device_node *np) struct generic_pm_domain *pd; struct sbi_pd_provider *pd_provider; struct dev_power_governor *pd_gov; - int ret = -ENOMEM, state_count = 0; + int ret = -ENOMEM; pd = dt_idle_pd_alloc(np, sbi_dt_parse_state_node); if (!pd) @@ -432,7 +432,7 @@ static int sbi_pd_init(struct device_node *np) pd->flags |= GENPD_FLAG_ALWAYS_ON; /* Use governor for CPU PM domains if it has some states to manage. */ - pd_gov = state_count > 0 ? &pm_domain_cpu_gov : NULL; + pd_gov = pd->states ? &pm_domain_cpu_gov : NULL; ret = pm_genpd_init(pd, pd_gov, false); if (ret) -- 2.25.1