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: 6743 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp753399wrr; Fri, 21 Oct 2022 08:15:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ArxR2RE4BnPyyCsA6PMBYTiMG5AzUH73zzj9uTq76lryBRX3oSi7AgU7cnAm/1OYZoVhs X-Received: by 2002:a17:907:2708:b0:78d:d22b:c8a9 with SMTP id w8-20020a170907270800b0078dd22bc8a9mr16100734ejk.640.1666365327300; Fri, 21 Oct 2022 08:15:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666365327; cv=none; d=google.com; s=arc-20160816; b=VXY1QgXepHGuBh4GXeTKVxSClftMtjxpfg0/mhlImbjXZNNiYVL0+BmJACVEvQjWzx XBjS1KR3P0ustM9qQMdnhJPrQ2K/OmqtCiZKdHmSGSR8cmxTl22pb5ZcALWfMjZ9TFmM 5P/d6Iufq9GgYi7akuRREl6ma2v/MwxelDt8miQjC4fL63Qb9TObOrmcOobFrWZiCrMU fBq04NRd/ITwkNj5wGIo+rbDVCm7utL6St46HZQaZahhHDuIg+RywaG4OEOCuptkvYaG 5ZZJX+vqoOW+1qWsWmSaikX5lJWkbIaBk8dDRSukYSW+1Ix/VHf/GhxVZZ/RY9FQHRPK psIQ== 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=TF6XEvFWOEgGd45xR42b2Ik4eFRVeWARvUbr71hDMcE=; b=cLkg+AtVevxzlYcpo1pC39xol1Gr8LvXozLwKbXpBTcM0WEncjIMQDmAJM7AgyiihN Rbm9F0j3zqCTzz7Sul/eO3GCMzmouakTJNqiz18Cdua1Ve/9JChrBxpfpuWsc2KyuQFp EqL9/jJFuF7CcewvNZpzEvO4YqFby+RnVp3J6ZlC5KnsWNupgEf0ZE/0uEtHcK/wUtiw bMWqA0XcAvlPaBI0va19u7foC2i0zsJq05XnNLO7PhHrDGd5zSgtUwmWZpZ04ayJKpJ/ JVqhke+4qKPQzKwkgxpHJ9XljbJGhSw/NdZo+/HVMjt6WU3pWNa1usDdbaFIjrbxuKXW hwcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KRmXFvyH; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di15-20020a170906730f00b00791a7e441a3si8447601ejc.459.2022.10.21.08.15.02; Fri, 21 Oct 2022 08:15:27 -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=KRmXFvyH; 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 S230157AbiJUPKw (ORCPT + 99 others); Fri, 21 Oct 2022 11:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230367AbiJUPK2 (ORCPT ); Fri, 21 Oct 2022 11:10:28 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC49794130 for ; Fri, 21 Oct 2022 08:10:23 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id a29so5689415lfo.1 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=1b2FBTNXQwLHJam4vaRn8Oos64Cznd1U5DwEkiWvGNy+hyUcPzgusRQd00WfNDUrN8 /A7D5DG7qxH9xxt3WngV8kdLA3qAWqH2MFoB5Fv5TGr72g6J6FXNt5MF3S0rm70UwhiX swu8giTzdrDkWbYPm1UB4QDr9C7h8ZzBZMlAcdL1SnXWANGufNHGjTxeNdjQ7upPl5Ri niveiRelUaosRZMVPr3Cfo8NM5g+sRkgQMQppNgz0xbfpFmPgNG3/NrhlNVVzUk5SyTO bA8LAC2M+2IsKV/8ydJQ0IUCbaBAPhQMO59p65R/FchUARNLtslXuhV0vbe9Z/Xpj6GK eiSA== X-Gm-Message-State: ACrzQf1q4/ArUbghz4SrgVndfQFDnYO6Y5OYNebtlyiBqRn4FlhWzY5Q s9AncUeuKDe7W3j9/ABfWcSnYw== 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-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,URIBL_BLOCKED autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747310689274276867?= X-GMAIL-MSGID: =?utf-8?q?1747310689274276867?= 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); From patchwork Fri Oct 21 15:10:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 6742 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp753178wrr; Fri, 21 Oct 2022 08:15:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6bJ0ncpfOGvSUIiNgSg0y0hXOKJKZoPTsZVouM2lpboSnjTm49IgGyTRLOwGrZIhjhXJp/ X-Received: by 2002:a62:d448:0:b0:565:ef61:ee0d with SMTP id u8-20020a62d448000000b00565ef61ee0dmr19658113pfl.73.1666365302893; Fri, 21 Oct 2022 08:15:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666365302; cv=none; d=google.com; s=arc-20160816; b=Ws+XTGX63VhzPILrcYh4R4bRSmuKfecTEmnIhXikBmNKc3Z+4SDDm9uWCC2NN4W8fH BjNnkNq+iyptnC5r8GjAYb4lChbVwoDUrT0HvDJZqLzesEoY9LVijVPskUx5PwM9l73t Up4cKtsbAgbnoiLrJyDCaByYpfx2Rdk7lz5mu5zy1KgZOslRN2JltFOhbjkactJdA0NO CsHx/bzBY8rPSCz+hsp6FXyGUrcZHWNY89i2nw/xaK2H143dGA9vXgACQxlqFb1V1EYd DrSKgoVxGgw9b4DsZ4kZEKU09CbgMmAJh36FY5ssp4GwfPs3As+ran4YIl2zrwVYqohi oIXw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iOR9Cn2Ao7LcbAtkV7YNTyZf2Awy47Ush30fTe6NZ7o=; b=zjNfxbfHBxDB1tFMpAclAPgSMhiVR0biMNYfkB1MvWxKpky+cn9ATUDrCyQSc1ZGNP C+cj/6JOwaSI9mHLJ1j54VAWYg5wWuN/FMEkqDSM1ZJzD8UTMP30tZdh+uaf8NCuJGGI QzXuwk/avlvuNxRaJHcZaasW3w3XGW3rUOvyTYQ8RakxVNO6HJYw7VuZkHP8U6w2G194 63Q5prKGFEKMvHLG+sjXKH1DvpLfLnigllE/RbZ9cxOR+58sripDLC8R+EE8Yc+iAOze noeROcxlkvEcTAdN2hKqOOYsUUXZ+Rivqikb25WzfrQR6+jZTRDC9C3elg2IKiffV07p ELHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fumjPWjQ; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s73-20020a632c4c000000b00434f938b9efsi25121716pgs.4.2022.10.21.08.14.49; Fri, 21 Oct 2022 08:15:02 -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=fumjPWjQ; 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 S229491AbiJUPLZ (ORCPT + 99 others); Fri, 21 Oct 2022 11:11:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230388AbiJUPKh (ORCPT ); Fri, 21 Oct 2022 11:10:37 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF83F1669A9 for ; Fri, 21 Oct 2022 08:10:35 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id r14so5687183lfm.2 for ; Fri, 21 Oct 2022 08:10:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iOR9Cn2Ao7LcbAtkV7YNTyZf2Awy47Ush30fTe6NZ7o=; b=fumjPWjQIGVgJu1cVeqC9EpaFn0B5jT9PyBcxd6bHUvIZ5/THEeiHLj/jXOXYN6JM/ 3YcHnUceJdvMZzIhZYMTCxarOoMoIswIH5yLpCX/+rRe6iUDsh97NZdGXHSTvF0T76xG YDicGmnc9uT9Msc3k+OCraODleHuYdSm08c/m60SrutHpHJKyjlrg/poU6RkX6loVxr2 3NMCxhewOWuxeGGwll7RDSSeNkYNiyA6nxXTTfE93IO3RGp7+pWGt6oo9r8NszbWsvwR gbUTowFMGUWQV43bbGGFT8c9D5yp5JrXob++0d0DDRyR3uvez6EHKvSedO/IGlpuXPEZ eBaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iOR9Cn2Ao7LcbAtkV7YNTyZf2Awy47Ush30fTe6NZ7o=; b=A2peLmn1cXF2JpjusRCNNWN/xucLqzsICEAgl7yLVrqERJhrq4zGvYY3OQJ8bwR3/B WLsEVNKpweqYw0zIhszIsJT2D0sLs1X0WGuqqRVg6bVJSI8t1Af2CilSETq4tIOjO6/h K1deZDdL4C+UaxBehO+BJtPByDTCFtFoKhb7z+eI4jWehbBZKqEuvjs4hMAfaxKdFZJM 9Bp/dEVbGJtOxrm5GlkvRvxfE3tp7UxuhgTDHRW1neY/8TbmBcQbhYwkXRQC6Y6QjVZW eb5MYzHVtwBrlPNRGcvXLiGz64Cve1r58PtfuxYe8+bgIF9YQ9tBOYNtEJJM/FIx7Yp8 jAPQ== X-Gm-Message-State: ACrzQf17p9elAdxKao0/tPhHfZWt7MhkDeR/RDuLQu5vWOQQF5PwUg4u yEAhA8mNstK3rfneXi7s4w/bSQ== X-Received: by 2002:a05:6512:3a82:b0:4a4:7fc1:35b2 with SMTP id q2-20020a0565123a8200b004a47fc135b2mr6740050lfu.369.1666365034343; Fri, 21 Oct 2022 08:10:34 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 08:10:33 -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 2/2] cpuidle: dt: Clarify a comment and simplify code in dt_init_idle_driver() Date: Fri, 21 Oct 2022 17:10:13 +0200 Message-Id: <20221021151013.148457-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221021151013.148457-1-ulf.hansson@linaro.org> References: <20221021151013.148457-1-ulf.hansson@linaro.org> MIME-Version: 1.0 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,URIBL_BLOCKED autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747310663753900857?= X-GMAIL-MSGID: =?utf-8?q?1747310663753900857?= The drv->state_count is assigned the total number of available states, so let's make that clear. Signed-off-by: Ulf Hansson Reviewed-by: Sudeep Holla --- drivers/cpuidle/dt_idle_states.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c index 448bc796b0b4..7ca3d7d9b5ea 100644 --- a/drivers/cpuidle/dt_idle_states.c +++ b/drivers/cpuidle/dt_idle_states.c @@ -211,12 +211,9 @@ int dt_init_idle_driver(struct cpuidle_driver *drv, of_node_put(cpu_node); if (err) return err; - /* - * Update the driver state count only if some valid DT idle states - * were detected - */ - if (i) - drv->state_count = state_idx; + + /* Set the number of total supported idle states. */ + drv->state_count = state_idx; /* * Return the number of present and valid DT idle states, which can