Commit 1b947279 authored by Damien Le Moal's avatar Damien Le Moal

ata: libata: Cleanup inline DMA helper functions

Simplify the inline DMA helper functions ata_using_mwdma(),
ata_using_udma() and ata_dma_enabled() to directly return as a boolean
the result of their test condition.
Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Tested-by: default avatarChia-Lin Kao (AceLan) <acelan.kao@canonical.com>
Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 0fecb508
...@@ -1886,23 +1886,21 @@ static inline unsigned long ata_deadline(unsigned long from_jiffies, ...@@ -1886,23 +1886,21 @@ static inline unsigned long ata_deadline(unsigned long from_jiffies,
change in future hardware and specs, secondly 0xFF means 'no DMA' but is change in future hardware and specs, secondly 0xFF means 'no DMA' but is
> UDMA_0. Dyma ddreigiau */ > UDMA_0. Dyma ddreigiau */
static inline int ata_using_mwdma(struct ata_device *adev) static inline bool ata_using_mwdma(struct ata_device *adev)
{ {
if (adev->dma_mode >= XFER_MW_DMA_0 && adev->dma_mode <= XFER_MW_DMA_4) return adev->dma_mode >= XFER_MW_DMA_0 &&
return 1; adev->dma_mode <= XFER_MW_DMA_4;
return 0;
} }
static inline int ata_using_udma(struct ata_device *adev) static inline bool ata_using_udma(struct ata_device *adev)
{ {
if (adev->dma_mode >= XFER_UDMA_0 && adev->dma_mode <= XFER_UDMA_7) return adev->dma_mode >= XFER_UDMA_0 &&
return 1; adev->dma_mode <= XFER_UDMA_7;
return 0;
} }
static inline int ata_dma_enabled(struct ata_device *adev) static inline bool ata_dma_enabled(struct ata_device *adev)
{ {
return (adev->dma_mode == 0xFF ? 0 : 1); return adev->dma_mode != 0xFF;
} }
/************************************************************************** /**************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment