rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Daniel Almeida <daniel.almeida@collabora.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH 0/2] rust: usb: add initial USB abstractions
Date: Thu, 25 Sep 2025 14:52:44 +0200	[thread overview]
Message-ID: <2025092520-sharply-everyone-4a5d@gregkh> (raw)
In-Reply-To: <20250825-b4-usb-v1-0-7aa024de7ae8@collabora.com>

On Mon, Aug 25, 2025 at 03:18:04PM -0300, Daniel Almeida wrote:
> This adds initial support for USB Rust drivers, not only because I see a
> widespread use of module_usb_driver() in media (which is a subsystem I
> aim to support) but also because I want to learn about USB in general
> and this is a nice opportunity to start doing so.
> 
> I tried to keep things as consistent with pci.rs and platform.rs as
> possible and tested it by manually binding a device (i.e.: my Logitech
> mouse) to the sample driver via:
> 
> /sys/bus/usb/drivers/rust_driver_usb/new_id
> 
> This initial patch is therefore comprised of the same patterns that are
> known to work for pci and platform already.
> 
> Physically disconnecting the device also worked, i.e.: nothing bad
> showed up in dmesg.
> 
> Note that I did not touch MAINTAINERS at all. The objective is to
> kickstart the discussion of what to do there here in v1.

Ok, as this seems to now be at least building properly for me, I have
taken it into my char-misc branch for the next -rc1 merge window.

BUT it has shown that it still needs some work to get "correct" and it
really doesn't do much quite yet, so I have applied the patch below to
pretty much just "disable" it entirely from the build at this point in
time.

I'll go and revert this commit after -rc1 is out, in my usb-next branch,
so that we can start to build on top of it and ensure that it doesn't
break, but for 6.18, I don't think it's quite ready to be there.

Yes, this is not a normal way that bindings will probably be merged into
the tree, but as I consulted deeply with the USB maintainer about this
topic while eating some good Paris pizza and French wine this week while
at the Kernel Recipes conference, I think that this deserves an
exception as they agree this can be merged now and they will be
responsible for any fallout.[1]

thanks,

greg k-h

From c1785be6395031f92b62badb27665f80f0a7794c Mon Sep 17 00:00:00 2001
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Thu, 25 Sep 2025 14:42:40 +0200
Subject: USB: disable rust bindings from the build for now

The rust USB bindings as submitted are a good start, but they don't
really seem to be correct in a number of minor places, so just disable
them from the build entirely at this point in time.  When they are ready
to be re-enabled, this commit can be reverted.

Cc: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 rust/bindings/bindings_helper.h | 1 -
 rust/helpers/helpers.c          | 1 -
 rust/kernel/lib.rs              | 2 --
 samples/rust/Kconfig            | 2 +-
 4 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h
index 41cd42cd286f..9b3a4ab95818 100644
--- a/rust/bindings/bindings_helper.h
+++ b/rust/bindings/bindings_helper.h
@@ -74,7 +74,6 @@
 #include <linux/slab.h>
 #include <linux/task_work.h>
 #include <linux/tracepoint.h>
-#include <linux/usb.h>
 #include <linux/wait.h>
 #include <linux/workqueue.h>
 #include <linux/xarray.h>
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 04103ab1a349..8e8277bdddca 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -48,7 +48,6 @@
 #include "task.c"
 #include "time.c"
 #include "uaccess.c"
-#include "usb.c"
 #include "vmalloc.c"
 #include "wait.c"
 #include "workqueue.c"
diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
index 004ca70b816d..99dbb7b2812e 100644
--- a/rust/kernel/lib.rs
+++ b/rust/kernel/lib.rs
@@ -127,8 +127,6 @@
 pub mod tracepoint;
 pub mod transmute;
 pub mod types;
-#[cfg(CONFIG_USB = "y")]
-pub mod usb;
 pub mod uaccess;
 pub mod workqueue;
 pub mod xarray;
