aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2008-03-08 23:44:32 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-07 13:15:45 -0400
commit1a7a2e1a77f29179f997ca5e873c50ae2fb7fcc1 (patch)
tree4634a9db2efce68730df8f89e9a4f4d2ac3cfcc9 /arch
parent944cf8b4cba42fcb284a29e4817831471adb4fad (diff)
[SCSI] simscsi: use sg buffer copy helper funcitons
This replaces simscsi_fillresult with scsi_sg_copy_from_buffer. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Tony Luck <tony.luck@intel.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/ia64/hp/sim/simscsi.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/arch/ia64/hp/sim/simscsi.c b/arch/ia64/hp/sim/simscsi.c
index 7661bb065fa5..3a078ad3aa44 100644
--- a/arch/ia64/hp/sim/simscsi.c
+++ b/arch/ia64/hp/sim/simscsi.c
@@ -201,22 +201,6 @@ simscsi_readwrite10 (struct scsi_cmnd *sc, int mode)
201 simscsi_sg_readwrite(sc, mode, offset); 201 simscsi_sg_readwrite(sc, mode, offset);
202} 202}
203 203
204static void simscsi_fillresult(struct scsi_cmnd *sc, char *buf, unsigned len)
205{
206
207 int i;
208 unsigned thislen;
209 struct scatterlist *slp;
210
211 scsi_for_each_sg(sc, slp, scsi_sg_count(sc), i) {
212 if (!len)
213 break;
214 thislen = min(len, slp->length);
215 memcpy(sg_virt(slp), buf, thislen);
216 len -= thislen;
217 }
218}
219
220static int 204static int
221simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) 205simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
222{ 206{
@@ -258,7 +242,7 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
258 buf[6] = 0; /* reserved */ 242 buf[6] = 0; /* reserved */
259 buf[7] = 0; /* various flags */ 243 buf[7] = 0; /* various flags */
260 memcpy(buf + 8, "HP SIMULATED DISK 0.00", 28); 244 memcpy(buf + 8, "HP SIMULATED DISK 0.00", 28);
261 simscsi_fillresult(sc, buf, 36); 245 scsi_sg_copy_from_buffer(sc, buf, 36);
262 sc->result = GOOD; 246 sc->result = GOOD;
263 break; 247 break;
264 248
@@ -306,14 +290,15 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
306 buf[5] = 0; 290 buf[5] = 0;
307 buf[6] = 2; 291 buf[6] = 2;
308 buf[7] = 0; 292 buf[7] = 0;
309 simscsi_fillresult(sc, buf, 8); 293 scsi_sg_copy_from_buffer(sc, buf, 8);
310 sc->result = GOOD; 294 sc->result = GOOD;
311 break; 295 break;
312 296
313 case MODE_SENSE: 297 case MODE_SENSE:
314 case MODE_SENSE_10: 298 case MODE_SENSE_10:
315 /* sd.c uses this to determine whether disk does write-caching. */ 299 /* sd.c uses this to determine whether disk does write-caching. */
316 simscsi_fillresult(sc, (char *)empty_zero_page, scsi_bufflen(sc)); 300 scsi_sg_copy_from_buffer(sc, (char *)empty_zero_page,
301 PAGE_SIZE);
317 sc->result = GOOD; 302 sc->result = GOOD;
318 break; 303 break;
319 304