]> err.no Git - linux-2.6/blobdiff - drivers/s390/cio/device.c
Merge branch 'for-2.6.26' of master.kernel.org:/pub/scm/linux/kernel/git/jwboyer...
[linux-2.6] / drivers / s390 / cio / device.c
index d35dc3f25d06ec3a392a35da8617ca85d4da70f7..abfd601d237a1a07c9aa852e671a8bde507f6cc4 100644 (file)
@@ -32,7 +32,7 @@
 #include "io_sch.h"
 
 static struct timer_list recovery_timer;
-static spinlock_t recovery_lock;
+static DEFINE_SPINLOCK(recovery_lock);
 static int recovery_phase;
 static const unsigned long recovery_delay[] = { 3, 30, 300 };
 
@@ -512,8 +512,8 @@ static ssize_t online_store (struct device *dev, struct device_attribute *attr,
                             const char *buf, size_t count)
 {
        struct ccw_device *cdev = to_ccwdev(dev);
-       int i, force;
-       char *tmp;
+       int force, ret;
+       unsigned long i;
 
        if (atomic_cmpxchg(&cdev->private->onoff, 0, 1) != 0)
                return -EAGAIN;
@@ -525,25 +525,30 @@ static ssize_t online_store (struct device *dev, struct device_attribute *attr,
        if (!strncmp(buf, "force\n", count)) {
                force = 1;
                i = 1;
+               ret = 0;
        } else {
                force = 0;
-               i = simple_strtoul(buf, &tmp, 16);
+               ret = strict_strtoul(buf, 16, &i);
        }
-
+       if (ret)
+               goto out;
        switch (i) {
        case 0:
                online_store_handle_offline(cdev);
+               ret = count;
                break;
        case 1:
                online_store_handle_online(cdev, force);
+               ret = count;
                break;
        default:
-               count = -EINVAL;
+               ret = -EINVAL;
        }
+out:
        if (cdev->drv)
                module_put(cdev->drv->owner);
        atomic_set(&cdev->private->onoff, 0);
-       return count;
+       return ret;
 }
 
 static ssize_t
@@ -577,7 +582,6 @@ static DEVICE_ATTR(devtype, 0444, devtype_show, NULL);
 static DEVICE_ATTR(cutype, 0444, cutype_show, NULL);
 static DEVICE_ATTR(modalias, 0444, modalias_show, NULL);
 static DEVICE_ATTR(online, 0644, online_show, online_store);
-extern struct device_attribute dev_attr_cmb_enable;
 static DEVICE_ATTR(availability, 0444, available_show, NULL);
 
 static struct attribute * subch_attrs[] = {
@@ -1535,7 +1539,7 @@ static int recovery_check(struct device *dev, void *data)
        return 0;
 }
 
-static void recovery_func(unsigned long data)
+static void recovery_work_func(struct work_struct *unused)
 {
        int redo = 0;
 
@@ -1553,6 +1557,17 @@ static void recovery_func(unsigned long data)
                CIO_MSG_EVENT(2, "recovery: end\n");
 }
 
+static DECLARE_WORK(recovery_work, recovery_work_func);
+
+static void recovery_func(unsigned long data)
+{
+       /*
+        * We can't do our recovery in softirq context and it's not
+        * performance critical, so we schedule it.
+        */
+       schedule_work(&recovery_work);
+}
+
 void ccw_device_schedule_recovery(void)
 {
        unsigned long flags;