Merge branch 'upstream'
[pandora-kernel.git] / drivers / scsi / st.c
index da97662..dd592f6 100644 (file)
@@ -3887,9 +3887,7 @@ static int st_probe(struct device *dev)
        if (SDp->type != TYPE_TAPE)
                return -ENODEV;
        if ((stp = st_incompatible(SDp))) {
-               printk(KERN_INFO
-                      "st: Found incompatible tape at scsi%d, channel %d, id %d, lun %d\n",
-                      SDp->host->host_no, SDp->channel, SDp->id, SDp->lun);
+               sdev_printk(KERN_INFO, SDp, "Found incompatible tape\n");
                printk(KERN_INFO "st: The suggested driver is %s.\n", stp);
                return -ENODEV;
        }
@@ -4077,9 +4075,8 @@ static int st_probe(struct device *dev)
        }
        disk->number = devfs_register_tape(SDp->devfs_name);
 
-       printk(KERN_WARNING
-       "Attached scsi tape %s at scsi%d, channel %d, id %d, lun %d\n",
-              tape_name(tpnt), SDp->host->host_no, SDp->channel, SDp->id, SDp->lun);
+       sdev_printk(KERN_WARNING, SDp,
+                   "Attached scsi tape %s", tape_name(tpnt));
        printk(KERN_WARNING "%s: try direct i/o: %s (alignment %d B), max page reachable by HBA %lu\n",
               tape_name(tpnt), tpnt->try_dio ? "yes" : "no",
               queue_dma_alignment(SDp->request_queue) + 1, tpnt->max_pfn);
@@ -4110,8 +4107,7 @@ out_free_tape:
        write_unlock(&st_dev_arr_lock);
 out_put_disk:
        put_disk(disk);
-       if (tpnt)
-               kfree(tpnt);
+       kfree(tpnt);
 out_buffer_free:
        kfree(buffer);
 out:
@@ -4198,27 +4194,10 @@ static void st_intr(struct scsi_cmnd *SCpnt)
  */
 static int st_init_command(struct scsi_cmnd *SCpnt)
 {
-       struct request *rq;
-
        if (!(SCpnt->request->flags & REQ_BLOCK_PC))
                return 0;
 
-       rq = SCpnt->request;
-       if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd))
-               return 0;
-
-       memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
-       SCpnt->cmd_len = rq->cmd_len;
-
-       if (rq_data_dir(rq) == WRITE)
-               SCpnt->sc_data_direction = DMA_TO_DEVICE;
-       else if (rq->data_len)
-               SCpnt->sc_data_direction = DMA_FROM_DEVICE;
-       else
-               SCpnt->sc_data_direction = DMA_NONE;
-
-       SCpnt->timeout_per_command = rq->timeout;
-       SCpnt->transfersize = rq->data_len;
+       scsi_setup_blk_pc_cmnd(SCpnt, 0);
        SCpnt->done = st_intr;
        return 1;
 }
@@ -4513,6 +4492,7 @@ static int sgl_map_user_pages(struct scatterlist *sgl, const unsigned int max_pa
        if (res > 0) {
                for (j=0; j < res; j++)
                        page_cache_release(pages[j]);
+               res = 0;
        }
        kfree(pages);
        return res;
@@ -4528,8 +4508,6 @@ static int sgl_unmap_user_pages(struct scatterlist *sgl, const unsigned int nr_p
        for (i=0; i < nr_pages; i++) {
                struct page *page = sgl[i].page;
 
-               /* XXX: just for debug. Remove when PageReserved is removed */
-               BUG_ON(PageReserved(page));
                if (dirtied)
                        SetPageDirty(page);
                /* FIXME: cache flush missing for rw==READ