diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-11-05 06:08:00 +0300 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-05 06:08:00 +0300 |
commit | 6037d6bbdff65eb5a84fe35e140f4da4f7cc103a (patch) | |
tree | 67b86d8559935c04a0918afd3274eef778017d57 /drivers/scsi/ahci.c | |
parent | c2cc87ca9561ddfe744d446789cc10f507e87db9 (diff) | |
download | linux-6037d6bbdff65eb5a84fe35e140f4da4f7cc103a.tar.xz |
[libata] ATAPI pad allocation fixes/cleanup
Use ata_pad_{alloc,free} in two drivers, to factor out common code.
Add ata_pad_{alloc,free} to two other drivers, which needed the padding
but had not been updated.
Diffstat (limited to 'drivers/scsi/ahci.c')
-rw-r--r-- | drivers/scsi/ahci.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 8420204c2eaa..4612312c0c2d 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c @@ -307,21 +307,22 @@ static int ahci_port_start(struct ata_port *ap) void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); void *mem; dma_addr_t mem_dma; + int rc; pp = kmalloc(sizeof(*pp), GFP_KERNEL); if (!pp) return -ENOMEM; memset(pp, 0, sizeof(*pp)); - ap->pad = dma_alloc_coherent(dev, ATA_DMA_PAD_BUF_SZ, &ap->pad_dma, GFP_KERNEL); - if (!ap->pad) { + rc = ata_pad_alloc(ap, dev); + if (rc) { kfree(pp); - return -ENOMEM; + return rc; } mem = dma_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma, GFP_KERNEL); if (!mem) { - dma_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma); + ata_pad_free(ap, dev); kfree(pp); return -ENOMEM; } @@ -397,7 +398,7 @@ static void ahci_port_stop(struct ata_port *ap) ap->private_data = NULL; dma_free_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, pp->cmd_slot, pp->cmd_slot_dma); - dma_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma); + ata_pad_free(ap, dev); kfree(pp); } |