public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Wedson Almeida Filho" <walmeida@microsoft.com>,
	linux-usb@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [RFC PATCH v3 2/2] samples: rust: Add USB sample bindings
Date: Sun, 5 Nov 2023 08:26:43 +0100	[thread overview]
Message-ID: <2023110544-nimble-routing-98b6@gregkh> (raw)
In-Reply-To: <20231104211213.225891-3-yakoyoku@gmail.com>

On Sat, Nov 04, 2023 at 06:11:59PM -0300, Martin Rodriguez Reboredo wrote:
> This is a demonstration of the capabilities of doing bindings with
> subsystems that may or may not be statically linked.
> 
> Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
> ---
> v2 -> v3:
> - Generate bindings for USB.
> v1 -> v2:
> - Added this patch.

I know you are just using this for an example, but here's some
USB-specific things that you might want to clean up for when you submit
this as a "real" binding sometime in the future:

> +config USB_RUST
> +	bool "Rust USB bindings"

This is a "USB Host" binding.  We have both USB host mode (when you plug
a USB device into a system running Linux), and USB gadget mode (when
Linux is running on the USB device you plug into any other USB system).

So please be specific here, this should be "USB_HOST_RUST" and then
later, "USB_GADGET_RUST".

> +	depends on USB && RUST
> +	default n

Again, "default n" is the default, never list it again.


> +	help
> +	  Enables Rust bindings for USB.

USB Host, not all of USB.

> diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile
> index 7d338e9c0657..00e116913591 100644
> --- a/drivers/usb/core/Makefile
> +++ b/drivers/usb/core/Makefile
> @@ -11,6 +11,7 @@ usbcore-y += phy.o port.o
>  usbcore-$(CONFIG_OF)		+= of.o
>  usbcore-$(CONFIG_USB_PCI)		+= hcd-pci.o
>  usbcore-$(CONFIG_ACPI)		+= usb-acpi.o
> +usbcore-$(CONFIG_USB_RUST)		+= libusb.rlib
>  
>  ifdef CONFIG_USB_ONBOARD_HUB
>  usbcore-y			+= ../misc/onboard_usb_hub_pdevs.o
> @@ -18,4 +19,6 @@ endif
>  
>  obj-$(CONFIG_USB)		+= usbcore.o
>  
> +rust-libs			:= ./usb

Why the "./", why not just ":= usb" ?

> +config SAMPLE_RUST_USB_SIMPLE
> +	tristate "USB simple device driver"
> +	help
> +	  This option builds the Rust USB simple driver sample.

Rust USB simple host driver sample.

>  subdir-$(CONFIG_SAMPLE_RUST_HOSTPROGS)		+= hostprogs
> diff --git a/samples/rust/rust_usb_simple.rs b/samples/rust/rust_usb_simple.rs
> new file mode 100644
> index 000000000000..3523f81d5eb8
> --- /dev/null
> +++ b/samples/rust/rust_usb_simple.rs
> @@ -0,0 +1,22 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +//! Rust USB sample.
> +
> +use kernel::prelude::*;
> +
> +module! {
> +    type: UsbSimple,

"USBSimple" please.  I thought I said that before.

thanks,

greg k-h

  reply	other threads:[~2023-11-05  7:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-04 21:11 [RFC PATCH v3 0/2] rust: crates in other kernel directories Martin Rodriguez Reboredo
2023-11-04 21:11 ` [RFC PATCH v3 1/2] kbuild: Build Rust crates as libraries Martin Rodriguez Reboredo
2023-11-04 21:11 ` [RFC PATCH v3 2/2] samples: rust: Add USB sample bindings Martin Rodriguez Reboredo
2023-11-05  7:26   ` Greg Kroah-Hartman [this message]
2023-11-13 14:13 ` [RFC PATCH v3 0/2] rust: crates in other kernel directories Masahiro Yamada
2024-02-18 16:11   ` Martin Rodriguez Reboredo
2024-02-19  9:05     ` Masahiro Yamada
2024-03-15 13:44 ` Johannes Berg

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=2023110544-nimble-routing-98b6@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=walmeida@microsoft.com \
    --cc=wedsonaf@gmail.com \
    --cc=yakoyoku@gmail.com \
    /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