]> err.no Git - linux-2.6/blobdiff - arch/s390/kernel/smp.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
[linux-2.6] / arch / s390 / kernel / smp.c
index 0dfa988c1b26d74abae8411d92afb0f709d8fc2a..0aeb290060d9cb379532568880dc4d408b0ac01c 100644 (file)
@@ -505,7 +505,7 @@ out:
        return rc;
 }
 
-static int smp_rescan_cpus(void)
+static int __smp_rescan_cpus(void)
 {
        cpumask_t avail;
 
@@ -570,7 +570,7 @@ out:
        kfree(info);
        printk(KERN_INFO "CPUs: %d configured, %d standby\n", c_cpus, s_cpus);
        get_online_cpus();
-       smp_rescan_cpus();
+       __smp_rescan_cpus();
        put_online_cpus();
 }
 
@@ -890,8 +890,8 @@ static ssize_t cpu_configure_store(struct sys_device *dev, const char *buf,
        if (val != 0 && val != 1)
                return -EINVAL;
 
-       mutex_lock(&smp_cpu_state_mutex);
        get_online_cpus();
+       mutex_lock(&smp_cpu_state_mutex);
        rc = -EBUSY;
        if (cpu_online(cpu))
                goto out;
@@ -919,8 +919,8 @@ static ssize_t cpu_configure_store(struct sys_device *dev, const char *buf,
                break;
        }
 out:
-       put_online_cpus();
        mutex_unlock(&smp_cpu_state_mutex);
+       put_online_cpus();
        return rc ? rc : count;
 }
 static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store);
@@ -1088,17 +1088,17 @@ out:
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
-static ssize_t __ref rescan_store(struct sys_device *dev,
-                                 const char *buf, size_t count)
+
+int smp_rescan_cpus(void)
 {
        cpumask_t newcpus;
        int cpu;
        int rc;
 
-       mutex_lock(&smp_cpu_state_mutex);
        get_online_cpus();
+       mutex_lock(&smp_cpu_state_mutex);
        newcpus = cpu_present_map;
-       rc = smp_rescan_cpus();
+       rc = __smp_rescan_cpus();
        if (rc)
                goto out;
        cpus_andnot(newcpus, cpu_present_map, newcpus);
@@ -1109,10 +1109,19 @@ static ssize_t __ref rescan_store(struct sys_device *dev,
        }
        rc = 0;
 out:
-       put_online_cpus();
        mutex_unlock(&smp_cpu_state_mutex);
+       put_online_cpus();
        if (!cpus_empty(newcpus))
                topology_schedule_update();
+       return rc;
+}
+
+static ssize_t __ref rescan_store(struct sys_device *dev, const char *buf,
+                                 size_t count)
+{
+       int rc;
+
+       rc = smp_rescan_cpus();
        return rc ? rc : count;
 }
 static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store);
@@ -1139,16 +1148,16 @@ static ssize_t dispatching_store(struct sys_device *dev, const char *buf,
        if (val != 0 && val != 1)
                return -EINVAL;
        rc = 0;
-       mutex_lock(&smp_cpu_state_mutex);
        get_online_cpus();
+       mutex_lock(&smp_cpu_state_mutex);
        if (cpu_management == val)
                goto out;
        rc = topology_set_cpu_management(val);
        if (!rc)
                cpu_management = val;
 out:
-       put_online_cpus();
        mutex_unlock(&smp_cpu_state_mutex);
+       put_online_cpus();
        return rc ? rc : count;
 }
 static SYSDEV_ATTR(dispatching, 0644, dispatching_show, dispatching_store);