[PATCH v5 3/4] rust: add visibility to of_device_table macro

Markus Probst via B4 Relay posted 4 patches 3 days, 16 hours ago
[PATCH v5 3/4] rust: add visibility to of_device_table macro
Posted by Markus Probst via B4 Relay 3 days, 16 hours ago
From: Markus Probst <markus.probst@posteo.de>

Add visibility argument to macro to allow defining an of device table in
a different module than the driver, which can improve readability.

Signed-off-by: Markus Probst <markus.probst@posteo.de>
---
 rust/kernel/of.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/rust/kernel/of.rs b/rust/kernel/of.rs
index 58b20c367f99..a0de98a23416 100644
--- a/rust/kernel/of.rs
+++ b/rust/kernel/of.rs
@@ -53,8 +53,9 @@ pub const fn new(compatible: &'static CStr) -> Self {
 /// Create an OF `IdTable` with an "alias" for modpost.
 #[macro_export]
 macro_rules! of_device_table {
-    ($table_name:ident, $module_table_name:ident, $id_info_type: ty, $table_data: expr) => {
-        const $table_name: $crate::device_id::IdArray<
+    ($table_vis:vis $table_name:ident, $module_table_name:ident, $id_info_type: ty,
+        $table_data: expr) => {
+        $table_vis const $table_name: $crate::device_id::IdArray<
             $crate::of::DeviceId,
             $id_info_type,
             { $table_data.len() },

-- 
2.52.0
Re: [PATCH v5 3/4] rust: add visibility to of_device_table macro
Posted by Krzysztof Kozlowski 3 days, 3 hours ago
On Sun, Mar 29, 2026 at 08:02:17PM +0200, Markus Probst wrote:
> Add visibility argument to macro to allow defining an of device table in
> a different module than the driver, which can improve readability.

No. The of_device_id table must be always placed next to the foo_driver.
You keep introducing completely inconsisting styles in this patchset,
like completely broken usage of compatibles in the driver.

Best regards,
Krzysztof