All of lore.kernel.org
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: linux-ide@vger.kernel.org, Igor Pylypiv <ipylypiv@google.com>,
	Niklas Cassel <cassel@kernel.org>
Subject: [PATCH 2/2] ata: libata-sata: Simplify sense_valid fetching
Date: Fri, 11 Apr 2025 15:25:24 +0200	[thread overview]
Message-ID: <20250411132522.126316-4-cassel@kernel.org> (raw)
In-Reply-To: <20250411132522.126316-3-cassel@kernel.org>

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]);
 	extended_sense = get_unaligned_le16(&buf[14]);
 	aux_icc_valid = extended_sense & BIT(15);
 
-- 
2.49.0


  reply	other threads:[~2025-04-11 13:25 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 ` Niklas Cassel [this message]
2025-04-14 17:58   ` [PATCH 2/2] ata: libata-sata: Simplify sense_valid fetching Igor Pylypiv
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=20250411132522.126316-4-cassel@kernel.org \
    --to=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=ipylypiv@google.com \
    --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.