* [folded] hpsa-factor-out-some-pci_unmap-code.patch removed from -mm tree
@ 2009-11-16 21:28 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2009-11-16 21:28 UTC (permalink / raw)
To: scameron, James.Bottomley, jens.axboe, mikem, mm-commits
The patch titled
hpsa: Factor out some pci_unmap code
has been removed from the -mm tree. Its filename was
hpsa-factor-out-some-pci_unmap-code.patch
This patch was dropped because it was folded into scsi-add-hpsa-driver-for-hp-smart-array-controllers.patch
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject: hpsa: Factor out some pci_unmap code
From: "Stephen M. Cameron" <scameron@beardog.cce.hp.com>
hpsa: Factor out some pci_unmap code. There are a few places
where the same, or nearly the same code is used to pci_unmap
data buffers of driver initiated commands. Factor these out
into a separate function.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Mike Miller <mikem@beardog.cce.hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/scsi/hpsa.c | 45 +++++++++++++-----------------------------
1 file changed, 14 insertions(+), 31 deletions(-)
diff -puN drivers/scsi/hpsa.c~hpsa-factor-out-some-pci_unmap-code drivers/scsi/hpsa.c
--- a/drivers/scsi/hpsa.c~hpsa-factor-out-some-pci_unmap-code
+++ a/drivers/scsi/hpsa.c
@@ -928,17 +928,18 @@ static int hpsa_scsi_detect(struct ctlr_
return -1;
}
-static void hpsa_unmap_one(struct pci_dev *pdev,
- struct CommandList *cp,
- size_t buflen,
- int data_direction)
+static void hpsa_pci_unmap(struct pci_dev *pdev,
+ struct CommandList *c, int sg_used, int data_direction)
{
+ int i;
union u64bit addr64;
- addr64.val32.lower = cp->SG[0].Addr.lower;
- addr64.val32.upper = cp->SG[0].Addr.upper;
- pci_unmap_single(pdev, (dma_addr_t) addr64.val,
- buflen, data_direction);
+ for (i = 0; i < sg_used; i++) {
+ addr64.val32.lower = c->SG[i].Addr.lower;
+ addr64.val32.upper = c->SG[i].Addr.upper;
+ pci_unmap_single(pdev, (dma_addr_t) addr64.val, c->SG[i].Len,
+ data_direction);
+ }
}
static void hpsa_map_one(struct pci_dev *pdev,
@@ -1055,7 +1056,7 @@ static int hpsa_scsi_do_inquiry(struct c
TYPE_CMD);
if (rc == 0) {
hpsa_scsi_do_simple_cmd_core(h, c);
- hpsa_unmap_one(h->pdev, c, bufsize, PCI_DMA_FROMDEVICE);
+ hpsa_pci_unmap(h->pdev, c, 1, PCI_DMA_FROMDEVICE);
ei = c->err_info;
if (ei->CommandStatus != 0 &&
@@ -1162,7 +1163,7 @@ static int hpsa_scsi_do_report_luns(stru
if (extended_response)
c->Request.CDB[1] = extended_response;
hpsa_scsi_do_simple_cmd_core(h, c);
- hpsa_unmap_one(h->pdev, c, bufsize, PCI_DMA_FROMDEVICE);
+ hpsa_pci_unmap(h->pdev, c, 1, PCI_DMA_FROMDEVICE);
ei = c->err_info;
if (ei->CommandStatus != 0 &&
ei->CommandStatus != CMD_DATA_UNDERRUN) {
@@ -2144,12 +2145,7 @@ static int hpsa_passthru_ioctl(struct ct
c->SG[0].Ext = 0; /* we are not chaining*/
}
hpsa_scsi_do_simple_cmd_core(h, c);
-
- /* unlock the buffers from DMA */
- temp64.val32.lower = c->SG[0].Addr.lower;
- temp64.val32.upper = c->SG[0].Addr.upper;
- pci_unmap_single(h->pdev, (dma_addr_t) temp64.val, iocommand.buf_size,
- PCI_DMA_BIDIRECTIONAL);
+ hpsa_pci_unmap(h->pdev, c, 1, PCI_DMA_BIDIRECTIONAL);
/* Copy the error information out */
memcpy(&iocommand.error_info, c->err_info,
@@ -2277,14 +2273,7 @@ static int hpsa_big_passthru_ioctl(struc
}
}
hpsa_scsi_do_simple_cmd_core(h, c);
- /* unlock the buffers from DMA */
- for (i = 0; i < sg_used; i++) {
- temp64.val32.lower = c->SG[i].Addr.lower;
- temp64.val32.upper = c->SG[i].Addr.upper;
- pci_unmap_single(h->pdev,
- (dma_addr_t) temp64.val, buff_size[i],
- PCI_DMA_BIDIRECTIONAL);
- }
+ hpsa_pci_unmap(h->pdev, c, sg_used, PCI_DMA_BIDIRECTIONAL);
/* Copy the error information out */
memcpy(&ioc->error_info, c->err_info, sizeof(ioc->error_info));
if (copy_to_user(argp, ioc, sizeof(*ioc))) {
@@ -2501,7 +2490,6 @@ static int sendcmd_core(struct ctlr_info
int i;
unsigned long complete;
int status = IO_ERROR;
- union u64bit buff_dma_handle;
resend_cmd1:
/*
@@ -2596,12 +2584,7 @@ resend_cmd1:
} while (1);
cleanup1:
-
- /* unlock the data buffer from DMA */
- buff_dma_handle.val32.lower = c->SG[0].Addr.lower;
- buff_dma_handle.val32.upper = c->SG[0].Addr.upper;
- pci_unmap_single(h->pdev, (dma_addr_t) buff_dma_handle.val,
- c->SG[0].Len, PCI_DMA_BIDIRECTIONAL);
+ hpsa_pci_unmap(h->pdev, c, 1, PCI_DMA_BIDIRECTIONAL);
return status;
}
_
Patches currently in -mm which might be from scameron@beardog.cce.hp.com are
linux-next.patch
scsi-add-hpsa-driver-for-hp-smart-array-controllers.patch
hpsa-factor-out-some-pci_unmap-code.patch
add-thread-to-allow-controllers-to-register-for-rescan-for-new-devices.patch
hpsa-allow-device-rescan-to-be-triggered-via-sysfs.patch
hpsa-make-hpsa_sdev_attrs-static.patch
hpsa-decode-unit-attention-condition-and-retry-commands.patch
hpsa-retry-driver-initiated-commands-on-unit-attention.patch
hpsa-flush-cache-with-interrupts-still-enabled.patch
hpsa-remove-sendcmd-in-no-case-are-we-required-to-poll-for-completions.patch
hpsa-make-fill_cmd-return-void.patch
hpsa-fix-typo-that-causes-scsi-status-to-be-lost.patch
hpsa-make-device-attrs-static.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-11-16 21:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-16 21:28 [folded] hpsa-factor-out-some-pci_unmap-code.patch removed from -mm tree akpm
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.