aboutsummaryrefslogtreecommitdiff
path: root/include/linux/libata.h
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-11-04 22:08:00 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-11-04 22:08:00 -0500
commit6037d6bbdff65eb5a84fe35e140f4da4f7cc103a (patch)
tree67b86d8559935c04a0918afd3274eef778017d57 /include/linux/libata.h
parentc2cc87ca9561ddfe744d446789cc10f507e87db9 (diff)
[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 'include/linux/libata.h')
-rw-r--r--include/linux/libata.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 6225b78fa65..dcd17e7458a 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -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__ */