From patchwork Wed Sep 16 13:59:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 53742 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 5D0F622A0D for ; Wed, 16 Sep 2015 14:00:04 +0000 (UTC) Received: by lamp12 with SMTP id p12sf73518039lam.2 for ; Wed, 16 Sep 2015 07:00:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=C3PIqFU/veCSVyyANNtgBMCtVwz6ry52ghbh6v8bGhs=; b=iqUPxo59Xt3KVt2lbR9vA6QGYXJMyJ660Rfp6EsPXaQNNNU31A9yn+6x88as4PwAST ri7w0h28XkpcOVLROpwUShdZtWLtCBtU4rrvBZkmE4v7/Fvdt0pmdNoc+ga1Dedtqa92 4Y7ijnyn0pNVXVMJ6t+7ktqSdGhw3FDC/XdJQMFxcfpklLZ3Vxsh2qbyQS/8quezmpuB 033cuZfUNZR7Y6uXyTeCJcSViic1ovQy62QuktNLTkaxQyAGMH1YkhQyxs2Kj/taJV78 rSbN55MNXqLbOzjX3+pNvKf76v5b8sPO8cAwyhpRkFlMFbaewMjGN+0rgycyR0lngiDh jy4g== X-Gm-Message-State: ALoCoQm5sOEc6gRzFwj8p638+Ck7HAL2dQBUxV3CQaW1V4j7OOWzAoVranOYZQ8wB8IqVwI7VmAf X-Received: by 10.152.9.36 with SMTP id w4mr2947448laa.7.1442412003298; Wed, 16 Sep 2015 07:00:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.66 with SMTP id z2ls845896lag.76.gmail; Wed, 16 Sep 2015 07:00:03 -0700 (PDT) X-Received: by 10.152.23.100 with SMTP id l4mr29584607laf.64.1442412003108; Wed, 16 Sep 2015 07:00:03 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id db5si18297228lac.117.2015.09.16.07.00.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Sep 2015 07:00:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by lbcao8 with SMTP id ao8so103938834lbc.3 for ; Wed, 16 Sep 2015 07:00:03 -0700 (PDT) X-Received: by 10.112.199.70 with SMTP id ji6mr29540004lbc.73.1442412002949; Wed, 16 Sep 2015 07:00:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2472284lbq; Wed, 16 Sep 2015 07:00:01 -0700 (PDT) X-Received: by 10.68.114.34 with SMTP id jd2mr61225718pbb.94.1442411999027; Wed, 16 Sep 2015 06:59:59 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r4si40896935pap.165.2015.09.16.06.59.58; Wed, 16 Sep 2015 06:59:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754047AbbIPN7j (ORCPT + 29 others); Wed, 16 Sep 2015 09:59:39 -0400 Received: from foss.arm.com ([217.140.101.70]:36577 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754014AbbIPN7g (ORCPT ); Wed, 16 Sep 2015 09:59:36 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B7CA25DD; Wed, 16 Sep 2015 06:59:35 -0700 (PDT) Received: from e103737-lin.cambridge.arm.com (e103737-lin.cambridge.arm.com [10.1.207.150]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 084373F23A; Wed, 16 Sep 2015 06:59:33 -0700 (PDT) From: Sudeep Holla To: linux-acpi@vger.kernel.org, "Rafael J. Wysocki" Cc: Sudeep Holla , linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, x86@kernel.org, Al Stone , Lorenzo Pieralisi , Mahesh Sivasubramanian , Ashwin Chaugule Subject: [PATCH v2 2/5] ACPI / sleep: move acpi_processor_sleep to sleep.c Date: Wed, 16 Sep 2015 14:59:20 +0100 Message-Id: <1442411963-14398-3-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442411963-14398-1-git-send-email-sudeep.holla@arm.com> References: <1438710406-3822-1-git-send-email-sudeep.holla@arm.com> <1442411963-14398-1-git-send-email-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sudeep.holla@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , acpi_processor_sleep is neither related nor used by CPUIdle framework. It's used in system suspend/resume path as a syscore operation. It makes more sense to move it to acpi/sleep.c where all the S-state transition (a.k.a. Linux system suspend/hiberate) related code are present. Also make it depend on CONFIG_ACPI_SYSTEM_POWER_STATES_SUPPORT so that it's not compiled on architecture like ARM64 where S-states are not yet defined in ACPI. Cc: "Rafael J. Wysocki" Signed-off-by: Sudeep Holla --- drivers/acpi/processor_driver.c | 2 -- drivers/acpi/processor_idle.c | 37 ------------------------------------- drivers/acpi/sleep.c | 35 +++++++++++++++++++++++++++++++++++ include/acpi/processor.h | 8 -------- 4 files changed, 35 insertions(+), 47 deletions(-) diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index 51e658f21e95..dff584a7137b 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -307,7 +307,6 @@ static int __init acpi_processor_driver_init(void) if (result < 0) return result; - acpi_processor_syscore_init(); register_hotcpu_notifier(&acpi_cpu_notifier); acpi_thermal_cpufreq_init(); acpi_processor_ppc_init(); @@ -323,7 +322,6 @@ static void __exit acpi_processor_driver_exit(void) acpi_processor_ppc_exit(); acpi_thermal_cpufreq_exit(); unregister_hotcpu_notifier(&acpi_cpu_notifier); - acpi_processor_syscore_exit(); driver_unregister(&acpi_processor_driver); } diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 175c86bee3a9..a24067b850d2 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -30,7 +30,6 @@ #include /* need_resched() */ #include #include -#include #include /* @@ -194,42 +193,6 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr, #endif -#ifdef CONFIG_PM_SLEEP -static u32 saved_bm_rld; - -static int acpi_processor_suspend(void) -{ - acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld); - return 0; -} - -static void acpi_processor_resume(void) -{ - u32 resumed_bm_rld = 0; - - acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld); - if (resumed_bm_rld == saved_bm_rld) - return; - - acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld); -} - -static struct syscore_ops acpi_processor_syscore_ops = { - .suspend = acpi_processor_suspend, - .resume = acpi_processor_resume, -}; - -void acpi_processor_syscore_init(void) -{ - register_syscore_ops(&acpi_processor_syscore_ops); -} - -void acpi_processor_syscore_exit(void) -{ - unregister_syscore_ops(&acpi_processor_syscore_ops); -} -#endif /* CONFIG_PM_SLEEP */ - #if defined(CONFIG_X86) static void tsc_check_state(int state) { diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 2f0d4db40a9e..b920ada49ae9 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -672,6 +673,39 @@ static void acpi_sleep_suspend_setup(void) static inline void acpi_sleep_suspend_setup(void) {} #endif /* !CONFIG_SUSPEND */ +#ifdef CONFIG_PM_SLEEP +static u32 saved_bm_rld; + +static int acpi_processor_suspend(void) +{ + acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld); + return 0; +} + +static void acpi_processor_resume(void) +{ + u32 resumed_bm_rld = 0; + + acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld); + if (resumed_bm_rld == saved_bm_rld) + return; + + acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld); +} + +static struct syscore_ops acpi_processor_syscore_ops = { + .suspend = acpi_processor_suspend, + .resume = acpi_processor_resume, +}; + +void acpi_processor_syscore_init(void) +{ + register_syscore_ops(&acpi_processor_syscore_ops); +} +#else +static inline void acpi_processor_syscore_init(void) {} +#endif /* CONFIG_PM_SLEEP */ + #ifdef CONFIG_HIBERNATION static unsigned long s4_hardware_signature; static struct acpi_table_facs *facs; @@ -834,6 +868,7 @@ int __init acpi_sleep_init(void) sleep_states[ACPI_STATE_S0] = 1; + acpi_processor_syscore_init(); acpi_sleep_suspend_setup(); acpi_sleep_hibernate_setup(); diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 51b61dcdbd9c..0abcab53dbe5 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h @@ -381,14 +381,6 @@ static inline int acpi_processor_hotplug(struct acpi_processor *pr) } #endif /* CONFIG_ACPI_PROCESSOR_IDLE */ -#if defined(CONFIG_PM_SLEEP) & defined(CONFIG_ACPI_PROCESSOR_IDLE) -void acpi_processor_syscore_init(void); -void acpi_processor_syscore_exit(void); -#else -static inline void acpi_processor_syscore_init(void) {} -static inline void acpi_processor_syscore_exit(void) {} -#endif - /* in processor_thermal.c */ int acpi_processor_get_limit_info(struct acpi_processor *pr); extern const struct thermal_cooling_device_ops processor_cooling_ops;