Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
[pandora-kernel.git] / drivers / scsi / scsi_proc.c
index 1b5711e..55200e4 100644 (file)
@@ -31,6 +31,7 @@
 #include <scsi/scsi.h>
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_host.h>
+#include <scsi/scsi_transport.h>
 
 #include "scsi_priv.h"
 #include "scsi_logging.h"
@@ -200,7 +201,10 @@ static int scsi_add_single_device(uint host, uint channel, uint id, uint lun)
        if (IS_ERR(shost))
                return PTR_ERR(shost);
 
-       error = scsi_scan_host_selected(shost, channel, id, lun, 1);
+       if (shost->transportt->user_scan)
+               error = shost->transportt->user_scan(shost, channel, id, lun);
+       else
+               error = scsi_scan_host_selected(shost, channel, id, lun, 1);
        scsi_host_put(shost);
        return error;
 }
@@ -262,8 +266,6 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf,
                lun = simple_strtoul(p + 1, &p, 0);
 
                err = scsi_add_single_device(host, channel, id, lun);
-               if (err >= 0)
-                       err = length;
 
        /*
         * Usage: echo "scsi remove-single-device 0 1 2 3" >/proc/scsi/scsi
@@ -280,6 +282,13 @@ static ssize_t proc_scsi_write(struct file *file, const char __user *buf,
                err = scsi_remove_single_device(host, channel, id, lun);
        }
 
+       /*
+        * convert success returns so that we return the 
+        * number of bytes consumed.
+        */
+       if (!err)
+               err = length;
+
  out:
        free_page((unsigned long)buffer);
        return err;