[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 12 Dec 2023 19:56:04 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: aliceryhl@...gle.com
Cc: fujita.tomonori@...il.com, alice@...l.io, netdev@...r.kernel.org,
rust-for-linux@...r.kernel.org, andrew@...n.ch, tmgross@...ch.edu,
miguel.ojeda.sandonis@...il.com, benno.lossin@...ton.me,
wedsonaf@...il.com, boqun.feng@...il.com
Subject: Re: [PATCH net-next v10 1/4] rust: core abstractions for network
PHY drivers
On Tue, 12 Dec 2023 10:23:30 +0100
Alice Ryhl <aliceryhl@...gle.com> wrote:
> On Tue, Dec 12, 2023 at 12:15 AM FUJITA Tomonori
> <fujita.tomonori@...il.com> wrote:
>>
>> On Mon, 11 Dec 2023 22:46:01 +0100
>> Alice Ryhl <alice@...l.io> wrote:
>> >> + /// Gets the state of PHY state machine states.
>> >> + pub fn state(&self) -> DeviceState {
>> >> + let phydev = self.0.get();
>> >> + // SAFETY: The struct invariant ensures that we may access
>> >> + // this field without additional synchronization.
>> >> + let state = unsafe { (*phydev).state };
>> >> + // TODO: this conversion code will be replaced with automatically
>> >> generated code by bindgen
>> >> + // when it becomes possible.
>> >> + // better to call WARN_ONCE() when the state is out-of-range.
>> >
>> > Did you mix up two comments here? This doesn't parse in my brain.
>>
>> I'll remove the second comment because all we have to do here is using
>> bindgen.
>>
>>
>> >> + /// Reads a given C22 PHY register.
>> >> + // This function reads a hardware register and updates the stats so
>> >> takes `&mut self`.
>> >> + pub fn read(&mut self, regnum: u16) -> Result<u16> {
>> >> + let phydev = self.0.get();
>> >> + // SAFETY: `phydev` is pointing to a valid object by the type
>> >> invariant of `Self`.
>> >> + // So an FFI call with a valid pointer.
>> >
>> > This sentence also doesn't parse in my brain. Perhaps "So it's just an
>> > FFI call" or similar?
>>
>> "So it's just an FFI call" looks good. I'll fix all the places that
>> use the same comment.
>
> If you make those two comment changes, then you can add
>
> Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
I will, thanks!
Powered by blists - more mailing lists