diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2007-07-22 20:42:32 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:38:13 -0400 |
commit | 358147403d1506ee43335c152fa3864d90f5ef6e (patch) | |
tree | db95b86039ba84d71bb0a1e5f3533cc2d0b736cb /drivers/scsi | |
parent | 0012fdf986c9b9c7fe8d0842a0ad8dd981a06c06 (diff) |
[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>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/ps3rom.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c index b50f1e14f2a5..0f43d1d046d9 100644 --- a/drivers/scsi/ps3rom.c +++ b/drivers/scsi/ps3rom.c | |||
@@ -100,16 +100,16 @@ static int fill_from_dev_buffer(struct scsi_cmnd *cmd, const void *buf) | |||
100 | struct scatterlist *sgpnt; | 100 | struct scatterlist *sgpnt; |
101 | unsigned int buflen; | 101 | unsigned int buflen; |
102 | 102 | ||
103 | buflen = cmd->request_bufflen; | 103 | buflen = scsi_bufflen(cmd); |
104 | if (!buflen) | 104 | if (!buflen) |
105 | return 0; | 105 | return 0; |
106 | 106 | ||
107 | if (!cmd->request_buffer) | 107 | if (!scsi_sglist(cmd)) |
108 | return -1; | 108 | return -1; |
109 | 109 | ||
110 | sgpnt = cmd->request_buffer; | ||
111 | active = 1; | 110 | active = 1; |
112 | for (k = 0, req_len = 0, act_len = 0; k < cmd->use_sg; ++k, ++sgpnt) { | 111 | req_len = act_len = 0; |
112 | scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) { | ||
113 | if (active) { | 113 | if (active) { |
114 | kaddr = kmap_atomic(sgpnt->page, KM_IRQ0); | 114 | kaddr = kmap_atomic(sgpnt->page, KM_IRQ0); |
115 | len = sgpnt->length; | 115 | len = sgpnt->length; |
@@ -124,7 +124,7 @@ static int fill_from_dev_buffer(struct scsi_cmnd *cmd, const void *buf) | |||
124 | } | 124 | } |
125 | req_len += sgpnt->length; | 125 | req_len += sgpnt->length; |
126 | } | 126 | } |
127 | cmd->resid = req_len - act_len; | 127 | scsi_set_resid(cmd, req_len - act_len); |
128 | return 0; | 128 | return 0; |
129 | } | 129 | } |
130 | 130 | ||
@@ -138,15 +138,15 @@ static int fetch_to_dev_buffer(struct scsi_cmnd *cmd, void *buf) | |||
138 | struct scatterlist *sgpnt; | 138 | struct scatterlist *sgpnt; |
139 | unsigned int buflen; | 139 | unsigned int buflen; |
140 | 140 | ||
141 | buflen = cmd->request_bufflen; | 141 | buflen = scsi_bufflen(cmd); |
142 | if (!buflen) | 142 | if (!buflen) |
143 | return 0; | 143 | return 0; |
144 | 144 | ||
145 | if (!cmd->request_buffer) | 145 | if (!scsi_sglist(cmd)) |
146 | return -1; | 146 | return -1; |
147 | 147 | ||
148 | sgpnt = cmd->request_buffer; | 148 | req_len = fin = 0; |
149 | for (k = 0, req_len = 0, fin = 0; k < cmd->use_sg; ++k, ++sgpnt) { | 149 | scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) { |
150 | kaddr = kmap_atomic(sgpnt->page, KM_IRQ0); | 150 | kaddr = kmap_atomic(sgpnt->page, KM_IRQ0); |
151 | len = sgpnt->length; | 151 | len = sgpnt->length; |
152 | if ((req_len + len) > buflen) { | 152 | if ((req_len + len) > buflen) { |
@@ -177,12 +177,12 @@ static int ps3rom_atapi_request(struct ps3_storage_device *dev, | |||
177 | memcpy(&atapi_cmnd.pkt, cmd->cmnd, 12); | 177 | memcpy(&atapi_cmnd.pkt, cmd->cmnd, 12); |
178 | atapi_cmnd.pktlen = 12; | 178 | atapi_cmnd.pktlen = 12; |
179 | atapi_cmnd.block_size = 1; /* transfer size is block_size * blocks */ | 179 | atapi_cmnd.block_size = 1; /* transfer size is block_size * blocks */ |
180 | atapi_cmnd.blocks = atapi_cmnd.arglen = cmd->request_bufflen; | 180 | atapi_cmnd.blocks = atapi_cmnd.arglen = scsi_bufflen(cmd); |
181 | atapi_cmnd.buffer = dev->bounce_lpar; | 181 | atapi_cmnd.buffer = dev->bounce_lpar; |
182 | 182 | ||
183 | switch (cmd->sc_data_direction) { | 183 | switch (cmd->sc_data_direction) { |
184 | case DMA_FROM_DEVICE: | 184 | case DMA_FROM_DEVICE: |
185 | if (cmd->request_bufflen >= CD_FRAMESIZE) | 185 | if (scsi_bufflen(cmd) >= CD_FRAMESIZE) |
186 | atapi_cmnd.proto = DMA_PROTO; | 186 | atapi_cmnd.proto = DMA_PROTO; |
187 | else | 187 | else |
188 | atapi_cmnd.proto = PIO_DATA_IN_PROTO; | 188 | atapi_cmnd.proto = PIO_DATA_IN_PROTO; |
@@ -190,7 +190,7 @@ static int ps3rom_atapi_request(struct ps3_storage_device *dev, | |||
190 | break; | 190 | break; |
191 | 191 | ||
192 | case DMA_TO_DEVICE: | 192 | case DMA_TO_DEVICE: |
193 | if (cmd->request_bufflen >= CD_FRAMESIZE) | 193 | if (scsi_bufflen(cmd) >= CD_FRAMESIZE) |
194 | atapi_cmnd.proto = DMA_PROTO; | 194 | atapi_cmnd.proto = DMA_PROTO; |
195 | else | 195 | else |
196 | atapi_cmnd.proto = PIO_DATA_OUT_PROTO; | 196 | atapi_cmnd.proto = PIO_DATA_OUT_PROTO; |