public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Greg KH" <gregkh@linuxfoundation.org>
Cc: "Onur Özkan" <work@onurozkan.dev>,
	rust-for-linux@vger.kernel.org, rafael@kernel.org,
	ojeda@kernel.org, boqun.feng@gmail.com, gary@garyguo.net,
	bjorn3_gh@protonmail.com, lossin@kernel.org,
	a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] rust: simplify `Adapter::id_info`
Date: Sat, 17 Jan 2026 13:53:31 +0100	[thread overview]
Message-ID: <DFQVNVYZCDPB.3IB8IA2KWUD4B@kernel.org> (raw)
In-Reply-To: <2026011703-bony-unloader-9099@gregkh>

On Sat Jan 17, 2026 at 1:07 PM CET, Greg KH wrote:
> Does clippy complain about this one?

No, it does not.

> I don't have strong feelings either, but the original is "easier" for
> those of us used to C code.

I think it's a matter of preference. Personally, I like those functional
characteristics of Rust and the corresponding possibility of compact expressions
as long as it is not overdone.

This case seems pretty simple though. :)

In comparison, this is code from allocating the level 1 page directory for the
GSP (radix3) firmware, which is probably a bit too much.

	level1 <- {
	    // Allocate the level 1 page table, map the level 2 page table onto it, and map it
	    // into the device address space.
	    VVec::<u8>::with_capacity(
	        level2.iter().count() * size_of::<u64>(),
	        GFP_KERNEL,
	    )
	    .map_err(|_| ENOMEM)
	    .and_then(|level1| map_into_lvl(&level2, level1))
	    .map(|level1| SGTable::new(dev, level1, DataDirection::ToDevice, GFP_KERNEL))?
	},

  reply	other threads:[~2026-01-17 12:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-17  9:47 [PATCH v2 0/1] rust: simplify `Adapter::id_info` Onur Özkan
2026-01-17  9:47 ` [PATCH v2 1/1] " Onur Özkan
2026-01-17 10:00   ` Greg KH
2026-01-17 11:02     ` Onur Özkan
2026-01-17 12:07       ` Greg KH
2026-01-17 12:53         ` Danilo Krummrich [this message]
2026-01-20 15:01           ` Gary Guo
2026-01-20 16:00             ` Miguel Ojeda
2026-01-24 13:20           ` Alexandre Courbot
2026-01-17 12:56         ` Onur Özkan
2026-01-17 14:25       ` Miguel Ojeda

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=DFQVNVYZCDPB.3IB8IA2KWUD4B@kernel.org \
    --to=dakr@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rafael@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    /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