Commit 9faa559c authored by Satyam Sharma's avatar Satyam Sharma Committed by Roland Dreier

IB/ehca: Misc cpuinit section annotations and #ifdef cleanups

* Replace {un}register_cpu_notifier with {un}register_hotcpu_notifier
  thereby losing a couple of #ifdef HOTPLUG_CPU pairs.
* Move comp_pool_callback_nb declaration to below that of callback
  function so that initialization of .notifier_call and .priority can
  occur at build time itself and not runtime.
* Mark the notifier_block (and callback function, and another static
  function used by it) as __cpuinit{data} for the sake of consistency
  and remove enclosing #ifdef. (This may increase size for modular
  build of this module, however, because these are no longer dropped
  unconditionally now.)
Signed-off-by: default avatarSatyam Sharma <satyam@infradead.org>
Acked-by: default avatarJoachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent ea98054f
...@@ -69,9 +69,6 @@ ...@@ -69,9 +69,6 @@
static void queue_comp_task(struct ehca_cq *__cq); static void queue_comp_task(struct ehca_cq *__cq);
static struct ehca_comp_pool *pool; static struct ehca_comp_pool *pool;
#ifdef CONFIG_HOTPLUG_CPU
static struct notifier_block comp_pool_callback_nb;
#endif
static inline void comp_event_callback(struct ehca_cq *cq) static inline void comp_event_callback(struct ehca_cq *cq)
{ {
...@@ -760,9 +757,7 @@ static void destroy_comp_task(struct ehca_comp_pool *pool, ...@@ -760,9 +757,7 @@ static void destroy_comp_task(struct ehca_comp_pool *pool,
kthread_stop(task); kthread_stop(task);
} }
#ifdef CONFIG_HOTPLUG_CPU static void __cpuinit take_over_work(struct ehca_comp_pool *pool, int cpu)
static void take_over_work(struct ehca_comp_pool *pool,
int cpu)
{ {
struct ehca_cpu_comp_task *cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu); struct ehca_cpu_comp_task *cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu);
LIST_HEAD(list); LIST_HEAD(list);
...@@ -785,9 +780,9 @@ static void take_over_work(struct ehca_comp_pool *pool, ...@@ -785,9 +780,9 @@ static void take_over_work(struct ehca_comp_pool *pool,
} }
static int comp_pool_callback(struct notifier_block *nfb, static int __cpuinit comp_pool_callback(struct notifier_block *nfb,
unsigned long action, unsigned long action,
void *hcpu) void *hcpu)
{ {
unsigned int cpu = (unsigned long)hcpu; unsigned int cpu = (unsigned long)hcpu;
struct ehca_cpu_comp_task *cct; struct ehca_cpu_comp_task *cct;
...@@ -833,7 +828,11 @@ static int comp_pool_callback(struct notifier_block *nfb, ...@@ -833,7 +828,11 @@ static int comp_pool_callback(struct notifier_block *nfb,
return NOTIFY_OK; return NOTIFY_OK;
} }
#endif
static struct notifier_block comp_pool_callback_nb __cpuinitdata = {
.notifier_call = comp_pool_callback,
.priority = 0,
};
int ehca_create_comp_pool(void) int ehca_create_comp_pool(void)
{ {
...@@ -864,11 +863,7 @@ int ehca_create_comp_pool(void) ...@@ -864,11 +863,7 @@ int ehca_create_comp_pool(void)
} }
} }
#ifdef CONFIG_HOTPLUG_CPU register_hotcpu_notifier(&comp_pool_callback_nb);
comp_pool_callback_nb.notifier_call = comp_pool_callback;
comp_pool_callback_nb.priority = 0;
register_cpu_notifier(&comp_pool_callback_nb);
#endif
printk(KERN_INFO "eHCA scaling code enabled\n"); printk(KERN_INFO "eHCA scaling code enabled\n");
...@@ -882,9 +877,7 @@ void ehca_destroy_comp_pool(void) ...@@ -882,9 +877,7 @@ void ehca_destroy_comp_pool(void)
if (!ehca_scaling_code) if (!ehca_scaling_code)
return; return;
#ifdef CONFIG_HOTPLUG_CPU unregister_hotcpu_notifier(&comp_pool_callback_nb);
unregister_cpu_notifier(&comp_pool_callback_nb);
#endif
for (i = 0; i < NR_CPUS; i++) { for (i = 0; i < NR_CPUS; i++) {
if (cpu_online(i)) if (cpu_online(i))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment