public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joel Fernandes <joelagnelf@nvidia.com>
To: Alexandre Courbot <acourbot@nvidia.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Alistair Popple" <apopple@nvidia.com>,
	"Timur Tabi" <ttabi@nvidia.com>, "Edwin Peer" <epeer@nvidia.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	Nouveau <nouveau-bounces@lists.freedesktop.org>
Subject: Re: [PATCH 2/5] gpu: nova-core: vbios: use FromBytes for PmuLookupTable header
Date: Mon, 3 Nov 2025 20:00:49 -0500	[thread overview]
Message-ID: <8972320f-c38b-4bbd-856e-fe1164769607@nvidia.com> (raw)
In-Reply-To: <DDZGO1JLDCCU.249NOQLOZBW6R@nvidia.com>



On 11/3/2025 6:50 PM, Alexandre Courbot wrote:
> On Tue Nov 4, 2025 at 5:04 AM JST, Joel Fernandes wrote:
>> Hi Alex,
>> Nice improvement, a nit:
>>
>> On Wed, Oct 29, 2025 at 12:07:37AM +0900, Alexandre Courbot wrote:
>> [..]
>>>  impl PmuLookupTable {
>>>      fn new(dev: &device::Device, data: &[u8]) -> Result<Self> {
>>> -        if data.len() < 4 {
>>> -            return Err(EINVAL);
>>> -        }
>>> +        let header = PmuLookupTableHeader::from_bytes_copy_prefix(data)
>>> +            .ok_or(EINVAL)?
>>> +            .0;
>>
>> Can we change to the following, it is easier to read than using `.0` IMO.
>>
>>  let (header, _rest) = PmuLookupTableHeader::from_bytes_copy_prefix(data)
>>       .ok_or(EINVAL)?;
>>
>> (and similarly in the other patches).
> 
> We can use `let (header, _) =` to make sure the unused remainder is not
> bound to any variable. That also turns that statement into a one-liner.
> 

Perfect, that's even better, thanks!

 - Joel


  reply	other threads:[~2025-11-04  1:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-28 15:07 [PATCH 0/5] gpu: nova-core: leverage FromBytes for VBIOS structures Alexandre Courbot
2025-10-28 15:07 ` [PATCH 1/5] rust: transmute: add `from_bytes_prefix` family of methods Alexandre Courbot
2025-10-28 15:07 ` [PATCH 2/5] gpu: nova-core: vbios: use FromBytes for PmuLookupTable header Alexandre Courbot
2025-11-03 20:04   ` Joel Fernandes
2025-11-03 23:50     ` Alexandre Courbot
2025-11-04  1:00       ` Joel Fernandes [this message]
2025-10-28 15:07 ` [PATCH 3/5] gpu: nova-core: vbios: use FromBytes for PcirStruct Alexandre Courbot
2025-10-28 15:07 ` [PATCH 4/5] gpu: nova-core: vbios: use FromBytes for BitHeader Alexandre Courbot
2025-10-28 15:07 ` [PATCH 5/5] gpu: nova-core: vbios: use FromBytes for NpdeStruct Alexandre Courbot
2025-10-28 20:24 ` [PATCH 0/5] gpu: nova-core: leverage FromBytes for VBIOS structures John Hubbard
2025-10-28 21:49   ` Alexandre Courbot
2025-10-28 21:56     ` John Hubbard
2025-11-03 20:17 ` Joel Fernandes
2025-11-05 11:44 ` Alexandre Courbot

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=8972320f-c38b-4bbd-856e-fe1164769607@nvidia.com \
    --to=joelagnelf@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apopple@nvidia.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=epeer@nvidia.com \
    --cc=gary@garyguo.net \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nouveau-bounces@lists.freedesktop.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tmgross@umich.edu \
    --cc=ttabi@nvidia.com \
    /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