[SCSI] ps3rom: convert to use the data buffer accessors
This converts ps3rom driver to use the new accessors for the sg lists and the parameters. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
parent
0012fdf986
commit
358147403d
@ -100,16 +100,16 @@ static int fill_from_dev_buffer(struct scsi_cmnd *cmd, const void *buf)
|
|||||||
struct scatterlist *sgpnt;
|
struct scatterlist *sgpnt;
|
||||||
unsigned int buflen;
|
unsigned int buflen;
|
||||||
|
|
||||||
buflen = cmd->request_bufflen;
|
buflen = scsi_bufflen(cmd);
|
||||||
if (!buflen)
|
if (!buflen)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!cmd->request_buffer)
|
if (!scsi_sglist(cmd))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
sgpnt = cmd->request_buffer;
|
|
||||||
active = 1;
|
active = 1;
|
||||||
for (k = 0, req_len = 0, act_len = 0; k < cmd->use_sg; ++k, ++sgpnt) {
|
req_len = act_len = 0;
|
||||||
|
scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) {
|
||||||
if (active) {
|
if (active) {
|
||||||
kaddr = kmap_atomic(sgpnt->page, KM_IRQ0);
|
kaddr = kmap_atomic(sgpnt->page, KM_IRQ0);
|
||||||
len = sgpnt->length;
|
len = sgpnt->length;
|
||||||
@ -124,7 +124,7 @@ static int fill_from_dev_buffer(struct scsi_cmnd *cmd, const void *buf)
|
|||||||
}
|
}
|
||||||
req_len += sgpnt->length;
|
req_len += sgpnt->length;
|
||||||
}
|
}
|
||||||
cmd->resid = req_len - act_len;
|
scsi_set_resid(cmd, req_len - act_len);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,15 +138,15 @@ static int fetch_to_dev_buffer(struct scsi_cmnd *cmd, void *buf)
|
|||||||
struct scatterlist *sgpnt;
|
struct scatterlist *sgpnt;
|
||||||
unsigned int buflen;
|
unsigned int buflen;
|
||||||
|
|
||||||
buflen = cmd->request_bufflen;
|
buflen = scsi_bufflen(cmd);
|
||||||
if (!buflen)
|
if (!buflen)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!cmd->request_buffer)
|
if (!scsi_sglist(cmd))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
sgpnt = cmd->request_buffer;
|
req_len = fin = 0;
|
||||||
for (k = 0, req_len = 0, fin = 0; k < cmd->use_sg; ++k, ++sgpnt) {
|
scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) {
|
||||||
kaddr = kmap_atomic(sgpnt->page, KM_IRQ0);
|
kaddr = kmap_atomic(sgpnt->page, KM_IRQ0);
|
||||||
len = sgpnt->length;
|
len = sgpnt->length;
|
||||||
if ((req_len + len) > buflen) {
|
if ((req_len + len) > buflen) {
|
||||||
@ -177,12 +177,12 @@ static int ps3rom_atapi_request(struct ps3_storage_device *dev,
|
|||||||
memcpy(&atapi_cmnd.pkt, cmd->cmnd, 12);
|
memcpy(&atapi_cmnd.pkt, cmd->cmnd, 12);
|
||||||
atapi_cmnd.pktlen = 12;
|
atapi_cmnd.pktlen = 12;
|
||||||
atapi_cmnd.block_size = 1; /* transfer size is block_size * blocks */
|
atapi_cmnd.block_size = 1; /* transfer size is block_size * blocks */
|
||||||
atapi_cmnd.blocks = atapi_cmnd.arglen = cmd->request_bufflen;
|
atapi_cmnd.blocks = atapi_cmnd.arglen = scsi_bufflen(cmd);
|
||||||
atapi_cmnd.buffer = dev->bounce_lpar;
|
atapi_cmnd.buffer = dev->bounce_lpar;
|
||||||
|
|
||||||
switch (cmd->sc_data_direction) {
|
switch (cmd->sc_data_direction) {
|
||||||
case DMA_FROM_DEVICE:
|
case DMA_FROM_DEVICE:
|
||||||
if (cmd->request_bufflen >= CD_FRAMESIZE)
|
if (scsi_bufflen(cmd) >= CD_FRAMESIZE)
|
||||||
atapi_cmnd.proto = DMA_PROTO;
|
atapi_cmnd.proto = DMA_PROTO;
|
||||||
else
|
else
|
||||||
atapi_cmnd.proto = PIO_DATA_IN_PROTO;
|
atapi_cmnd.proto = PIO_DATA_IN_PROTO;
|
||||||
@ -190,7 +190,7 @@ static int ps3rom_atapi_request(struct ps3_storage_device *dev,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case DMA_TO_DEVICE:
|
case DMA_TO_DEVICE:
|
||||||
if (cmd->request_bufflen >= CD_FRAMESIZE)
|
if (scsi_bufflen(cmd) >= CD_FRAMESIZE)
|
||||||
atapi_cmnd.proto = DMA_PROTO;
|
atapi_cmnd.proto = DMA_PROTO;
|
||||||
else
|
else
|
||||||
atapi_cmnd.proto = PIO_DATA_OUT_PROTO;
|
atapi_cmnd.proto = PIO_DATA_OUT_PROTO;
|
||||||
|
Loading…
Reference in New Issue
Block a user