[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DA0TG9P9N7CI.3STZPSRIV6NDX@kernel.org>
Date: Tue, 20 May 2025 09:40:21 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Remo Senekowitsch" <remo@...nzli.dev>, "Danilo Krummrich"
<dakr@...nel.org>
Cc: "Rob Herring" <robh@...nel.org>, "Saravana Kannan"
<saravanak@...gle.com>, "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>, "Benno Lossin" <benno.lossin@...ton.me>,
"Andreas Hindborg" <a.hindborg@...nel.org>, "Alice Ryhl"
<aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>, "Greg
Kroah-Hartman" <gregkh@...uxfoundation.org>, "Rafael J. Wysocki"
<rafael@...nel.org>, "Dirk Behme" <dirk.behme@...bosch.com>,
<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
<rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH v4 6/9] rust: device: Add bindings for reading device
properties
On Tue May 20, 2025 at 9:21 AM CEST, Benno Lossin wrote:
> On Mon May 19, 2025 at 9:51 PM CEST, Remo Senekowitsch wrote:
>> On Mon May 19, 2025 at 6:55 PM CEST, Danilo Krummrich wrote:
>>> Also, the PropertyInt trait itself has to be unsafe, given that it contains
>>> unsafe functions.
>>
>> I don't think a trait necessarily has to be marked unsafe just because
>> it has unsafe methods. Marking a trait as unsafe means that implementors
>> of the trait must uphold some invariants. This is not the case here
>> IIUC. Here's a good explanation of my understanding: [1]
>
> Yes this is correct, I don't think that the trait itself should be
> unsafe.
Ahh, I understood now why Danilo suggested this: if the trait should
guarantee that `fwnode_property_read_*_array` is called, then the trait
would have to be `unsafe`.
But I don't think that's necessary, we don't have any other unsafe code
that needs to rely on that.
---
Cheers,
Benno
Powered by blists - more mailing lists