[PATCH 1/7] rust: media: add the media module

Daniel Almeida posted 7 patches 1 month, 2 weeks ago
[PATCH 1/7] rust: media: add the media module
Posted by Daniel Almeida 1 month, 2 weeks ago
In preparation for future commits that add support for Rust abstractions
like v4l2_device, video_device, v4l2_fh and others, add the media module
in lib.rs and a corresponding MAINTAINERS entry.

Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com>
---
 MAINTAINERS              | 7 +++++++
 rust/kernel/lib.rs       | 2 ++
 rust/kernel/media/mod.rs | 6 ++++++
 3 files changed, 15 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index fe168477caa45799dfe07de2f54de6d6a1ce0615..6fc5d57950e474d73d5d65271a0394efc5a8960b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -15434,6 +15434,13 @@ F:	include/uapi/linux/uvcvideo.h
 F:	include/uapi/linux/v4l2-*
 F:	include/uapi/linux/videodev2.h
 
+MEDIA RUST INFRASTRUCTURE
+M:	Daniel Almeida <daniel.almeida@collabora.com>
+L:	linux-media@vger.kernel.org
+L:	rust-for-linux@vger.kernel.org
+S:	Supported
+F:	rust/media
+
 MEDIATEK BLUETOOTH DRIVER
 M:	Sean Wang <sean.wang@mediatek.com>
 L:	linux-bluetooth@vger.kernel.org
diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
index ed53169e795c0badf548025a57f946fa18bc73e3..34b9e1497b2a7f70c957bff31855aeac6039cf2b 100644
--- a/rust/kernel/lib.rs
+++ b/rust/kernel/lib.rs
@@ -96,6 +96,8 @@
 #[cfg(CONFIG_KUNIT)]
 pub mod kunit;
 pub mod list;
+#[cfg(CONFIG_MEDIA_SUPPORT)]
+pub mod media;
 pub mod miscdevice;
 pub mod mm;
 #[cfg(CONFIG_NET)]
diff --git a/rust/kernel/media/mod.rs b/rust/kernel/media/mod.rs
new file mode 100644
index 0000000000000000000000000000000000000000..e4a28be7b484888a02965d0e8b5fd5d3c969840a
--- /dev/null
+++ b/rust/kernel/media/mod.rs
@@ -0,0 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
+// SPDX-copyrightText: Copyright (C) 2025 Collabora Ltd.
+
+//! Media infrastructure support.
+//!
+//! Reference: <https://www.kernel.org/doc/html/latest/driver-api/media/index.html>
\ No newline at end of file

-- 
2.50.1
Re: [PATCH 1/7] rust: media: add the media module
Posted by Janne Grunau 1 month, 2 weeks ago
On Mon, Aug 18, 2025 at 02:49:47AM -0300, Daniel Almeida wrote:
> In preparation for future commits that add support for Rust abstractions
> like v4l2_device, video_device, v4l2_fh and others, add the media module
> in lib.rs and a corresponding MAINTAINERS entry.
> 
> Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com>
> ---
>  MAINTAINERS              | 7 +++++++
>  rust/kernel/lib.rs       | 2 ++
>  rust/kernel/media/mod.rs | 6 ++++++
>  3 files changed, 15 insertions(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index fe168477caa45799dfe07de2f54de6d6a1ce0615..6fc5d57950e474d73d5d65271a0394efc5a8960b 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -15434,6 +15434,13 @@ F:	include/uapi/linux/uvcvideo.h
>  F:	include/uapi/linux/v4l2-*
>  F:	include/uapi/linux/videodev2.h
>  
> +MEDIA RUST INFRASTRUCTURE
> +M:	Daniel Almeida <daniel.almeida@collabora.com>
> +L:	linux-media@vger.kernel.org
> +L:	rust-for-linux@vger.kernel.org
> +S:	Supported
> +F:	rust/media

You probably mean rust/kernel/media/

Janne
Re: [PATCH 1/7] rust: media: add the media module
Posted by Miguel Ojeda 1 month, 2 weeks ago
On Mon, Aug 18, 2025 at 7:51 AM Daniel Almeida
<daniel.almeida@collabora.com> wrote:
>
>  MAINTAINERS              | 7 +++++++

I would suggest splitting this into its own patch, "MAINTAINERS: "
prefix, so that it is more visible. The other bits can be moved to the
first patch that adds the file -- it is what we usually do.

> diff --git a/MAINTAINERS b/MAINTAINERS
> index fe168477caa45799dfe07de2f54de6d6a1ce0615..6fc5d57950e474d73d5d65271a0394efc5a8960b 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -15434,6 +15434,13 @@ F:     include/uapi/linux/uvcvideo.h
>  F:     include/uapi/linux/v4l2-*
>  F:     include/uapi/linux/videodev2.h
>
> +MEDIA RUST INFRASTRUCTURE

It may be good to match the parent entry/subsystem, e.g. with "
[RUST]" at the end or whatever is the convention for the subsystem (if
there is no convention, then " [RUST]" is what we have been normally
doing).

See e.g. "PCI SUBSYSTEM [RUST]".

> +S:     Supported

Very nice to see Collabora wants to support this!

> +F:     rust/media

rust/media/

i.e. a trailing slash here is mandatory to include all files and subdirectories.

> +// SPDX-copyrightText: Copyright (C) 2025 Collabora Ltd.

SPDX-FileCopyrightText?

> +//! Reference: <https://www.kernel.org/doc/html/latest/driver-api/media/index.html>

docs.kernel.org are nicer links :)

    https://docs.kernel.org/driver-api/media/index.html

> \ No newline at end of file

Normally there would be one.

Thanks!

Cheers,
Miguel