* [PATCH 3/19] ipr: convert to use the data buffer accessors
@ 2007-05-12 10:05 FUJITA Tomonori
2007-05-14 15:27 ` Brian King
0 siblings, 1 reply; 3+ messages in thread
From: FUJITA Tomonori @ 2007-05-12 10:05 UTC (permalink / raw)
To: brking; +Cc: linux-scsi, James.Bottomley
This converts ipr to use the data buffer accessors.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
drivers/scsi/ipr.c | 26 ++++++++------------------
1 files changed, 8 insertions(+), 18 deletions(-)
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index 8390bce..8002ecc 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -550,12 +550,7 @@ struct ipr_cmnd *ipr_get_free_ipr_cmnd(s
static void ipr_unmap_sglist(struct ipr_ioa_cfg *ioa_cfg,
struct ipr_cmnd *ipr_cmd)
{
- struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
-
- if (ipr_cmd->dma_use_sg)
- pci_unmap_sg(ioa_cfg->pdev, scsi_cmd->request_buffer,
- scsi_cmd->use_sg,
- scsi_cmd->sc_data_direction);
+ scsi_dma_unmap(&ioa_cfg->pdev->dev, ipr_cmd->scsi_cmd);
}
/**
@@ -4279,20 +4274,18 @@ static int ipr_build_ioadl(struct ipr_io
struct ipr_cmnd *ipr_cmd)
{
int i, nseg;
- struct scatterlist *sglist;
+ struct scatterlist *sg;
u32 length;
u32 ioadl_flags = 0;
struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl;
- length = scsi_cmd->request_bufflen;
+ length = scsi_bufflen(scsi_cmd);
if (!length)
return 0;
- nseg = pci_map_sg(ioa_cfg->pdev, scsi_cmd->request_buffer,
- scsi_cmd->use_sg, scsi_cmd->sc_data_direction);
-
+ nseg = scsi_dma_map(&ioa_cfg->pdev->dev, scsi_cmd);
if (nseg < 0) {
dev_err(&ioa_cfg->pdev->dev, "pci_map_sg failed!\n");
return -1;
@@ -4313,8 +4306,6 @@ static int ipr_build_ioadl(struct ipr_io
cpu_to_be32(sizeof(struct ipr_ioadl_desc) * ipr_cmd->dma_use_sg);
}
- sglist = scsi_cmd->request_buffer;
-
if (ipr_cmd->dma_use_sg <= ARRAY_SIZE(ioarcb->add_data.u.ioadl)) {
ioadl = ioarcb->add_data.u.ioadl;
ioarcb->write_ioadl_addr =
@@ -4323,11 +4314,10 @@ static int ipr_build_ioadl(struct ipr_io
ioarcb->read_ioadl_addr = ioarcb->write_ioadl_addr;
}
- for (i = 0; i < ipr_cmd->dma_use_sg; i++) {
+ scsi_for_each_sg(scsi_cmd, sg, ipr_cmd->dma_use_sg, i) {
ioadl[i].flags_and_data_len =
- cpu_to_be32(ioadl_flags | sg_dma_len(&sglist[i]));
- ioadl[i].address =
- cpu_to_be32(sg_dma_address(&sglist[i]));
+ cpu_to_be32(ioadl_flags | sg_dma_len(sg));
+ ioadl[i].address = cpu_to_be32(sg_dma_address(sg));
}
ioadl[i-1].flags_and_data_len |= cpu_to_be32(IPR_IOADL_FLAGS_LAST);
@@ -4793,7 +4783,7 @@ static void ipr_scsi_done(struct ipr_cmn
struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
u32 ioasc = be32_to_cpu(ipr_cmd->ioasa.ioasc);
- scsi_cmd->resid = be32_to_cpu(ipr_cmd->ioasa.residual_data_len);
+ scsi_resid(scsi_cmd) = be32_to_cpu(ipr_cmd->ioasa.residual_data_len);
if (likely(IPR_IOASC_SENSE_KEY(ioasc) == 0)) {
ipr_unmap_sglist(ioa_cfg, ipr_cmd);
--
1.4.3.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 3/19] ipr: convert to use the data buffer accessors
2007-05-12 10:05 [PATCH 3/19] ipr: convert to use the data buffer accessors FUJITA Tomonori
@ 2007-05-14 15:27 ` Brian King
2007-05-14 22:37 ` FUJITA Tomonori
0 siblings, 1 reply; 3+ messages in thread
From: Brian King @ 2007-05-14 15:27 UTC (permalink / raw)
To: FUJITA Tomonori; +Cc: linux-scsi, James.Bottomley
FUJITA Tomonori wrote:
> @@ -550,12 +550,7 @@ struct ipr_cmnd *ipr_get_free_ipr_cmnd(s
> static void ipr_unmap_sglist(struct ipr_ioa_cfg *ioa_cfg,
> struct ipr_cmnd *ipr_cmd)
> {
> - struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
> -
> - if (ipr_cmd->dma_use_sg)
> - pci_unmap_sg(ioa_cfg->pdev, scsi_cmd->request_buffer,
> - scsi_cmd->use_sg,
> - scsi_cmd->sc_data_direction);
> + scsi_dma_unmap(&ioa_cfg->pdev->dev, ipr_cmd->scsi_cmd);
> }
You can completely do away with ipr_unmap_sglist and just call
scsi_dma_unmap directly instead.
Thanks,
Brian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 3/19] ipr: convert to use the data buffer accessors
2007-05-14 15:27 ` Brian King
@ 2007-05-14 22:37 ` FUJITA Tomonori
0 siblings, 0 replies; 3+ messages in thread
From: FUJITA Tomonori @ 2007-05-14 22:37 UTC (permalink / raw)
To: brking; +Cc: fujita.tomonori, linux-scsi, James.Bottomley
From: Brian King <brking@linux.vnet.ibm.com>
Subject: Re: [PATCH 3/19] ipr: convert to use the data buffer accessors
Date: Mon, 14 May 2007 10:27:44 -0500
> FUJITA Tomonori wrote:
> > @@ -550,12 +550,7 @@ struct ipr_cmnd *ipr_get_free_ipr_cmnd(s
> > static void ipr_unmap_sglist(struct ipr_ioa_cfg *ioa_cfg,
> > struct ipr_cmnd *ipr_cmd)
> > {
> > - struct scsi_cmnd *scsi_cmd = ipr_cmd->scsi_cmd;
> > -
> > - if (ipr_cmd->dma_use_sg)
> > - pci_unmap_sg(ioa_cfg->pdev, scsi_cmd->request_buffer,
> > - scsi_cmd->use_sg,
> > - scsi_cmd->sc_data_direction);
> > + scsi_dma_unmap(&ioa_cfg->pdev->dev, ipr_cmd->scsi_cmd);
> > }
>
> You can completely do away with ipr_unmap_sglist and just call
> scsi_dma_unmap directly instead.
I see. I'll update the patch.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-05-14 22:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-12 10:05 [PATCH 3/19] ipr: convert to use the data buffer accessors FUJITA Tomonori
2007-05-14 15:27 ` Brian King
2007-05-14 22:37 ` FUJITA Tomonori
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.