public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Matthew Maurer" <mmaurer@google.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"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>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <rust-for-linux@vger.kernel.org>
Subject: Re: [PATCH v3 3/3] rust: Add SoC Driver Sample
Date: Wed, 17 Dec 2025 11:28:07 +0900	[thread overview]
Message-ID: <DF04Y5PE9GLT.3MGJ2WAOP1WY8@nvidia.com> (raw)
In-Reply-To: <20251216-soc-bindings-v3-3-42ecdc8c117e@google.com>

On Wed Dec 17, 2025 at 4:24 AM JST, Matthew Maurer wrote:
> Shows registration of a SoC device upon receipt of a probe.
>
> Signed-off-by: Matthew Maurer <mmaurer@google.com>
> ---
>  MAINTAINERS              |  1 +
>  samples/rust/Kconfig     | 11 +++++++
>  samples/rust/Makefile    |  1 +
>  samples/rust/rust_soc.rs | 82 ++++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 95 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 4ff01fb0f1bda27002094113c0bf9d074d28fdb6..bb2e710277cc84dd6042d4d46076e665d9f68752 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7705,6 +7705,7 @@ F:	samples/rust/rust_debugfs.rs
>  F:	samples/rust/rust_debugfs_scoped.rs
>  F:	samples/rust/rust_driver_platform.rs
>  F:	samples/rust/rust_driver_faux.rs
> +F:	samples/rust/rust_soc.rs
>  
>  DRIVERS FOR OMAP ADAPTIVE VOLTAGE SCALING (AVS)
>  M:	Nishanth Menon <nm@ti.com>
> diff --git a/samples/rust/Kconfig b/samples/rust/Kconfig
> index 3efa51bfc8efccd91d9ee079ccd078ed1a6e8aa7..c49ab910634596aea4a1a73dac87585e084f420a 100644
> --- a/samples/rust/Kconfig
> +++ b/samples/rust/Kconfig
> @@ -161,6 +161,17 @@ config SAMPLE_RUST_DRIVER_AUXILIARY
>  
>  	  If unsure, say N.
>  
> +config SAMPLE_RUST_SOC
> +	tristate "SoC Driver"
> +	select SOC_BUS
> +	help
> +	  This option builds the Rust SoC driver sample.
> +
> +	  To compile this as a module, choose M here:
> +	  the module will be called rust_soc.
> +
> +	  If unsure, say N.
> +
>  config SAMPLE_RUST_HOSTPROGS
>  	bool "Host programs"
>  	help
> diff --git a/samples/rust/Makefile b/samples/rust/Makefile
> index f65885d1d62bf406b0db13121ef3e5b09829cfbc..6c0aaa58ccccfd12ef019f68ca784f6d977bc668 100644
> --- a/samples/rust/Makefile
> +++ b/samples/rust/Makefile
> @@ -15,6 +15,7 @@ obj-$(CONFIG_SAMPLE_RUST_DRIVER_USB)		+= rust_driver_usb.o
>  obj-$(CONFIG_SAMPLE_RUST_DRIVER_FAUX)		+= rust_driver_faux.o
>  obj-$(CONFIG_SAMPLE_RUST_DRIVER_AUXILIARY)	+= rust_driver_auxiliary.o
>  obj-$(CONFIG_SAMPLE_RUST_CONFIGFS)		+= rust_configfs.o
> +obj-$(CONFIG_SAMPLE_RUST_SOC)			+= rust_soc.o
>  
>  rust_print-y := rust_print_main.o rust_print_events.o
>  
> diff --git a/samples/rust/rust_soc.rs b/samples/rust/rust_soc.rs
> new file mode 100644
> index 0000000000000000000000000000000000000000..33043b0ac8dadec36aebf369f0fb68dbb3b118ed
> --- /dev/null
> +++ b/samples/rust/rust_soc.rs
> @@ -0,0 +1,82 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +//! Rust SoC Platform driver sample.
> +
> +use kernel::{
> +    acpi,
> +    c_str,
> +    device::Core,
> +    of,
> +    platform,
> +    prelude::*,
> +    soc,
> +    str::CString,
> +    sync::aref::ARef, //
> +};
> +use pin_init::pin_init_scope;
> +
> +#[pin_data]
> +struct SampleSocDriver {
> +    pdev: ARef<platform::Device>,
> +    #[pin]
> +    _dev_reg: soc::Registration,
> +}
> +
> +kernel::of_device_table!(
> +    OF_TABLE,
> +    MODULE_OF_TABLE,
> +    <SampleSocDriver as platform::Driver>::IdInfo,
> +    [(of::DeviceId::new(c_str!("test,rust-device")), ())]

C strings can now be declared using `c"test,rust-device"` (applies
through this file).


      reply	other threads:[~2025-12-17  2:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-16 19:24 [PATCH v3 0/3] Support exporting SoC info from Rust Matthew Maurer
2025-12-16 19:24 ` [PATCH v3 1/3] rust: Add soc_device support Matthew Maurer
2025-12-17  2:31   ` Alexandre Courbot
2025-12-26 19:26     ` Matthew Maurer
2025-12-26 19:38       ` Matthew Maurer
2025-12-28 11:21         ` Miguel Ojeda
2026-01-14  7:54         ` Alexandre Courbot
2026-01-14  7:53       ` Alexandre Courbot
2025-12-16 19:24 ` [PATCH v3 2/3] docs: ABI: sysfs-devices-soc: Fix swapped sample values Matthew Maurer
2025-12-16 19:24 ` [PATCH v3 3/3] rust: Add SoC Driver Sample Matthew Maurer
2025-12-17  2:28   ` Alexandre Courbot [this message]

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=DF04Y5PE9GLT.3MGJ2WAOP1WY8@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=mmaurer@google.com \
    --cc=ojeda@kernel.org \
    --cc=rafael@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