public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: Hannes Reinecke <hare@suse.de>
Cc: Damien Le Moal <dlemoal@kernel.org>,
	linux-ide@vger.kernel.org, Igor Pylypiv <ipylypiv@google.com>
Subject: Re: [PATCH 2/2] ata: libata-sata: Simplify sense_valid fetching
Date: Tue, 15 Apr 2025 09:34:53 +0200	[thread overview]
Message-ID: <Z_4MHUVbKYAMRpo_@ryzen> (raw)
In-Reply-To: <24c4c3a3-01a3-4f69-9fdc-8154ceceb5c3@suse.de>

On Tue, Apr 15, 2025 at 08:51:46AM +0200, Hannes Reinecke wrote:
> On 4/11/25 15:25, 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]);
> >   	extended_sense = get_unaligned_le16(&buf[14]);
> >   	aux_icc_valid = extended_sense & BIT(15);
> 
> Description is ever so misleading; we never fetched 47 bits to start
> with. All we do is simplify the logic.
> But whatever.

IMO, that is exactly what I wrote :)

Nevertheless, I clarified the commit message in V2.


Kind regards,
Niklas

  reply	other threads:[~2025-04-15  7:34 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
2025-04-15  6:51   ` Hannes Reinecke
2025-04-15  7:34     ` Niklas Cassel [this message]
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_4MHUVbKYAMRpo_@ryzen \
    --to=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=hare@suse.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox