From: Igor Pylypiv <ipylypiv@google.com>
To: Niklas Cassel <cassel@kernel.org>
Cc: Damien Le Moal <dlemoal@kernel.org>, linux-ide@vger.kernel.org
Subject: Re: [PATCH 2/2] ata: libata-sata: Simplify sense_valid fetching
Date: Mon, 14 Apr 2025 10:58:01 -0700 [thread overview]
Message-ID: <Z_1Mqa8u96T2yzpf@google.com> (raw)
In-Reply-To: <20250411132522.126316-4-cassel@kernel.org>
On Fri, Apr 11, 2025 at 03:25:24PM +0200, Niklas Cassel wrote:
> While the sense_valid field is 47 bits according to the specification,
> we are currently only fetching 32 bits, because these are the only
> bits that represent the tags (0-31), which is all we care about.
>
> Thus, replace the existing logic with a simple get_unaligned_le32().
>
> Signed-off-by: Niklas Cassel <cassel@kernel.org>
> ---
> drivers/ata/libata-sata.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c
> index 2e4463d3a356..5ba79a1053ea 100644
> --- a/drivers/ata/libata-sata.c
> +++ b/drivers/ata/libata-sata.c
> @@ -1529,8 +1529,7 @@ int ata_eh_get_ncq_success_sense(struct ata_link *link)
> return -EIO;
> }
>
> - sense_valid = (u64)buf[8] | ((u64)buf[9] << 8) |
> - ((u64)buf[10] << 16) | ((u64)buf[11] << 24);
> + sense_valid = get_unaligned_le32(&buf[8]);
sense_valid is u64, should we update it to u32? We can also simplify
the sense_valid bit check to use the BIT() macro.
> extended_sense = get_unaligned_le16(&buf[14]);
> aux_icc_valid = extended_sense & BIT(15);
>
> --
> 2.49.0
>
Thanks,
Igor
next prev parent reply other threads:[~2025-04-14 17:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-11 13:25 [PATCH 1/2] ata: libata-sata: Save all fields from sense data descriptor Niklas Cassel
2025-04-11 13:25 ` [PATCH 2/2] ata: libata-sata: Simplify sense_valid fetching Niklas Cassel
2025-04-14 17:58 ` Igor Pylypiv [this message]
2025-04-15 6:51 ` Hannes Reinecke
2025-04-15 7:34 ` Niklas Cassel
2025-04-14 17:51 ` [PATCH 1/2] ata: libata-sata: Save all fields from sense data descriptor Igor Pylypiv
2025-04-15 6:49 ` Hannes Reinecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z_1Mqa8u96T2yzpf@google.com \
--to=ipylypiv@google.com \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.