[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAC=eVgQNvsGWSbnm=V6V=S-gQ75kiw7=JPwOsaTDKQPwoXqEAw@mail.gmail.com>
Date: Fri, 9 Jan 2026 13:17:47 +0200
From: Kari Argillander <kari.argillander@...il.com>
To: Gladyshev Ilya <foxido@...ido.dev>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Len Brown <lenb@...nel.org>, Miguel Ojeda <ojeda@...nel.org>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Benno Lossin <lossin@...nel.org>, Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>, Tamir Duberstein <tamird@...il.com>, Armin Wolf <W_Armin@....de>,
platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, linux-acpi@...r.kernel.org
Subject: Re: [PATCH 3/3] rust: add WMI abstractions
pe 9.1.2026 klo 13.12 Gladyshev Ilya (foxido@...ido.dev) kirjoitti:
>
> On 1/8/26 22:48, Kari Argillander wrote:
> > On Wed, 7 Jan 2026 at 22:56, Gladyshev Ilya <foxido@...ido.dev> wrote:
> [snip]
> >> + /// WMI device notify.
> >> + ///
> >> + /// Called when new WMI event received from bounded device.
> >> + fn notify(self: Pin<&Self>, _dev: &Device<device::Core>, _event: Option<&AcpiObject>) {
> >
> > This should be device::Bound
> >
> > Also probably _ marks are not needed. I think compiler does give
> > unused build warnings.
> >
> > I do not know reason but usually other drivers use this over self. And
> > device first so this
> > would be:
> >
> > fn notify(dev: &Device<device::Bound>, this: Pin<&Self>, event:
> > Option<&AcpiObject>) {
> >
> > Same also in unbind. But like I said I'm not completely sure about this.
>
> I thought the reason for using this instead of self was because of the
> limited set of possible self types in previous versions of Rust...
Nice. Didn't know this. Thanks.
> IMO using Rust's self is more readable
Agreed.
> >> + build_error!(VTABLE_DEFAULT_ERROR);
> >> + }
> >> +
> >> + /// WMI driver remove.
> >> + fn unbind(self: Pin<&Self>, _dev: &Device<device::Core>) {
> >> + build_error!(VTABLE_DEFAULT_ERROR);
> >> + }
> >
> > unbind should not be mandatory so here just do
> It's not mandatory, that why there is default implementation. See
> https://rust.docs.kernel.org/macros/attr.vtable.html
>
>
> For other comments: Ack, thanks!
Powered by blists - more mailing lists