]> Pileus Git - ~andy/linux/blobdiff - drivers/base/sys.c
Merge branch 'for-linus' of git://neil.brown.name/md
[~andy/linux] / drivers / base / sys.c
index 40fc14f035402ec70de718977e309932dce7b576..c98c31ec2f752189e2481a278ed8e7f02cf01985 100644 (file)
@@ -168,19 +168,16 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv)
        int err = 0;
 
        if (!cls) {
-               printk(KERN_WARNING "sysdev: invalid class passed to "
+               WARN(1, KERN_WARNING "sysdev: invalid class passed to "
                        "sysdev_driver_register!\n");
-               WARN_ON(1);
                return -EINVAL;
        }
 
        /* Check whether this driver has already been added to a class. */
-       if (drv->entry.next && !list_empty(&drv->entry)) {
-               printk(KERN_WARNING "sysdev: class %s: driver (%p) has already"
+       if (drv->entry.next && !list_empty(&drv->entry))
+               WARN(1, KERN_WARNING "sysdev: class %s: driver (%p) has already"
                        " been registered to a class, something is wrong, but "
                        "will forge on!\n", cls->name, drv);
-               WARN_ON(1);
-       }
 
        mutex_lock(&sysdev_drivers_lock);
        if (cls && kset_get(&cls->kset)) {
@@ -194,8 +191,7 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv)
                }
        } else {
                err = -EINVAL;
-               printk(KERN_ERR "%s: invalid device class\n", __func__);
-               WARN_ON(1);
+               WARN(1, KERN_ERR "%s: invalid device class\n", __func__);
        }
        mutex_unlock(&sysdev_drivers_lock);
        return err;
@@ -359,7 +355,7 @@ static void __sysdev_resume(struct sys_device *dev)
  *     sysdev_suspend - Suspend all system devices.
  *     @state:         Power state to enter.
  *
- *     We perform an almost identical operation as sys_device_shutdown()
+ *     We perform an almost identical operation as sysdev_shutdown()
  *     above, though calling ->suspend() instead. Interrupts are disabled
  *     when this called. Devices are responsible for both saving state and
  *     quiescing or powering down the device.
@@ -441,7 +437,7 @@ aux_driver:
 /**
  *     sysdev_resume - Bring system devices back to life.
  *
- *     Similar to sys_device_suspend(), but we iterate the list forwards
+ *     Similar to sysdev_suspend(), but we iterate the list forwards
  *     to guarantee that parent devices are resumed before their children.
  *
  *     Note: Interrupts are disabled when called.
@@ -492,7 +488,8 @@ ssize_t sysdev_store_ulong(struct sys_device *sysdev,
        if (end == buf)
                return -EINVAL;
        *(unsigned long *)(ea->var) = new;
-       return end - buf;
+       /* Always return full write size even if we didn't consume all */
+       return size;
 }
 EXPORT_SYMBOL_GPL(sysdev_store_ulong);
 
@@ -515,7 +512,8 @@ ssize_t sysdev_store_int(struct sys_device *sysdev,
        if (end == buf || new > INT_MAX || new < INT_MIN)
                return -EINVAL;
        *(int *)(ea->var) = new;
-       return end - buf;
+       /* Always return full write size even if we didn't consume all */
+       return size;
 }
 EXPORT_SYMBOL_GPL(sysdev_store_int);