Skip to content

Commit 1b94727

Browse files
committed
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: Damien Le Moal <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Tested-by: Chia-Lin Kao (AceLan) <[email protected]> Tested-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]>
1 parent 0fecb50 commit 1b94727

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

include/linux/libata.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,23 +1886,21 @@ static inline unsigned long ata_deadline(unsigned long from_jiffies,
18861886
change in future hardware and specs, secondly 0xFF means 'no DMA' but is
18871887
> UDMA_0. Dyma ddreigiau */
18881888

1889-
static inline int ata_using_mwdma(struct ata_device *adev)
1889+
static inline bool ata_using_mwdma(struct ata_device *adev)
18901890
{
1891-
if (adev->dma_mode >= XFER_MW_DMA_0 && adev->dma_mode <= XFER_MW_DMA_4)
1892-
return 1;
1893-
return 0;
1891+
return adev->dma_mode >= XFER_MW_DMA_0 &&
1892+
adev->dma_mode <= XFER_MW_DMA_4;
18941893
}
18951894

1896-
static inline int ata_using_udma(struct ata_device *adev)
1895+
static inline bool ata_using_udma(struct ata_device *adev)
18971896
{
1898-
if (adev->dma_mode >= XFER_UDMA_0 && adev->dma_mode <= XFER_UDMA_7)
1899-
return 1;
1900-
return 0;
1897+
return adev->dma_mode >= XFER_UDMA_0 &&
1898+
adev->dma_mode <= XFER_UDMA_7;
19011899
}
19021900

1903-
static inline int ata_dma_enabled(struct ata_device *adev)
1901+
static inline bool ata_dma_enabled(struct ata_device *adev)
19041902
{
1905-
return (adev->dma_mode == 0xFF ? 0 : 1);
1903+
return adev->dma_mode != 0xFF;
19061904
}
19071905

19081906
/**************************************************************************

0 commit comments

Comments
 (0)