[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231012.160953.403000541893076703.fujita.tomonori@gmail.com>
Date: Thu, 12 Oct 2023 16:09:53 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: tmgross@...ch.edu
Cc: fujita.tomonori@...il.com, miguel.ojeda.sandonis@...il.com,
netdev@...r.kernel.org, rust-for-linux@...r.kernel.org, andrew@...n.ch,
greg@...ah.com, wedsonaf@...il.com
Subject: Re: [PATCH net-next v3 1/3] rust: core abstractions for network
PHY drivers
On Thu, 12 Oct 2023 00:43:00 -0400
Trevor Gross <tmgross@...ch.edu> wrote:
> On Wed, Oct 11, 2023 at 11:59 PM FUJITA Tomonori
> <fujita.tomonori@...il.com> wrote:
>>
>> >> +#![feature(const_maybe_uninit_zeroed)]
>> >
>> > The patch message should justify this addition and warn about it.
>>
>> I added the following to the commit log.
>>
>> This patch enables unstable const_maybe_uninit_zeroed feature for
>> kernel crate to enable unsafe code to handle a constant value with
>> uninitialized data. With the feature, the abstractions can initialize
>> a phy_driver structure with zero easily; instead of initializing all
>> the members by hand.
>
> Maybe also link something about its stability confidence?
> https://github.com/rust-lang/rust/pull/116218#issuecomment-1738534665
Thanks for the pointer. I'll update the commit log.
>> >> + /// Executes software reset the PHY via BMCR_RESET bit.
>> >
>> > Markdown missing (multiple instances).
>>
>> Can you elaborate?
>
> BMCR_RESET -> `BMCR_RESET` I believe
Thanks, fixed.
>> > +/// Represents the kernel's `struct mdio_device_id`.
>> > +pub struct DeviceId {
>> > + /// Corresponds to `phy_id` in `struct mdio_device_id`.
>> > + pub id: u32,
>> > + mask: DeviceMask,
>> > +}
>>
>> It would be nice to explain why the field is `pub`.
>
> On this subject, I think it would be good to add
>
> impl DeviceId {
> #[doc(hidden)] // <- macro use only
> pub const fn as_mdio_device_id(&self) ->
> bindings::mdio_device_id { /* ... */ }
> }
>
> That makes more sense when creating the table, and `id` no longer has
> to be public.
Ah, nice.
>> > This patch could be split a bit too, but that is up to the maintainers.
>>
>> Yeah.
>
> Maybe it would make sense to put the macro in its own commit when you
> send the next version? That gets some attention on its own.
I don't want attention on the macro :) But yeah, I'll do in the next
round.
Powered by blists - more mailing lists