]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - arch/ia64/hp/sim/simscsi.c
Merge branch 'master' into csb1725
[mv-sheeva.git] / arch / ia64 / hp / sim / simscsi.c
index 7661bb065fa570a4a61036acf551d5feacda94ef..331de723c6767f264e8ee682fcb73aa44d4a7bf7 100644 (file)
@@ -201,24 +201,8 @@ simscsi_readwrite10 (struct scsi_cmnd *sc, int mode)
        simscsi_sg_readwrite(sc, mode, offset);
 }
 
-static void simscsi_fillresult(struct scsi_cmnd *sc, char *buf, unsigned len)
-{
-
-       int i;
-       unsigned thislen;
-       struct scatterlist *slp;
-
-       scsi_for_each_sg(sc, slp, scsi_sg_count(sc), i) {
-               if (!len)
-                       break;
-               thislen = min(len, slp->length);
-               memcpy(sg_virt(slp), buf, thislen);
-               len -= thislen;
-       }
-}
-
 static int
-simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
+simscsi_queuecommand_lck (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
 {
        unsigned int target_id = sc->device->id;
        char fname[MAX_ROOT_LEN+16];
@@ -258,7 +242,7 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
                        buf[6] = 0;     /* reserved */
                        buf[7] = 0;     /* various flags */
                        memcpy(buf + 8, "HP      SIMULATED DISK  0.00",  28);
-                       simscsi_fillresult(sc, buf, 36);
+                       scsi_sg_copy_from_buffer(sc, buf, 36);
                        sc->result = GOOD;
                        break;
 
@@ -306,14 +290,15 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
                        buf[5] = 0;
                        buf[6] = 2;
                        buf[7] = 0;
-                       simscsi_fillresult(sc, buf, 8);
+                       scsi_sg_copy_from_buffer(sc, buf, 8);
                        sc->result = GOOD;
                        break;
 
                      case MODE_SENSE:
                      case MODE_SENSE_10:
                        /* sd.c uses this to determine whether disk does write-caching. */
-                       simscsi_fillresult(sc, (char *)empty_zero_page, scsi_bufflen(sc));
+                       scsi_sg_copy_from_buffer(sc, (char *)empty_zero_page,
+                                                PAGE_SIZE);
                        sc->result = GOOD;
                        break;
 
@@ -341,6 +326,8 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
        return 0;
 }
 
+static DEF_SCSI_QCMD(simscsi_queuecommand)
+
 static int
 simscsi_host_reset (struct scsi_cmnd *sc)
 {