linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Document Media Controller IOCTL number assignments
@ 2025-05-27  5:56 Sakari Ailus
  2025-05-27  5:56 ` [PATCH v2 1/3] Documentation: Bump media IOCTL reserved numbers Sakari Ailus
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sakari Ailus @ 2025-05-27  5:56 UTC (permalink / raw)
  To: linux-doc
  Cc: Jonathan Corbet, Greg Kroah-Hartman, Madhavan Srinivasan,
	Haren Myneni, Bagas Sanjaya, Andrew Donnellan, Michael Ellerman,
	Akshay Gupta, linux-kernel, linux-media, hans, laurent.pinchart,
	Mauro Carvalho Chehab, Lee Jones

Hello all,

The Media Controller uses IOCTL numbers with '|' type up to 0x81 but the
range from 0x80 upwards is documented to belong to samples. The samples,
however, are currently using these values. Solve the problem by bumping
the top of the MC range and the samples allocation by 0x10 as the samples
don't require a stable IOCTL interface.

since v1:

- Improved the commit message in the first patch.

- Added a patch to change the IOCTLs also in the Rust sample.

Sakari Ailus (3):
  Documentation: Bump media IOCTL reserved numbers
  media: uapi: Document IOCTL number assignment
  samples: rust_misc_device: Bump IOCTL numbers

 Documentation/userspace-api/ioctl/ioctl-number.rst |  4 ++--
 include/uapi/linux/media.h                         |  4 ++++
 samples/rust/rust_misc_device.rs                   | 14 +++++++-------
 3 files changed, 13 insertions(+), 9 deletions(-)

-- 
2.39.5


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/3] Documentation: Bump media IOCTL reserved numbers
  2025-05-27  5:56 [PATCH v2 0/3] Document Media Controller IOCTL number assignments Sakari Ailus
@ 2025-05-27  5:56 ` Sakari Ailus
  2025-05-27  5:56 ` [PATCH v2 2/3] media: uapi: Document IOCTL number assignment Sakari Ailus
  2025-05-27  5:56 ` [PATCH v2 3/3] samples: rust_misc_device: Bump IOCTL numbers Sakari Ailus
  2 siblings, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2025-05-27  5:56 UTC (permalink / raw)
  To: linux-doc
  Cc: Jonathan Corbet, Greg Kroah-Hartman, Madhavan Srinivasan,
	Haren Myneni, Bagas Sanjaya, Andrew Donnellan, Michael Ellerman,
	Akshay Gupta, linux-kernel, linux-media, hans, laurent.pinchart,
	Mauro Carvalho Chehab, Lee Jones

The Media Controller uses IOCTL type '|' with numbers up to 0x81 while
numbers from 0x80 onwards are allocated for samples, creating a conflict
between allocations for MC and samples. Given that nothing appears to be
using numbers between 0x80 and 0x8f for other purposes than MC, even in
the samples allocation (checked with $ git grep "#define.*_IO.*'|'"), just
reassign the numbers up to 0x8f to linux/media.h and bump the samples
allocation by 0x10.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 Documentation/userspace-api/ioctl/ioctl-number.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/userspace-api/ioctl/ioctl-number.rst b/Documentation/userspace-api/ioctl/ioctl-number.rst
index bc91756bde73..6b3be3fb0b15 100644
--- a/Documentation/userspace-api/ioctl/ioctl-number.rst
+++ b/Documentation/userspace-api/ioctl/ioctl-number.rst
@@ -312,8 +312,8 @@ Code  Seq#    Include File                                           Comments
 'z'   40-7F                                                          CAN bus card conflict!
                                                                      <mailto:oe@port.de>
 'z'   10-4F  drivers/s390/crypto/zcrypt_api.h                        conflict!
