aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien Le Moal <dlemoal@kernel.org>2023-08-28 13:10:28 +0900
committerDamien Le Moal <dlemoal@kernel.org>2023-10-03 09:39:50 +0900
commit1b947279798fd51bef46e8241102f5b896add021 (patch)
tree7617040df32b9e58ebf43a176a5a6d863081825a
parentata: libata-eh: Reduce "disable device" message verbosity (diff)
downloadwireguard-linux-1b947279798fd51bef46e8241102f5b896add021.tar.xz
wireguard-linux-1b947279798fd51bef46e8241102f5b896add021.zip
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 <dlemoal@kernel.org> Reviewed-by: Hannes Reinecke <hare@suse.de> Tested-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--include/linux/libata.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index b39891320271..1dbb14daccfa 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -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
> 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 1;
- return 0;
+ return adev->dma_mode >= XFER_MW_DMA_0 &&
+ adev->dma_mode <= XFER_MW_DMA_4;
}
-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 1;
- return 0;
+ return adev->dma_mode >= XFER_UDMA_0 &&
+ adev->dma_mode <= XFER_UDMA_7;
}
-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;
}
/**************************************************************************