[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <6FFC1A6F-D403-4BCC-9B0C-CD05A07B9923@collabora.com>
Date: Mon, 25 Aug 2025 18:03:59 -0300
From: Daniel Almeida <daniel.almeida@...labora.com>
To: Benno Lossin <lossin@...nel.org>
Cc: Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org,
linux-usb@...r.kernel.org
Subject: Re: [PATCH 1/2] rust: usb: add basic USB abstractions
Hi Benno,
> On 25 Aug 2025, at 17:49, Benno Lossin <lossin@...nel.org> wrote:
>
> On Mon Aug 25, 2025 at 8:18 PM CEST, Daniel Almeida wrote:
>> +impl DeviceId {
>> + /// Equivalent to C's `USB_DEVICE` macro.
>> + pub const fn from_id(vendor: u16, product: u16) -> Self {
>> + Self(bindings::usb_device_id {
>> + match_flags: bindings::USB_DEVICE_ID_MATCH_DEVICE as u16,
>> + idVendor: vendor,
>> + idProduct: product,
>> + // SAFETY: It is safe to use all zeroes for the other fields of `usb_device_id`.
>> + ..unsafe { MaybeUninit::zeroed().assume_init() }
>
> You can avoid this usage of `unsafe` with this patch series:
>
> https://lore.kernel.org/all/20250814093046.2071971-1-lossin@kernel.org
>
> I'd like to avoid introducing any new one of these.
>
> ---
> Cheers,
> Benno
>
>> + })
>> + }
>
Ah, nice, you spoke about this in the last RFL call, I remember it now.
Ok, I will address this in the next version.
— Daniel
Powered by blists - more mailing lists