Re: [PATCH 3/3] rust: add WMI abstractions
From: Kari Argillander
Date: Fri Jan 09 2026 - 06:18:38 EST
pe 9.1.2026 klo 13.12 Gladyshev Ilya (foxido@xxxxxxxxxx) kirjoitti:
>
> On 1/8/26 22:48, Kari Argillander wrote:
> > On Wed, 7 Jan 2026 at 22:56, Gladyshev Ilya <foxido@xxxxxxxxxx> 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!