diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-11-04 22:08:00 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-04 22:08:00 -0500 |
commit | 6037d6bbdff65eb5a84fe35e140f4da4f7cc103a (patch) | |
tree | 67b86d8559935c04a0918afd3274eef778017d57 /include/linux | |
parent | c2cc87ca9561ddfe744d446789cc10f507e87db9 (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')
-rw-r--r-- | include/linux/libata.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index 6225b78fa65b..dcd17e7458ab 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -777,4 +777,17 @@ static inline unsigned int __ac_err_mask(u8 status) | |||
777 | return mask; | 777 | return mask; |
778 | } | 778 | } |
779 | 779 | ||
780 | static inline int ata_pad_alloc(struct ata_port *ap, struct device *dev) | ||
781 | { | ||
782 | ap->pad_dma = 0; | ||
783 | ap->pad = dma_alloc_coherent(dev, ATA_DMA_PAD_BUF_SZ, | ||
784 | &ap->pad_dma, GFP_KERNEL); | ||
785 | return (ap->pad == NULL) ? -ENOMEM : 0; | ||
786 | } | ||
787 | |||
788 | static inline void ata_pad_free(struct ata_port *ap, struct device *dev) | ||
789 | { | ||
790 | dma_free_coherent(dev, ATA_DMA_PAD_BUF_SZ, ap->pad, ap->pad_dma); | ||
791 | } | ||
792 | |||
780 | #endif /* __LINUX_LIBATA_H__ */ | 793 | #endif /* __LINUX_LIBATA_H__ */ |