From patchwork Fri Feb 1 02:16:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Lo X-Patchwork-Id: 10791699 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1859313B4 for ; Fri, 1 Feb 2019 02:16:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07FA631052 for ; Fri, 1 Feb 2019 02:16:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF907317D4; Fri, 1 Feb 2019 02:16:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91E6831052 for ; Fri, 1 Feb 2019 02:16:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727947AbfBACQp (ORCPT ); Thu, 31 Jan 2019 21:16:45 -0500 Received: from hqemgate14.nvidia.com ([216.228.121.143]:6305 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726798AbfBACQo (ORCPT ); Thu, 31 Jan 2019 21:16:44 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 31 Jan 2019 18:16:46 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 31 Jan 2019 18:16:44 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 31 Jan 2019 18:16:44 -0800 Received: from HQMAIL104.nvidia.com (172.18.146.11) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Fri, 1 Feb 2019 02:16:43 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Fri, 1 Feb 2019 02:16:43 +0000 Received: from josephl-linux.nvidia.com (Not Verified[10.19.108.132]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Thu, 31 Jan 2019 18:16:43 -0800 From: Joseph Lo To: "Rafael J . Wysocki" , Daniel Lezcano CC: , , , Sudeep Holla , Joseph Lo Subject: [PATCH V2] cpuidle: dt: bail out if the idle-state DT node is not compatible Date: Fri, 1 Feb 2019 10:16:39 +0800 Message-ID: <20190201021639.27245-1-josephl@nvidia.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-NVConfidentiality: public DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1548987406; bh=xHFinBIHHiPCrjKdjMcLZrTppMXBCiOOzTv5MfwdUB0=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:X-NVConfidentiality:Content-Transfer-Encoding: Content-Type; b=XGKIJBbHGD1Its0Jy/VYxmLF9WegAHGjrtsElqBgiVeMeeyD9qqSSUuB7xEhd9UiG ZKgCYFOea94bc32lJhvN8tLgfDfC5o9EKzIApYT6vlbMz/GC1DNOLvCMfuPage1xec EW5ddgU9he/0JctBKvmHi+fVd2ru5y7JwomR68snhWR68d0nWcWT8tya3NoUbJgYuP fql/RxPumYkG/T3HDED27wPA62ImzmChs9A7Eq419lWWtyJGBgsNWTTpAzswAJ4cCX uSDegg4Kw4JHPnBMumqWao3/0amZpwODf/yIgWaCSB9otgq+Di2EFWjRtPcp53Q/C0 YYbHeyYMJf/4Q== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, the DT of the idle states will be parsed first whether it's compatible or not. This could cause a warning message that comes from if the CPU doesn't support identical idle states. E.g. Tegra186 can run with 2 Cortex-A57 and 2 Denver cores with different idle states on different types of these cores. So fix it by checking the match node earlier, then it can make sure it only goes through the idle states that the CPU supported. Signed-off-by: Joseph Lo Reviewed-by: Sudeep Holla --- v2: * fix it by moving of_match_node earlier, so we don't need to match the node twice like the v1 did. --- drivers/cpuidle/dt_idle_states.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c index 53342b7f1010..add9569636b5 100644 --- a/drivers/cpuidle/dt_idle_states.c +++ b/drivers/cpuidle/dt_idle_states.c @@ -22,16 +22,12 @@ #include "dt_idle_states.h" static int init_state_node(struct cpuidle_state *idle_state, - const struct of_device_id *matches, + const struct of_device_id *match_id, struct device_node *state_node) { int err; - const struct of_device_id *match_id; const char *desc; - match_id = of_match_node(matches, state_node); - if (!match_id) - return -ENODEV; /* * CPUidle drivers are expected to initialize the const void *data * pointer of the passed in struct of_device_id array to the idle @@ -160,6 +156,7 @@ int dt_init_idle_driver(struct cpuidle_driver *drv, { struct cpuidle_state *idle_state; struct device_node *state_node, *cpu_node; + const struct of_device_id *match_id; int i, err = 0; const cpumask_t *cpumask; unsigned int state_idx = start_idx; @@ -180,6 +177,12 @@ int dt_init_idle_driver(struct cpuidle_driver *drv, if (!state_node) break; + match_id = of_match_node(matches, state_node); + if (!match_id) { + err = -ENODEV; + break; + } + if (!of_device_is_available(state_node)) { of_node_put(state_node); continue; @@ -198,7 +201,7 @@ int dt_init_idle_driver(struct cpuidle_driver *drv, } idle_state = &drv->states[state_idx++]; - err = init_state_node(idle_state, matches, state_node); + err = init_state_node(idle_state, match_id, state_node); if (err) { pr_err("Parsing idle state node %pOF failed with err %d\n", state_node, err);