mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Probst <markus.probst@posteo.de>
To: Danilo Krummrich <dakr@kernel.org>,
	gregkh@linuxfoundation.org,  rafael@kernel.org, ojeda@kernel.org,
	boqun@kernel.org, gary@garyguo.net,  bjorn3_gh@protonmail.com,
	lossin@kernel.org, a.hindborg@kernel.org,  aliceryhl@google.com,
	tmgross@umich.edu, daniel.almeida@collabora.com,
	 tamird@kernel.org, acourbot@nvidia.com, work@onurozkan.dev
Cc: driver-core@lists.linux.dev, linux-serial@vger.kernel.org,
	 rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: serdev: use ThisModule::as_ptr() instead of field access
Date: Thu, 13 Aug 2026 15:53:26 +0000	[thread overview]
Message-ID: <8e716c8ed7172fa28b569bf59a146c262a29e0c2.camel@posteo.de> (raw)
In-Reply-To: <20260813152444.514580-1-dakr@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2611 bytes --]

On Thu, 2026-08-13 at 17:24 +0200, Danilo Krummrich wrote:
> The THIS_MODULE series [1] applied to rust-next moved ThisModule from
> lib.rs into a module.rs submodule, making the tuple struct field private
> outside the module. This breaks the module.0 field access in serdev in
> driver-core-next.
> 
> Update the call to __serdev_device_driver_register() to use the public
> module.as_ptr() accessor to fix the build.
I encounter 2 errors when building with both driver-core-next and rust-
next

error[E0616]: field `0` of struct `module::ThisModule` is private
  --> rust/kernel/serdev.rs:90:89
   |
90 |         to_result(unsafe {
bindings::__serdev_device_driver_register(sdrv.get(), module.0) })
   |                                                                  
^ private field

error[E0599]: no method named `__pinned_init` found for associated type
`impl pin_init::PinInit<<T as serdev::Driver>::Data<'_>, error::Error>
+ '_` in the current scope
   --> rust/kernel/serdev.rs:200:40
    |
200 |             let result = unsafe {
data.__pinned_init(driver.as_mut_ptr()) };
    |                                        ^^^^^^^^^^^^^ method not
found in `impl pin_init::PinInit<<T as serdev::Driver>::Data<'_>,
error::Error> + '_`

error: aborting due to 2 previous errors


> 
> Link: https://lore.kernel.org/all/20260811-fix-fops-owner-v10-0-7e71776f9dbe@linux.dev/ [1]
> Closes: https://lore.kernel.org/all/DKNAS52KYWLD.M15VEC6U0F6R@kernel.org/
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
> ---
>  rust/kernel/serdev.rs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rust/kernel/serdev.rs b/rust/kernel/serdev.rs
> index c0cd24481ee3..eecb1117095c 100644
> --- a/rust/kernel/serdev.rs
> +++ b/rust/kernel/serdev.rs
> @@ -87,7 +87,7 @@ unsafe fn register(
>          }
>  
>          // SAFETY: `sdrv` is guaranteed to be a valid `DriverType`.
> -        to_result(unsafe { bindings::__serdev_device_driver_register(sdrv.get(), module.0) })
> +        to_result(unsafe { bindings::__serdev_device_driver_register(sdrv.get(), module.as_ptr()) })
>      }
>  
>      unsafe fn unregister(sdrv: &Opaque<Self::DriverType>) {
> 
> base-commit: 8364d0e36cbbdfe9adb65a170a70cbe3cdb02ff9

The first error disappears with this patch.

Reviewed-by: Markus Probst <markus.probst@posteo.de>


Should I send a patch regarding the 2. error?

It seems the `PinInit::__pinned_init` function is not only deprecated,
but also behind the `#[cfg(not(kernel))]` flag, which causes the error.

Thanks
- Markus Probst

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 870 bytes --]

  reply	other threads:[~2026-08-13 16:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 15:24 Danilo Krummrich
2026-08-13 15:53 ` Markus Probst [this message]
2026-08-13 16:08   ` Gary Guo
2026-08-13 16:10   ` Danilo Krummrich
2026-08-13 16:08 ` Gary Guo
2026-08-13 23:20 ` Danilo Krummrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8e716c8ed7172fa28b569bf59a146c262a29e0c2.camel@posteo.de \
    --to=markus.probst@posteo.de \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=driver-core@lists.linux.dev \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rafael@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®