linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: ke.yu@intel.com, kevin.tian@intel.com,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	lenb@kernel.org, rjw@sisk.pl
Cc: xen-devel@lists.xensource.com, jeremy@goop.org,
	konrad@kernel.org, stefan.bader@canonical.com,
	Ian.Campbell@citrix.com, mike.mcclurg@citrix.com,
	liang.tang@oracle.com,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH 3/8] ACPI: processor: add __acpi_processor_[un]register_driver helpers.
Date: Wed, 30 Nov 2011 12:20:59 -0500	[thread overview]
Message-ID: <1322673664-14642-4-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1322673664-14642-1-git-send-email-konrad.wilk@oracle.com>

From: Tang Liang <liang.tang@oracle.com>

This patch implement __acpi_processor_[un]register_driver helper,
so we can registry override processor driver function. Specifically
the Xen processor driver.

By default the values are set to the native one.

Signed-off-by: Tang Liang <liang.tang@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 drivers/acpi/processor_driver.c |   35 +++++++++++++++++++++++++++++------
 include/acpi/processor.h        |    6 +++++-
 2 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 211c078..55f0b89 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -90,6 +90,11 @@ static const struct acpi_device_id processor_device_ids[] = {
 };
 MODULE_DEVICE_TABLE(acpi, processor_device_ids);
 
+int (*__acpi_processor_register_driver)(void) = acpi_processor_register_driver;
+void (*__acpi_processor_unregister_driver)(void) \
+	= acpi_processor_unregister_driver;
+
+
 static struct acpi_driver acpi_processor_driver = {
 	.name = "processor",
 	.class = ACPI_PROCESSOR_CLASS,
@@ -779,6 +784,22 @@ void acpi_processor_uninstall_hotplug_notify(void)
 	unregister_hotcpu_notifier(&acpi_cpu_notifier);
 }
 