-'|'   00-7F  linux/media.h
-'|'   80-9F  samples/                                                Any sample and example drivers
+'|'   00-8F  linux/media.h
+'|'   90-AF  samples/                                                Any sample and example drivers
 0x80  00-1F  linux/fb.h
 0x81  00-1F  linux/vduse.h
 0x89  00-06  arch/x86/include/asm/sockios.h
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/3] media: uapi: Document IOCTL number assignment
  2025-05-27  5:56 [PATCH v2 0/3] Document Media Controller IOCTL number assignments Sakari Ailus
  2025-05-27  5:56 ` [PATCH v2 1/3] Documentation: Bump media IOCTL reserved numbers Sakari Ailus
@ 2025-05-27  5:56 ` Sakari Ailus
  2025-05-27  5:56 ` [PATCH v2 3/3] samples: rust_misc_device: Bump IOCTL numbers Sakari Ailus
  2 siblings, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2025-05-27  5:56 UTC (permalink / raw)
  To: linux-doc
  Cc: Jonathan Corbet, Greg Kroah-Hartman, Madhavan Srinivasan,
	Haren Myneni, Bagas Sanjaya, Andrew Donnellan, Michael Ellerman,
	Akshay Gupta, linux-kernel, linux-media, hans, laurent.pinchart,
	Mauro Carvalho Chehab, Lee Jones

Document MC IOCTL number assignment in linux/media.h. In the past the
assignment up to 0x7f was missed so to prevent that from happening again,
document the value here as well.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/uapi/linux/media.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index 1c80b1d6bbaf..2808132fcf49 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -381,6 +381,10 @@ struct media_v2_topology {
  */
 #define MEDIA_REQUEST_IOC_QUEUE		_IO('|',  0x80)
 #define MEDIA_REQUEST_IOC_REINIT	_IO('|',  0x81)
+/*
+ * Don't allocate new IOCTL numbers past 0x8f, MC IOCTL number assignment ends
+ * there!
+ */
 
 #ifndef __KERNEL__
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 3/3] samples: rust_misc_device: Bump IOCTL numbers
  2025-05-27  5:56 [PATCH v2 0/3] Document Media Controller IOCTL number assignments Sakari Ailus
  2025-05-27  5:56 ` [PATCH v2 1/3] Documentation: Bump media IOCTL reserved numbers Sakari Ailus
  2025-05-27  5:56 ` [PATCH v2 2/3] media: uapi: Document IOCTL number assignment Sakari Ailus
@ 2025-05-27  5:56 ` Sakari Ailus
  2 siblings, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2025-05-27  5:56 UTC (permalink / raw)
  To: linux-doc
  Cc: Jonathan Corbet, Greg Kroah-Hartman, Madhavan Srinivasan,
	Haren Myneni, Bagas Sanjaya, Andrew Donnellan, Michael Ellerman,
	Akshay Gupta, linux-kernel, linux-media, hans, laurent.pinchart,
	Mauro Carvalho Chehab, Lee Jones

Use 0x90 as the IOCTL number base instead of 0x80, thus avoiding using the
same IOCTL numbers as the Media Controller. The change is also in line
with current IOCTL number documentation.

Also use 0xaf, belonging to the samples IOCTL number range, as the
unimplemented IOCTL.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 samples/rust/rust_misc_device.rs | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/samples/rust/rust_misc_device.rs b/samples/rust/rust_misc_device.rs
index c881fd6dbd08..2bd017d7c7c3 100644
--- a/samples/rust/rust_misc_device.rs
+++ b/samples/rust/rust_misc_device.rs
@@ -14,10 +14,10 @@
 //! #include <unistd.h>
 //! #include <sys/ioctl.h>
 //!
-//! #define RUST_MISC_DEV_FAIL _IO('|', 0)
-//! #define RUST_MISC_DEV_HELLO _IO('|', 0x80)
-//! #define RUST_MISC_DEV_GET_VALUE _IOR('|', 0x81, int)
-//! #define RUST_MISC_DEV_SET_VALUE _IOW('|', 0x82, int)
+//! #define RUST_MISC_DEV_FAIL _IO('|', 0xaf)
+//! #define RUST_MISC_DEV_HELLO _IO('|', 0x90)
+//! #define RUST_MISC_DEV_GET_VALUE _IOR('|', 0x91, int)
+//! #define RUST_MISC_DEV_SET_VALUE _IOW('|', 0x92, int)
 //!
 //! int main() {
 //!   int value, new_value;
@@ -110,9 +110,9 @@
     uaccess::{UserSlice, UserSliceReader, UserSliceWriter},
 };
 
-const RUST_MISC_DEV_HELLO: u32 = _IO('|' as u32, 0x80);
-const RUST_MISC_DEV_GET_VALUE: u32 = _IOR::<i32>('|' as u32, 0x81);
-const RUST_MISC_DEV_SET_VALUE: u32 = _IOW::<i32>('|' as u32, 0x82);
+const RUST_MISC_DEV_HELLO: u32 = _IO('|' as u32, 0x90);
+const RUST_MISC_DEV_GET_VALUE: u32 = _IOR::<i32>('|' as u32, 0x91);
+const RUST_MISC_DEV_SET_VALUE: u32 = _IOW::<i32>('|' as u32, 0x92);
 
 module! {
     type: RustMiscDeviceModule,
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-27  5:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-27  5:56 [PATCH v2 0/3] Document Media Controller IOCTL number assignments Sakari Ailus
2025-05-27  5:56 ` [PATCH v2 1/3] Documentation: Bump media IOCTL reserved numbers Sakari Ailus
2025-05-27  5:56 ` [PATCH v2 2/3] media: uapi: Document IOCTL number assignment Sakari Ailus
2025-05-27  5:56 ` [PATCH v2 3/3] samples: rust_misc_device: Bump IOCTL numbers Sakari Ailus

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).