All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Wang <wei.w.wang@intel.com>
To: xen-devel@lists.xen.org, jbeulich@suse.com
Cc: andrew.cooper3@citrix.com, Wei Wang <wei.w.wang@intel.com>
Subject: [PATCH v3 04/11] x86/intel_pstate: relocate the driver register function
Date: Thu, 11 Jun 2015 16:27:10 +0800	[thread overview]
Message-ID: <1434011230-17052-1-git-send-email-wei.w.wang@intel.com> (raw)

Register the CPU hotplug notifier when the driver is
registered, and move the driver register function to
the cpufreq.c.

Signed-off-by: Wei Wang <wei.w.wang@intel.com>
---
 xen/drivers/cpufreq/cpufreq.c      | 15 ++++++++++++---
 xen/include/acpi/cpufreq/cpufreq.h | 28 ++--------------------------
 2 files changed, 14 insertions(+), 29 deletions(-)

diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
index ab66884..7d186db 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -630,12 +630,21 @@ static struct notifier_block cpu_nfb = {
     .notifier_call = cpu_callback
 };
 
-static int __init cpufreq_presmp_init(void)
+int cpufreq_register_driver(struct cpufreq_driver *driver_data)
 {
     void *cpu = (void *)(long)smp_processor_id();
     cpu_callback(&cpu_nfb, CPU_ONLINE, cpu);
+    if (!driver_data || !driver_data->init
+        || !driver_data->verify || !driver_data->exit
+        || (!driver_data->target == !driver_data->setpolicy))
+        return -EINVAL;
+
+    if (cpufreq_driver)
+        return -EBUSY;
+
+    cpufreq_driver = driver_data;
+
     register_cpu_notifier(&cpu_nfb);
+
     return 0;
 }
-presmp_initcall(cpufreq_presmp_init);
-
diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h
index 60caf59..d10e4c7 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -171,32 +171,8 @@ struct cpufreq_driver {
 
 extern struct cpufreq_driver *cpufreq_driver;
 
-static __inline__ 
-int cpufreq_register_driver(struct cpufreq_driver *driver_data)
-{
-    if (!driver_data         || 
-        !driver_data->init   || 
-        !driver_data->exit   || 
-        !driver_data->verify || 
-        !driver_data->target)
-        return -EINVAL;
-
-    if (cpufreq_driver)
-        return -EBUSY;
-
-    cpufreq_driver = driver_data;
-    return 0;
-}
-
-static __inline__ 
-int cpufreq_unregister_driver(struct cpufreq_driver *driver)
-{
-    if (!cpufreq_driver || (driver != cpufreq_driver))
-        return -EINVAL;
-
-    cpufreq_driver = NULL;
-    return 0;
-}
+extern int cpufreq_register_driver(struct cpufreq_driver *driver_data);
+extern int cpufreq_unregister_driver(struct cpufreq_driver *driver);
 
 static __inline__
 void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
-- 
1.9.1

             reply	other threads:[~2015-06-11  8:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-11  8:27 Wei Wang [this message]
2015-06-18 14:30 ` [PATCH v3 04/11] x86/intel_pstate: relocate the driver register function Jan Beulich
2015-06-23  3:40   ` Wang, Wei W
2015-06-23  7:31     ` Jan Beulich
2015-06-23  8:01       ` Wang, Wei W
2015-06-23  8:11         ` Jan Beulich
2015-06-23  8:24           ` Wang, Wei W
2015-06-23  8:37             ` Jan Beulich

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=1434011230-17052-1-git-send-email-wei.w.wang@intel.com \
    --to=wei.w.wang@intel.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=xen-devel@lists.xen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.