+int acpi_processor_register_driver(void)
+{
+	int result = 0;
+
+	result = acpi_bus_register_driver(&acpi_processor_driver);
+	return result;
+}
+
+void acpi_processor_unregister_driver(void)
+{
+	acpi_bus_unregister_driver(&acpi_processor_driver);
+
+	cpuidle_unregister_driver(&acpi_idle_driver);
+
+	return;
+}
 /*
  * We keep the driver loaded even when ACPI is not running.
  * This is needed for the powernow-k8 driver, that works even without
@@ -794,9 +815,11 @@ static int __init acpi_processor_init(void)
 
 	memset(&errata, 0, sizeof(errata));
 
-	result = acpi_bus_register_driver(&acpi_processor_driver);
-	if (result < 0)
-		return result;
+	if (__acpi_processor_register_driver) {
+		result = __acpi_processor_register_driver();
+		if (result < 0)
+			return result;
+	}
 
 	acpi_processor_install_hotplug_notify();
 
@@ -809,6 +832,7 @@ static int __init acpi_processor_init(void)
 	return 0;
 }
 
+
 static void __exit acpi_processor_exit(void)
 {
 	if (acpi_disabled)
@@ -820,9 +844,8 @@ static void __exit acpi_processor_exit(void)
 
 	acpi_processor_uninstall_hotplug_notify();
 
-	acpi_bus_unregister_driver(&acpi_processor_driver);
-
-	cpuidle_unregister_driver(&acpi_idle_driver);
+	if (__acpi_processor_unregister_driver)
+		__acpi_processor_unregister_driver();
 
 	return;
 }
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index bd99fb6..969cbc9 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -225,6 +225,9 @@ struct acpi_processor_errata {
 	} piix4;
 };
 
+extern int (*__acpi_processor_register_driver)(void);
+extern void (*__acpi_processor_unregister_driver)(void);
+
 extern int acpi_processor_preregister_performance(struct
 						  acpi_processor_performance
 						  __percpu *performance);
@@ -242,7 +245,8 @@ int acpi_processor_notify_smm(struct module *calling_module);
 
 void acpi_processor_install_hotplug_notify(void);
 void acpi_processor_uninstall_hotplug_notify(void);
-
+int acpi_processor_register_driver(void);
+void acpi_processor_unregister_driver(void);
 int acpi_processor_add(struct acpi_device *device);
 int acpi_processor_remove(struct acpi_device *device, int type);
 void acpi_processor_notify(struct acpi_device *device, u32 event);
-- 
1.7.7.3


  parent reply	other threads:[~2011-11-30 17:23 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-30 17:20 [RFC PATCH] Exporting ACPI Pxx/Cxx states to other kernel subsystems (v1) Konrad Rzeszutek Wilk
2011-11-30 17:20 ` [PATCH 1/8] ACPI: processor: export necessary interfaces Konrad Rzeszutek Wilk
2011-12-16 21:33   ` Konrad Rzeszutek Wilk
2011-12-19  5:43     ` Tian, Kevin
2011-12-19 14:17       ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-11-30 17:20 ` [PATCH 2/8] ACPI: processor: cache acpi_power_register in cx structure Konrad Rzeszutek Wilk
2011-11-30 17:20 ` Konrad Rzeszutek Wilk [this message]
2011-12-16 22:03   ` [PATCH 3/8] ACPI: processor: add __acpi_processor_[un]register_driver helpers Konrad Rzeszutek Wilk
2011-12-19  5:48     ` Tian, Kevin
2011-12-19 14:26       ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-12-20  2:29         ` Tian, Kevin
2011-12-20 15:31           ` Konrad Rzeszutek Wilk
2011-12-21  0:35             ` Tian, Kevin
2011-12-23  3:01               ` Konrad Rzeszutek Wilk
2011-12-26  1:31                 ` Tian, Kevin
2012-01-03 20:59                   ` Konrad Rzeszutek Wilk
2012-01-06  1:07                     ` Tian, Kevin
2012-01-13 22:24                       ` Konrad Rzeszutek Wilk
2012-01-17  3:03                         ` Tian, Kevin
2012-01-17 17:13                           ` Konrad Rzeszutek Wilk
2012-01-17 18:19                             ` Konrad Rzeszutek Wilk
2012-01-23 16:53                               ` Konrad Rzeszutek Wilk
2011-11-30 17:21 ` [PATCH 4/8] ACPI: processor: Don't setup cpu idle driver and handler when we do not want them Konrad Rzeszutek Wilk
2011-12-16 21:36   ` Konrad Rzeszutek Wilk
2011-11-30 17:21 ` [PATCH 5/8] ACPI: add processor driver for Xen virtual CPUs Konrad Rzeszutek Wilk
2011-12-01  9:24   ` [Xen-devel] " Jan Beulich
2011-12-12 17:29     ` Konrad Rzeszutek Wilk
2011-12-13  7:45       ` Jan Beulich
2011-12-13  9:26         ` liang tang
2011-12-16 22:21           ` Konrad Rzeszutek Wilk
2012-02-10 17:18   ` Konrad Rzeszutek Wilk
2011-11-30 17:21 ` [PATCH 6/8] ACPI: processor: override the interface of register acpi processor handler for Xen vcpu Konrad Rzeszutek Wilk
2011-11-30 17:21 ` [PATCH 7/8] ACPI: xen processor: add PM notification interfaces Konrad Rzeszutek Wilk
2011-11-30 17:21 ` [PATCH 8/8] ACPI: xen processor: set ignore_ppc to handle PPC event for Xen vcpu Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322673664-14642-4-git-send-email-konrad.wilk@oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=jeremy@goop.org \
    --cc=ke.yu@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=konrad@kernel.org \
    --cc=lenb@kernel.org \
    --cc=liang.tang@oracle.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.mcclurg@citrix.com \
    --cc=rjw@sisk.pl \
    --cc=stefan.bader@canonical.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).