From patchwork Thu Nov 1 12:22:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10663913 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 A3D1A17D5 for ; Thu, 1 Nov 2018 12:22:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A31972AE9A for ; Thu, 1 Nov 2018 12:22:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9722B2B995; Thu, 1 Nov 2018 12:22:50 +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=unavailable 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 289022AE9A for ; Thu, 1 Nov 2018 12:22:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728486AbeKAVZd (ORCPT ); Thu, 1 Nov 2018 17:25:33 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:36307 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728502AbeKAVZd (ORCPT ); Thu, 1 Nov 2018 17:25:33 -0400 Received: by mail-lf1-f67.google.com with SMTP id h192so14064229lfg.3 for ; Thu, 01 Nov 2018 05:22:47 -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; bh=qcWwbwZtVewEzVMNFHBDUWD0Wh6JiYMuWZuUoQUO0FY=; b=QpzGmeQbPqvUiuFCFEnXTLR+LN0et7S3axvoyRfcB67cYRYM1/H6muHHIZbq+4TgDI 8MF5KcNYxzAVYNKrztKZFi+MPcQGgZV1mkLlvnDFxba0ph1kRlFXueLqVSwXZqGF0p/Y JK3QQI8tLLg/crJ2sLLylWmWWv+lTqhc7YuRA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qcWwbwZtVewEzVMNFHBDUWD0Wh6JiYMuWZuUoQUO0FY=; b=rPavXax2xhux7r5uVuUkSOqLh6xFijipAzOdauHrDMJYlUqz71WPMEftcgXf74XT2t SYoFPPpCfl9tQ8HFY4aTCY1xg44zi+CAkMTPdVdWbM+PG0GAkW/jT+8XUmTqqOfl9z+u 8dAd7ZxonfX18n3khgidp069ozC5Mgio6ir5luMofVLm2qroN4apEwA4sh7Yi1ArabxV c1qzDQT5Dm+1Z53g0b5FvzQt1Nc39mJdtOwAkhB7qJQn0+zdJ8590+uMhPommQ+4a6AP zjQltB4O1zz5hcsOdxhkHInDtp9lNG8eQPiRhmSOlEdGv9NAhLPwCdqfFRaUtWaRMSnz d6ww== X-Gm-Message-State: AGRZ1gIzhSkleimQIV6zoiycTEWz5dHIr11D006sC4mJuO9fI+xoldia R2xtBNMDA9FJBD4V40TQD+qpXA== X-Google-Smtp-Source: AJdET5fLWeRWNlprSux34SeX1jeg/R5HrDWIBzc3fltEH8ybfkVfBB/DaR9CZ0RjQqGyc35uIUmp4Q== X-Received: by 2002:a19:5a84:: with SMTP id y4mr4452672lfk.156.1541074966909; Thu, 01 Nov 2018 05:22:46 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id h30-v6sm4591498lfj.34.2018.11.01.05.22.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Nov 2018 05:22:46 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Daniel Lezcano , linux-pm@vger.kernel.org Cc: Sudeep Holla , Lorenzo Pieralisi , Lina Iyer , Ulf Hansson , Vincent Guittot , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v2 1/2] ARM: cpuidle: Don't register the driver when back-end init returns -ENXIO Date: Thu, 1 Nov 2018 13:22:38 +0100 Message-Id: <20181101122238.4167-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There's no point to register the cpuidle driver for the current CPU, when the initialization of the arch specific back-end data fails by returning -ENXIO. Instead, let's re-order the sequence to its original flow, by first trying to initialize the back-end part and then act accordingly on the returned error code. Additionally, let's print the error message, no matter of what error code that was returned. Signed-off-by: Ulf Hansson Fixes: a0d46a3dfdc3 ("ARM: cpuidle: Register per cpuidle device") Cc: # v4.19+ Reviewed-by: Daniel Lezcano --- Changes in v2: - Added a fixes and a stable tag. --- drivers/cpuidle/cpuidle-arm.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c index 073557f433eb..df564d783216 100644 --- a/drivers/cpuidle/cpuidle-arm.c +++ b/drivers/cpuidle/cpuidle-arm.c @@ -103,13 +103,6 @@ static int __init arm_idle_init_cpu(int cpu) goto out_kfree_drv; } - ret = cpuidle_register_driver(drv); - if (ret) { - if (ret != -EBUSY) - pr_err("Failed to register cpuidle driver\n"); - goto out_kfree_drv; - } - /* * Call arch CPU operations in order to initialize * idle states suspend back-end specific data @@ -117,15 +110,20 @@ static int __init arm_idle_init_cpu(int cpu) ret = arm_cpuidle_init(cpu); /* - * Skip the cpuidle device initialization if the reported + * Allow the initialization to continue for other CPUs, if the reported * failure is a HW misconfiguration/breakage (-ENXIO). */ - if (ret == -ENXIO) - return 0; - if (ret) { pr_err("CPU %d failed to init idle CPU ops\n", cpu); - goto out_unregister_drv; + ret = ret == -ENXIO ? 0 : ret; + goto out_kfree_drv; + } + + ret = cpuidle_register_driver(drv); + if (ret) { + if (ret != -EBUSY) + pr_err("Failed to register cpuidle driver\n"); + goto out_kfree_drv; } dev = kzalloc(sizeof(*dev), GFP_KERNEL);