mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gary Guo" <gary@garyguo.net>
To: "Danilo Krummrich" <dakr@kernel.org>,
	"Lorenzo Delgado" <lnsdev@proton.me>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Onur Özkan" <work@onurozkan.dev>,
	"Abdiel Janulgue" <abdiel.janulgue@gmail.com>,
	"Robin Murphy" <robin.murphy@arm.com>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Timur Tabi" <ttabi@nvidia.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	driver-core@lists.linux.dev, dri-devel@lists.freedesktop.org,
	nova-gpu@lists.linux.dev
Subject: Re: [PATCH] rust: io: convert ResourceSize into a transparent newtype
Date: Sun, 19 Jul 2026 21:53:56 +0100	[thread overview]
Message-ID: <DK2UHF0JHVJW.39W4VPL8H5CM8@garyguo.net> (raw)
In-Reply-To: <DK2MT37NYCTQ.3JCJ9EAQ9TJEE@kernel.org>

On Sun Jul 19, 2026 at 3:53 PM BST, Danilo Krummrich wrote:
> On Sun Jul 19, 2026 at 12:40 PM CEST, Lorenzo Delgado wrote:
>> I tried that, but it doesn't build. ResourceSize wraps resource_size_t,
>> which is u64 on 64-bit (CONFIG_PHYS_ADDR_T_64BIT), so the impl the patch
>> already has,
>>
>>     impl From<ResourceSize> for bindings::resource_size_t
>>
>> is already From<ResourceSize> for u64 there, and a second one conflicts:
>>
>>     error[E0119]: conflicting implementations of trait
>>                   `From<ResourceSize>` for type `u64`
>
> Sure, but in the case a cfg-gate is perfectly fine, as the impl will always be
> availble.  Either through impl for u64 directly or through impl for
> bindings::resource_size_t.

Given that `resource_size_t` is either u32 or u64 depending on cfg, essentially
`From<ResourceSize> for bindings::resource_size_t` has cfg-gating. So basically
we always unconditionally have u64 impl, and for `!CONFIG_PHYS_ADDR_T_64BIT` we
have a condition u32 impl.

Best,
Gary

  reply	other threads:[~2026-07-19 20:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-12 11:36 Lorenzo Delgado
2026-07-16 21:45 ` Danilo Krummrich
2026-07-19 10:40   ` Lorenzo Delgado
2026-07-19 14:53     ` Danilo Krummrich
2026-07-19 20:53       ` Gary Guo [this message]
2026-07-26  0:32   ` Alexandre Courbot
2026-07-19 20:09 ` [PATCH v2] " Lorenzo Delgado

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=DK2UHF0JHVJW.39W4VPL8H5CM8@garyguo.net \
    --to=gary@garyguo.net \
    --cc=a.hindborg@kernel.org \
    --cc=abdiel.janulgue@gmail.com \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=driver-core@lists.linux.dev \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lnsdev@proton.me \
    --cc=lossin@kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=ttabi@nvidia.com \
    --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

all inboxes | Powered by JetHome®