Merge branch 'master' into for_paulus
[linux-drm-fsl-dcu.git] / drivers / block / aoe / aoechr.c
index 5327f553b4f59e13db2098b264e1628513c5c023..39e563ea08782cf242972b42d3b8c4795e5a83a4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
+/* Copyright (c) 2006 Coraid, Inc.  See COPYING for GPL terms. */
 /*
  * aoechr.c
  * AoE character device driver
@@ -15,7 +15,6 @@ enum {
        MINOR_INTERFACES,
        MINOR_REVALIDATE,
        MSGSZ = 2048,
-       NARGS = 10,
        NMSG = 100,             /* message backlog to retain */
 };
 
@@ -56,9 +55,8 @@ static int
 interfaces(const char __user *str, size_t size)
 {
        if (set_aoe_iflist(str, size)) {
-               printk(KERN_CRIT
-                      "%s: could not set interface list: %s\n",
-                      __FUNCTION__, "too many interfaces");
+               printk(KERN_ERR
+                       "aoe: could not set interface list: too many interfaces\n");
                return -EINVAL;
        }
        return 0;
@@ -81,8 +79,7 @@ revalidate(const char __user *str, size_t size)
        /* should be e%d.%d format */
        n = sscanf(buf, "e%d.%d", &major, &minor);
        if (n != 2) {
-               printk(KERN_ERR "aoe: %s: invalid device specification\n",
-                       __FUNCTION__);
+               printk(KERN_ERR "aoe: invalid device specification\n");
                return -EINVAL;
        }
        d = aoedev_by_aoeaddr(major, minor);
@@ -90,6 +87,7 @@ revalidate(const char __user *str, size_t size)
                return -EINVAL;
 
        spin_lock_irqsave(&d->lock, flags);
+       d->flags &= ~DEVFL_MAXBCNT;
        d->flags |= DEVFL_PAUSE;
        spin_unlock_irqrestore(&d->lock, flags);
        aoecmd_cfg(major, minor);
@@ -116,7 +114,7 @@ bail:               spin_unlock_irqrestore(&emsgs_lock, flags);
 
        mp = kmalloc(n, GFP_ATOMIC);
        if (mp == NULL) {
-               printk(KERN_CRIT "aoe: aoechr_error: allocation failure, len=%ld\n", n);
+               printk(KERN_ERR "aoe: allocation failure, len=%ld\n", n);
                goto bail;
        }
 
@@ -141,7 +139,7 @@ aoechr_write(struct file *filp, const char __user *buf, size_t cnt, loff_t *offp
 
        switch ((unsigned long) filp->private_data) {
        default:
-               printk(KERN_INFO "aoe: aoechr_write: can't write to that file.\n");
+               printk(KERN_INFO "aoe: can't write to that file.\n");
                break;
        case MINOR_DISCOVER:
                ret = discover();
@@ -162,7 +160,7 @@ aoechr_open(struct inode *inode, struct file *filp)
 {
        int n, i;
 
-       n = MINOR(inode->i_rdev);
+       n = iminor(inode);
        filp->private_data = (void *) (unsigned long) n;
 
        for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
@@ -235,7 +233,7 @@ loop:
        }
 }
 
-static struct file_operations aoe_fops = {
+static const struct file_operations aoe_fops = {
        .write = aoechr_write,
        .read = aoechr_read,
        .open = aoechr_open,
@@ -250,7 +248,7 @@ aoechr_init(void)
 
        n = register_chrdev(AOE_MAJOR, "aoechr", &aoe_fops);
        if (n < 0) { 
-               printk(KERN_ERR "aoe: aoechr_init: can't register char device\n");
+               printk(KERN_ERR "aoe: can't register char device\n");
                return n;
        }
        sema_init(&emsgs_sema, 0);