Merge branch 'upstream-fixes' into upstream
[powerpc.git] / drivers / scsi / scsi.c
index c551bb8..dae4f08 100644 (file)
@@ -48,7 +48,6 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/completion.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/unistd.h>
 #include <linux/spinlock.h>
 #include <linux/kmod.h>
@@ -136,9 +135,8 @@ struct scsi_request *scsi_allocate_request(struct scsi_device *sdev,
        const int size = offset + sizeof(struct request);
        struct scsi_request *sreq;
   
-       sreq = kmalloc(size, gfp_mask);
+       sreq = kzalloc(size, gfp_mask);
        if (likely(sreq != NULL)) {
-               memset(sreq, 0, size);
                sreq->sr_request = (struct request *)(((char *)sreq) + offset);
                sreq->sr_device = sdev;
                sreq->sr_host = sdev->host;
@@ -567,7 +565,8 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
        /* 
         * If SCSI-2 or lower, store the LUN value in cmnd.
         */
-       if (cmd->device->scsi_level <= SCSI_2) {
+       if (cmd->device->scsi_level <= SCSI_2 &&
+           cmd->device->scsi_level != SCSI_UNKNOWN) {
                cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) |
                               (cmd->device->lun << 5 & 0xe0);
        }
@@ -720,6 +719,24 @@ void scsi_init_cmd_from_req(struct scsi_cmnd *cmd, struct scsi_request *sreq)
  */
 static DEFINE_PER_CPU(struct list_head, scsi_done_q);
 
+/**
+ * scsi_req_abort_cmd -- Request command recovery for the specified command
+ * cmd: pointer to the SCSI command of interest
+ *
+ * This function requests that SCSI Core start recovery for the
+ * command by deleting the timer and adding the command to the eh
+ * queue.  It can be called by either LLDDs or SCSI Core.  LLDDs who
+ * implement their own error recovery MAY ignore the timeout event if
+ * they generated scsi_req_abort_cmd.
+ */
+void scsi_req_abort_cmd(struct scsi_cmnd *cmd)
+{
+       if (!scsi_delete_timer(cmd))
+               return;
+       scsi_times_out(cmd);
+}
+EXPORT_SYMBOL(scsi_req_abort_cmd);
+
 /**
  * scsi_done - Enqueue the finished SCSI command into the done queue.
  * @cmd: The SCSI Command for which a low-level device driver (LLDD) gives
@@ -1245,10 +1262,9 @@ static int __init init_scsi(void)
        if (error)
                goto cleanup_sysctl;
 
-       for_each_cpu(i)
+       for_each_possible_cpu(i)
                INIT_LIST_HEAD(&per_cpu(scsi_done_q, i));
 
-       devfs_mk_dir("scsi");
        printk(KERN_NOTICE "SCSI subsystem initialized\n");
        return 0;
 
@@ -1273,7 +1289,6 @@ static void __exit exit_scsi(void)
        scsi_exit_sysctl();
        scsi_exit_hosts();
        scsi_exit_devinfo();
-       devfs_remove("scsi");
        scsi_exit_procfs();
        scsi_exit_queue();
 }