diff --git a/samples/rust/Kconfig b/samples/rust/Kconfig
index 6d6e4d8c88cb..865a62a93ddc 100644
--- a/samples/rust/Kconfig
+++ b/samples/rust/Kconfig
@@ -85,7 +85,7 @@ config SAMPLE_RUST_DRIVER_PLATFORM
 
 config SAMPLE_RUST_DRIVER_USB
 	tristate "USB Driver"
-	depends on USB = y
+	depends on USB = y && BROKEN
 	help
 	  This option builds the Rust USB driver sample.
 
-- 
2.51.0


[1] For those not getting the sarcasm here, I'm that maintainer, and
    yes, Paris has some very good pizza :)

  parent reply	other threads:[~2025-09-25 12:52 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-25 18:18 [PATCH 0/2] rust: usb: add initial USB abstractions Daniel Almeida
2025-08-25 18:18 ` [PATCH 1/2] rust: usb: add basic " Daniel Almeida
2025-08-25 20:49   ` Benno Lossin
2025-08-25 21:03     ` Daniel Almeida
2025-09-23 13:21   ` Danilo Krummrich
2025-09-23 13:31     ` Daniel Almeida
2025-09-23 14:03       ` Danilo Krummrich
2025-09-23 14:30         ` Greg Kroah-Hartman
2025-09-23 14:38           ` Danilo Krummrich
2025-09-23 14:52             ` Greg Kroah-Hartman
2025-09-23 15:06               ` Danilo Krummrich
2025-09-23 14:58             ` Alan Stern
2025-09-23 14:13     ` Greg Kroah-Hartman
2025-09-23 14:16       ` Oliver Neukum
2025-09-23 14:22         ` Greg Kroah-Hartman
2025-09-23 14:25           ` Danilo Krummrich
2025-09-23 14:37             ` Greg Kroah-Hartman
2025-09-23 14:42               ` Danilo Krummrich
2025-09-23 14:49                 ` Greg Kroah-Hartman
2025-09-23 15:46                   ` Danilo Krummrich
2025-09-23 14:18       ` Danilo Krummrich
2025-08-25 18:18 ` [PATCH 2/2] samples: rust: add a USB driver sample Daniel Almeida
2025-09-06 11:14   ` Greg Kroah-Hartman
2025-09-06 12:04     ` Daniel Almeida
2025-09-06 12:10       ` Greg Kroah-Hartman
2025-09-06 12:41         ` Daniel Almeida
2025-09-06 13:07           ` Greg Kroah-Hartman
2025-09-06 14:49             ` Alan Stern
2025-09-06 14:56             ` Daniel Almeida
2025-09-06 13:22           ` Danilo Krummrich
2025-09-06 14:50             ` Daniel Almeida
2025-09-06 15:22               ` Danilo Krummrich
2025-09-06 15:46                 ` Daniel Almeida
2025-09-06 15:48                   ` Danilo Krummrich
2025-09-09 11:19                   ` Simon Neuenhausen
2025-09-09 12:12                     ` Daniel Almeida
2025-09-09 13:25                       ` Greg Kroah-Hartman
2025-09-09 12:14                     ` Greg Kroah-Hartman
2025-09-09 13:05                       ` Simon Neuenhausen
2025-08-25 20:32 ` [PATCH 0/2] rust: usb: add initial USB abstractions Greg Kroah-Hartman
2025-09-23 12:05 ` Greg Kroah-Hartman
2025-09-23 12:29   ` Alice Ryhl
2025-09-23 12:31     ` Greg Kroah-Hartman
2025-09-23 12:34     ` Daniel Almeida
2025-09-23 12:41       ` Greg Kroah-Hartman
2025-09-23 12:55       ` Miguel Ojeda
2025-09-23 12:56   ` Miguel Ojeda
2025-09-23 13:24     ` Daniel Almeida
2025-09-23 21:29       ` Miguel Ojeda
2025-09-25 12:52 ` Greg Kroah-Hartman [this message]
2025-09-25 12:58   ` Daniel Almeida
2025-09-25 13:29   ` Danilo Krummrich
2025-09-25 17:38     ` Greg Kroah-Hartman

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=2025092520-sharply-everyone-4a5d@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /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;
as well as URLs for NNTP newsgroup(s).