Re: [PATCH v2 3/3] ata: libata-sata: Use BIT() macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/15/25 4:30 PM, Niklas Cassel wrote:
> The BIT() macro is commonly used in the kernel.
> Make use of it when converting a tag, fetched from the Successful NCQ
> Commands log or the NCQ Command Error log, to a bit field.
> This makes the code easier to read.
> 
> Suggested-by: Igor Pylypiv <ipylypiv@xxxxxxxxxx>
> Signed-off-by: Niklas Cassel <cassel@xxxxxxxxxx>

Patch 2 changed sense_valid from u64 to u32. So I think this patch must be
squashed into patch 2 as otherwise, the first use of sense_valid doing:

	if (!(sense_valid & (1ULL << tag))) {

looks very wrong to me. Even though in practice it is not going to be an issue.

> ---
>  drivers/ata/libata-sata.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
> index 076953d18db9..4e3034af285e 100644
> --- a/drivers/ata/libata-sata.c
> +++ b/drivers/ata/libata-sata.c
> @@ -1545,7 +1545,7 @@ int ata_eh_get_ncq_success_sense(struct ata_link *link)
>  		 * If the command does not have any sense data, clear ATA_SENSE.
>  		 * Keep ATA_QCFLAG_EH_SUCCESS_CMD so that command is finished.
>  		 */
> -		if (!(sense_valid & (1ULL << tag))) {
> +		if (!(sense_valid & BIT(tag))) {
>  			qc->result_tf.status &= ~ATA_SENSE;
>  			continue;
>  		}
> @@ -1634,7 +1634,7 @@ void ata_eh_analyze_ncq_error(struct ata_link *link)
>  		return;
>  	}
>  
> -	if (!(link->sactive & (1 << tag))) {
> +	if (!(link->sactive & BIT(tag))) {
>  		ata_link_err(link, "log page 10h reported inactive tag %d\n",
>  			     tag);
>  		return;


-- 
Damien Le Moal
Western Digital Research




[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux