From patchwork Thu Jan 29 18:27:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 5744451 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 078709F38B for ; Thu, 29 Jan 2015 18:09:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 415E02024F for ; Thu, 29 Jan 2015 18:09:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 42FF8201DD for ; Thu, 29 Jan 2015 18:09:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754031AbbA2SJI (ORCPT ); Thu, 29 Jan 2015 13:09:08 -0500 Received: from v094114.home.net.pl ([79.96.170.134]:50306 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751801AbbA2SIW (ORCPT ); Thu, 29 Jan 2015 13:08:22 -0500 Received: from aerk16.neoplus.adsl.tpnet.pl (79.191.192.16) (HELO vostro.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer v0.80) id 53cd3523cd27951d; Thu, 29 Jan 2015 19:08:20 +0100 From: "Rafael J. Wysocki" To: Linux PM list Cc: Linux Kernel Mailing List , ACPI Devel Maling List , Len Brown , Peter Zijlstra Subject: [PATCH 2/5] ACPI / cpuidle: Clean up fallback to C1 checks Date: Thu, 29 Jan 2015 19:27:50 +0100 Message-ID: <3686267.GOVk0HSzaS@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/3.16.0-rc5+; KDE/4.11.5; x86_64; ; ) In-Reply-To: <8966777.6Ih8y2AWPy@vostro.rjw.lan> References: <8966777.6Ih8y2AWPy@vostro.rjw.lan> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki acpi_idle_enter_simple() and acpi_idle_enter_bm() both check if C2/C3 type entry is supported on MP in the same way, so move those checks to a separate function and call it from both places (and it doesn't need to check if the state type is not C1, because the functions in question won't be called otherwise). While at it, use IS_ENABLED() for the CONFIG_HOTPLUG_CPU check. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/processor_idle.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-pm/drivers/acpi/processor_idle.c =================================================================== --- linux-pm.orig/drivers/acpi/processor_idle.c +++ linux-pm/drivers/acpi/processor_idle.c @@ -758,6 +758,13 @@ static int acpi_idle_play_dead(struct cp return 0; } +static bool acpi_idle_fallback_to_c1(struct acpi_processor *pr) +{ + return IS_ENABLED(CONFIG_HOTPLUG_CPU) && num_online_cpus() > 1 && + !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED) && + !pr->flags.has_cst; +} + /** * acpi_idle_enter_simple - enters an ACPI state without BM handling * @dev: the target CPU @@ -775,12 +782,8 @@ static int acpi_idle_enter_simple(struct if (unlikely(!pr)) return -EINVAL; -#ifdef CONFIG_HOTPLUG_CPU - if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && - !pr->flags.has_cst && - !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) + if (acpi_idle_fallback_to_c1(pr)) return acpi_idle_enter_c1(dev, drv, CPUIDLE_DRIVER_STATE_START); -#endif /* * Must be done before busmaster disable as we might need to @@ -819,12 +822,8 @@ static int acpi_idle_enter_bm(struct cpu if (unlikely(!pr)) return -EINVAL; -#ifdef CONFIG_HOTPLUG_CPU - if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) && - !pr->flags.has_cst && - !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) + if (acpi_idle_fallback_to_c1(pr)) return acpi_idle_enter_c1(dev, drv, CPUIDLE_DRIVER_STATE_START); -#endif if (!cx->bm_sts_skip && acpi_idle_bm_check()) { if (drv->safe_state_index >= 0) {