Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2205560iof; Tue, 7 Jun 2022 23:10:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKFHfUszJ93xphzJAxYLt8OxlodlGzLKdUEw9lk9+aIPx/etYawDOnPleaRIS6OgHzKP9w X-Received: by 2002:a05:6a00:a16:b0:518:ffe0:7229 with SMTP id p22-20020a056a000a1600b00518ffe07229mr68334775pfh.49.1654668606291; Tue, 07 Jun 2022 23:10:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668606; cv=none; d=google.com; s=arc-20160816; b=z/xkaQdKW1UbTVmbkE84Xv3jYQzZ64TPnHB5+IH8mDOt84RDjZEee76ttVlJiT+faL UxqsgOwFf5CQ5BTmJjRfXjB+v/52cydOwhjduD85++q+xUN37b7bWzeqT1hmeNzg7ZVA gJ1FM/jkkpHr5Ye+zDvxwCCR25T9WL3fiz5QyLZutUJne/x8bGe3XwsaSUK1oBecxu0e MujFk6dP+Q6G8MtxoXMVFlsX4YmYRS0hgSZZlBPe6ZjotFTc4/sLTRUNbGJgbZ9gYjk6 w5UyYFs7hgQacfxr5NH81MWnr7/Hsqh7VpFVCosrsLREjsWAplwWI2TH8jX3/aS+Mj1j oMRg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6vYAZLqR5QAHGjmi49oyjwGCnadYW5nfKqDWXcv3WJU=; b=NrfJry4fT/MzMPFpEscdzhpWrpzbcBl3Jfxe0FWAnoc2Q+rawzYN4FJ9EdUNtZ1hL6 MxCMbo446fP982pxJE9OI0jvWMOH0pK2ESoY+Tbrw40ba2SuLglK8YmdnA/RFHk43PwQ 0DPiWWqOMl/F4OMLTUG3FhTTc4qLc5JXjt52+Jbtf5dWC571vqR5VB06K0OJ5/BB96O4 iB5W7fVEgLlW6yb5HhdYviOLRyQkfr6R0eFmMB2wMcJ1wReeZgl50qkOkIrshQ3M2PeH oznZrNEUJSRA6HY8R6CGnbBp4ql+qgWt4Zz58cX1kyPuWU6mp8T4I6Jay+eVD2Pi/N5J NLlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E6qH2QNu; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id g4-20020a056a0023c400b004fa3a8e002csi29332917pfc.227.2022.06.07.23.10.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:10:06 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E6qH2QNu; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6CF994933E6; Tue, 7 Jun 2022 22:32:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237754AbiFHBjB (ORCPT + 99 others); Tue, 7 Jun 2022 21:39:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382468AbiFGVv3 (ORCPT ); Tue, 7 Jun 2022 17:51:29 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E02E23BC31; Tue, 7 Jun 2022 12:08:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id B16D4CE249A; Tue, 7 Jun 2022 19:08:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE16CC385A5; Tue, 7 Jun 2022 19:08:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628929; bh=Oz1PMJqTL1/V968NB2oHZ+dh7qhXR35zqiuAnvBfErw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E6qH2QNufAUq4Daz1JBK/6zig7/8Nwagy0iUfuA7h/0h0Zaix+4B9x+Gb91aBbPCI 12b/wpbELCIdwGQoexKILGhsXN1NTf2Wv5s6FgDJwA/vsBJvPWp0rahOm8vHY+pmXx J4fHaQeuH9P4ktwAWx/nT1vuSkqPHoP7G3kPmZlU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ulf Hansson , Anup Patel , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 500/879] cpuidle: riscv-sbi: Fix code to allow a genpd governor to be used Date: Tue, 7 Jun 2022 19:00:18 +0200 Message-Id: <20220607165017.384952156@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,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 From: Ulf Hansson [ Upstream commit a6653fb584b5f6ac60ddd5d86ddd49a1f3945a04 ] 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 Reviewed-by: Anup Patel Tested-by: Anup Patel Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- 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 5c852e671992..1151e5e2ba82 100644 --- a/drivers/cpuidle/cpuidle-riscv-sbi.c +++ b/drivers/cpuidle/cpuidle-riscv-sbi.c @@ -414,7 +414,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) @@ -433,7 +433,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.35.1