Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy...
[pandora-kernel.git] / arch / ia64 / kernel / topology.c
index 5629b45..a2484fc 100644 (file)
@@ -31,11 +31,11 @@ int arch_register_cpu(int num)
 {
 #if defined (CONFIG_ACPI) && defined (CONFIG_HOTPLUG_CPU)
        /*
-        * If CPEI cannot be re-targetted, and this is
-        * CPEI target, then dont create the control file
+        * If CPEI can be re-targetted or if this is not
+        * CPEI target, then it is hotpluggable
         */
-       if (!can_cpei_retarget() && is_cpu_cpei_target(num))
-               sysfs_cpus[num].cpu.no_control = 1;
+       if (can_cpei_retarget() || !is_cpu_cpei_target(num))
+               sysfs_cpus[num].cpu.hotpluggable = 1;
        map_cpu_to_node(num, node_cpuid[num].nid);
 #endif
 
@@ -118,11 +118,11 @@ struct cpu_cache_info {
        struct kobject kobj;
 };
 
-static struct cpu_cache_info   all_cpu_cache_info[NR_CPUS];
+static struct cpu_cache_info   all_cpu_cache_info[NR_CPUS] __cpuinitdata;
 #define LEAF_KOBJECT_PTR(x,y)    (&all_cpu_cache_info[x].cache_leaves[y])
 
 #ifdef CONFIG_SMP
-static void cache_shared_cpu_map_setup( unsigned int cpu,
+static void __cpuinit cache_shared_cpu_map_setup( unsigned int cpu,
                struct cache_info * this_leaf)
 {
        pal_cache_shared_info_t csi;
@@ -157,7 +157,7 @@ static void cache_shared_cpu_map_setup( unsigned int cpu,
                                &csi) == PAL_STATUS_SUCCESS);
 }
 #else
-static void cache_shared_cpu_map_setup(unsigned int cpu,
+static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu,
                struct cache_info * this_leaf)
 {
        cpu_set(cpu, this_leaf->shared_cpu_map);
@@ -354,27 +354,27 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
        if (unlikely(retval < 0))
                return retval;
 
-       all_cpu_cache_info[cpu].kobj.parent = &sys_dev->kobj;
-       kobject_set_name(&all_cpu_cache_info[cpu].kobj, "%s", "cache");
-       all_cpu_cache_info[cpu].kobj.ktype = &cache_ktype_percpu_entry;
-       retval = kobject_register(&all_cpu_cache_info[cpu].kobj);
+       retval = kobject_init_and_add(&all_cpu_cache_info[cpu].kobj,
+                                     &cache_ktype_percpu_entry, &sys_dev->kobj,
+                                     "%s", "cache");
 
        for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++) {
                this_object = LEAF_KOBJECT_PTR(cpu,i);
-               this_object->kobj.parent = &all_cpu_cache_info[cpu].kobj;
-               kobject_set_name(&(this_object->kobj), "index%1lu", i);
-               this_object->kobj.ktype = &cache_ktype;
-               retval = kobject_register(&(this_object->kobj));
+               retval = kobject_init_and_add(&(this_object->kobj),
+                                             &cache_ktype,
+                                             &all_cpu_cache_info[cpu].kobj,
+                                             "index%1lu", i);
                if (unlikely(retval)) {
                        for (j = 0; j < i; j++) {
-                               kobject_unregister(
-                                       &(LEAF_KOBJECT_PTR(cpu,j)->kobj));
+                               kobject_put(&(LEAF_KOBJECT_PTR(cpu,j)->kobj));
                        }
-                       kobject_unregister(&all_cpu_cache_info[cpu].kobj);
+                       kobject_put(&all_cpu_cache_info[cpu].kobj);
                        cpu_cache_sysfs_exit(cpu);
                        break;
                }
+               kobject_uevent(&(this_object->kobj), KOBJ_ADD);
        }
+       kobject_uevent(&all_cpu_cache_info[cpu].kobj, KOBJ_ADD);
        return retval;
 }
 
@@ -385,10 +385,10 @@ static int __cpuinit cache_remove_dev(struct sys_device * sys_dev)
        unsigned long i;
 
        for (i = 0; i < all_cpu_cache_info[cpu].num_cache_leaves; i++)
-               kobject_unregister(&(LEAF_KOBJECT_PTR(cpu,i)->kobj));
+               kobject_put(&(LEAF_KOBJECT_PTR(cpu,i)->kobj));
 
        if (all_cpu_cache_info[cpu].kobj.parent) {
-               kobject_unregister(&all_cpu_cache_info[cpu].kobj);
+               kobject_put(&all_cpu_cache_info[cpu].kobj);
                memset(&all_cpu_cache_info[cpu].kobj,
                        0,
                        sizeof(struct kobject));
@@ -412,9 +412,11 @@ static int __cpuinit cache_cpu_callback(struct notifier_block *nfb,
        sys_dev = get_cpu_sysdev(cpu);
        switch (action) {
        case CPU_ONLINE:
+       case CPU_ONLINE_FROZEN:
                cache_add_dev(sys_dev);
                break;
        case CPU_DEAD:
+       case CPU_DEAD_FROZEN:
                cache_remove_dev(sys_dev);
                break;
        }
@@ -426,13 +428,13 @@ static struct notifier_block __cpuinitdata cache_cpu_notifier =
        .notifier_call = cache_cpu_callback
 };
 
-static int __cpuinit cache_sysfs_init(void)
+static int __init cache_sysfs_init(void)
 {
        int i;
 
        for_each_online_cpu(i) {
-               cache_cpu_callback(&cache_cpu_notifier, CPU_ONLINE,
-                               (void *)(long)i);
+               struct sys_device *sys_dev = get_cpu_sysdev((unsigned int)i);
+               cache_add_dev(sys_dev);
        }
 
        register_hotcpu_notifier(&cache_cpu_notifier);