[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.
This commit is contained in:
Jeff Garzik
2005-11-04 22:08:00 -05:00
parent c2cc87ca95
commit 6037d6bbdf
5 changed files with 71 additions and 26 deletions

View File

@@ -777,4 +777,17 @@ static inline unsigned int __ac_err_mask(u8 status)
return mask;
}
static inline int ata_pad_alloc(struct ata_port *ap, struct device *dev)
{
ap->pad_dma = 0;
ap->pad = dma_alloc_coherent(dev, ATA_DMA_PAD_BUF_SZ,
&ap->pad_dma, GFP_KERNEL);
return (ap->pad == NULL) ? -ENOMEM : 0;
}
static inline void ata_pad_free(struct ata_port *ap, struct device *dev)
{
dma_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma);
}
#endif /* __LINUX_LIBATA_H__ */