diff mbox series

[v4,1/3] ata: libata: Rename ata_dma_blacklisted()

Message ID 20240723103406.294462-2-dlemoal@kernel.org
State New
Headers show
Series Some renaming and horkage improvements | expand

Commit Message

Damien Le Moal July 23, 2024, 10:34 a.m. UTC
Rename the function ata_dma_blacklisted() to ata_dev_nodma() as this new
name is more neutral. The function signature is also changed to return a
boolean instead of an int.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/ata/libata-core.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Comments

John Garry July 23, 2024, 1:34 p.m. UTC | #1
On 23/07/2024 11:34, Damien Le Moal wrote:
> Rename the function ata_dma_blacklisted() to ata_dev_nodma() as this new
> name is more neutral. The function signature is also changed to return a
> boolean instead of an int.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>   drivers/ata/libata-core.c | 15 ++++++++-------
>   1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index c7752dc80028..286e1bc02540 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -4287,16 +4287,17 @@ static unsigned long ata_dev_blacklisted(const struct ata_device *dev)
>   	return 0;
>   }
>   
> -static int ata_dma_blacklisted(const struct ata_device *dev)
> +static bool ata_dev_nodma(const struct ata_device *dev)
>   {
> -	/* We don't support polling DMA.
> -	 * DMA blacklist those ATAPI devices with CDB-intr (and use PIO)
> -	 * if the LLDD handles only interrupts in the HSM_ST_LAST state.
> +	/*
> +	 * We do not support polling DMA. Deny DMA for those ATAPI devices
> +	 * with CDB-intr (and use PIO) if the LLDD handles only interrupts in
> +	 * the HSM_ST_LAST state.
>   	 */
>   	if ((dev->link->ap->flags & ATA_FLAG_PIO_POLLING) &&
>   	    (dev->flags & ATA_DFLAG_CDB_INTR))
> -		return 1;
> -	return (dev->horkage & ATA_HORKAGE_NODMA) ? 1 : 0;
> +		return true;
> +	return !!(dev->horkage & ATA_HORKAGE_NODMA);

nit: no need from !! operator, since the function now returns a bool

>   }
>   
>   /**
> @@ -4404,7 +4405,7 @@ static void ata_dev_xfermask(struct ata_device *dev)
>   		xfer_mask &= ~(0x03 << (ATA_SHIFT_MWDMA + 3));
>   	}
>   
> -	if (ata_dma_blacklisted(dev)) {
> +	if (ata_dev_nodma(dev)) {
>   		xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
>   		ata_dev_warn(dev,
>   			     "device is on DMA blacklist, disabling DMA\n");
Igor Pylypiv July 23, 2024, 7:28 p.m. UTC | #2
On Tue, Jul 23, 2024 at 07:34:04PM +0900, Damien Le Moal wrote:
> Rename the function ata_dma_blacklisted() to ata_dev_nodma() as this new
> name is more neutral. The function signature is also changed to return a
> boolean instead of an int.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>

Reviewed-by: Igor Pylypiv <ipylypiv@google.com>

Thanks,
Igor
> ---
>  drivers/ata/libata-core.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
> index c7752dc80028..286e1bc02540 100644
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -4287,16 +4287,17 @@ static unsigned long ata_dev_blacklisted(const struct ata_device *dev)
>  	return 0;
>  }
>  
> -static int ata_dma_blacklisted(const struct ata_device *dev)
> +static bool ata_dev_nodma(const struct ata_device *dev)
>  {
> -	/* We don't support polling DMA.
> -	 * DMA blacklist those ATAPI devices with CDB-intr (and use PIO)
> -	 * if the LLDD handles only interrupts in the HSM_ST_LAST state.
> +	/*
> +	 * We do not support polling DMA. Deny DMA for those ATAPI devices
> +	 * with CDB-intr (and use PIO) if the LLDD handles only interrupts in
> +	 * the HSM_ST_LAST state.
>  	 */
>  	if ((dev->link->ap->flags & ATA_FLAG_PIO_POLLING) &&
>  	    (dev->flags & ATA_DFLAG_CDB_INTR))
> -		return 1;
> -	return (dev->horkage & ATA_HORKAGE_NODMA) ? 1 : 0;
> +		return true;
> +	return !!(dev->horkage & ATA_HORKAGE_NODMA);
>  }
>  
>  /**
> @@ -4404,7 +4405,7 @@ static void ata_dev_xfermask(struct ata_device *dev)
>  		xfer_mask &= ~(0x03 << (ATA_SHIFT_MWDMA + 3));
>  	}
>  
> -	if (ata_dma_blacklisted(dev)) {
> +	if (ata_dev_nodma(dev)) {
>  		xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
>  		ata_dev_warn(dev,
>  			     "device is on DMA blacklist, disabling DMA\n");
> -- 
> 2.45.2
> 
>
diff mbox series

Patch

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index c7752dc80028..286e1bc02540 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4287,16 +4287,17 @@  static unsigned long ata_dev_blacklisted(const struct ata_device *dev)
 	return 0;
 }
 
-static int ata_dma_blacklisted(const struct ata_device *dev)
+static bool ata_dev_nodma(const struct ata_device *dev)
 {
-	/* We don't support polling DMA.
-	 * DMA blacklist those ATAPI devices with CDB-intr (and use PIO)
-	 * if the LLDD handles only interrupts in the HSM_ST_LAST state.
+	/*
+	 * We do not support polling DMA. Deny DMA for those ATAPI devices
+	 * with CDB-intr (and use PIO) if the LLDD handles only interrupts in
+	 * the HSM_ST_LAST state.
 	 */
 	if ((dev->link->ap->flags & ATA_FLAG_PIO_POLLING) &&
 	    (dev->flags & ATA_DFLAG_CDB_INTR))
-		return 1;
-	return (dev->horkage & ATA_HORKAGE_NODMA) ? 1 : 0;
+		return true;
+	return !!(dev->horkage & ATA_HORKAGE_NODMA);
 }
 
 /**
@@ -4404,7 +4405,7 @@  static void ata_dev_xfermask(struct ata_device *dev)
 		xfer_mask &= ~(0x03 << (ATA_SHIFT_MWDMA + 3));
 	}
 
-	if (ata_dma_blacklisted(dev)) {
+	if (ata_dev_nodma(dev)) {
 		xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
 		ata_dev_warn(dev,
 			     "device is on DMA blacklist, disabling DMA\n");