From patchwork Fri Oct 26 14:48:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 149594 Delivered-To: patches@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp861691ljp; Fri, 26 Oct 2018 07:48:49 -0700 (PDT) X-Received: by 2002:a2e:2c0f:: with SMTP id s15-v6mr2618191ljs.162.1540565329941; Fri, 26 Oct 2018 07:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540565329; cv=none; d=google.com; s=arc-20160816; b=sHFRwlkyWeZUr4TbbRCHog17CXTsxzGQ8EB3qH/yB1vrvEVWEpP/BIjB7SbidyoFIV fYNCCNtEAUmlUqYA23AhLU0lFoKwmo37UeG/yov5lyeWp4UO3Wa/UvGw+edOKJic9z4T zr3qYWNmEcKcCh0ySX51Nr2vLLBN0Sk+kEn2uqPu1csnaozzSH+3A677ORcFh8bBLdwp WeXhPCYaKHI/cLzD328vr7u9A5y7IAWovE6CGjkR9o7fcw3nao5Qe/10KeqCUhmScwOE GwQQL646HHOgYK4ssN3xfRlvLA+l49CeCMptVCaeW0GOKRGeqWspIusoc6yDuhhAIsoB DBdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8rrGST6IyYuwbCKziZkaZRxlhNOWoZtBxENYwjTG0U0=; b=XYA8L7JzGC+gIJsQuhPVAqlyZtiUvolNAwWpFGqgrrPSaOAaL1z3htnP7Ti0ahjaDY oPtz6AEw1zE4HkEpYgtlT18WjAwxpmc4qrn8v2BTx7U8iuEODIGzEc8kpdSJ5FedX6Io x0SrM7e/opZugLBQdttjteLiTaufdzAWIieibPtIu4hrvgWiDTVtp/4sMsdpt7u11yim LScQMvXyNkniLCKrDSfwDpGoPKL4IbXqpb5eKrtusg6miFSZIeHdSACchfVRQqjfEpuU WG6MAcEmsfBPyGiPB7QbROCVVSPLUifuFog1dceQfBJj4ZmzQC80zifVAa0jOtJQlJ8o x0qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KmNHzGIm; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id h196-v6sor3727683lfe.38.2018.10.26.07.48.49 for (Google Transport Security); Fri, 26 Oct 2018 07:48:49 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KmNHzGIm; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8rrGST6IyYuwbCKziZkaZRxlhNOWoZtBxENYwjTG0U0=; b=KmNHzGImY5omP/Qa3/436FXZisrm6Dt6N0Z7KHAXmTkwmjLMPUbqP965SVsEZhkO+X m5q6UNQrlYabhFJzb7SlEYmwXzBl3bFlx29+ufFNUASabhyQwd3fCoFiSOWv4ZGkLYu2 jPcQuYQIK8Zp7sy3+jUDVy5gFMiZVDJ83hgpI= 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:in-reply-to :references; bh=8rrGST6IyYuwbCKziZkaZRxlhNOWoZtBxENYwjTG0U0=; b=gZB9FoHyUDCgkAzce/TD4BN5UaMm/LlDTQvasTbFsfFORhJCdClAkqC+ZV0TuT0c8R bU70fmTvJ4T1eDuGl9G9RaSq2n7JdFi/xNDhNYAkKlTMHZojlSnL4O5jene5G3L5t/fu fwmU4S4NFKfdOIrmdvJIJa3I9zaBNARgYoWFzTbzUvJw4HV8OPOfQn0teYxWXypG1E54 mxMqqwxMZKO39c/zjduMKpQ3dWiYWhn9mpeXEHpv6N3q6Kb1LJ15CRLPx/xhfpdbtx3Q WsRQSFJN2Upm6XajxHMoa2yQuVsZHYuZxn+1ncRbR39hCmiV5snF93AXtMDngHh2F2GD 6igA== X-Gm-Message-State: AGRZ1gLWqNgDiC8BYvpgh6WUbOAGsHNYRQyt3zMQRzW5ZMMCRp58o/cj O3u7gGx7NtMzG6kPPfKLa965oCer X-Google-Smtp-Source: AJdET5e2VtuuxDOS789EBte8iaL3MHgJ9YHWgOimdD9lJqNzq66IHyVHJ85DRPrsJEDU/+XhSBbhug== X-Received: by 2002:a19:e601:: with SMTP id d1mr2555192lfh.71.1540565329567; Fri, 26 Oct 2018 07:48:49 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id v13-v6sm1914785lfb.70.2018.10.26.07.48.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 07:48:48 -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 Subject: [PATCH 1/2] ARM: cpuidle: Don't register the driver when back-end init returns -ENXIO Date: Fri, 26 Oct 2018 16:48:43 +0200 Message-Id: <20181026144843.3028-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <../../misc/pm_patches/submitted_patches/cpuidle_arm_consolidate/0002-ARM-cpuidle-Convert-to-use-cpuidle_register-unregist.patch> References: <../../misc/pm_patches/submitted_patches/cpuidle_arm_consolidate/0002-ARM-cpuidle-Convert-to-use-cpuidle_register-unregist.patch> 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 --- Note, as far as I can tell it's only qcom-spm that may return -ENXIO, which also was original reason to why this error path was invented. Unfurtunate I don't have a qcom spm platfrom at hand, however I manually tried this by hacking the PSCI driver to return -ENXIO for some CPUs. So I assume it should then also work for qcom spm. --- drivers/cpuidle/cpuidle-arm.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) -- 2.17.1 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);