From: "Danilo Krummrich" <dakr@kernel.org>
To: "Gary Guo" <gary@garyguo.net>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>,
"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>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
"FUJITA Tomonori" <fujita.tomonori@gmail.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Abdiel Janulgue" <abdiel.janulgue@gmail.com>,
"Robin Murphy" <robin.murphy@arm.com>,
"Dave Ertman" <david.m.ertman@intel.com>,
"Ira Weiny" <iweiny@kernel.org>,
"Leon Romanovsky" <leon@kernel.org>,
"Len Brown" <lenb@kernel.org>,
"Igor Korotin" <igor.korotin@linux.dev>,
"Rob Herring" <robh@kernel.org>,
"Saravana Kannan" <saravanak@kernel.org>,
"Viresh Kumar" <viresh.kumar@linaro.org>,
"Michal Wilczynski" <m.wilczynski@samsung.com>,
"Drew Fustini" <fustini@kernel.org>,
"Guo Ren" <guoren@kernel.org>, "Fu Wei" <wefu@redhat.com>,
"Uwe Kleine-König" <ukleinek@kernel.org>,
driver-core@lists.linux.dev, rust-for-linux@vger.kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org,
linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org,
devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
linux-pwm@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH v2 11/11] RFC: rust: driver: support map-like syntax for ID table
Date: Thu, 30 Jul 2026 23:00:37 +0200 [thread overview]
Message-ID: <DKC7IILD54UO.1N47QGSHMKENI@kernel.org> (raw)
In-Reply-To: <20260629-id_info-v2-11-56fccbe9c5ef@garyguo.net>
On Mon Jun 29, 2026 at 2:39 PM CEST, Gary Guo wrote:
> diff --git a/rust/kernel/device_id.rs b/rust/kernel/device_id.rs
> index c81fca5b4986..5f4d191fce51 100644
> --- a/rust/kernel/device_id.rs
> +++ b/rust/kernel/device_id.rs
> @@ -183,6 +183,17 @@ macro_rules! module_device_table {
> $table_type: literal, $device_id_ty: ty,
> $table_name: ident, $id_info_type: ty,
> [$(($id: expr, $info:expr $(,)?)),* $(,)?]
> + ) => {
> + $crate::module_device_table!(
> + $table_type, $device_id_ty, $table_name, $id_info_type,
> + {$($id=>$info,)*}
> + );
> + };
> +
> + (
> + $table_type: literal, $device_id_ty: ty,
> + $table_name: ident, $id_info_type: ty,
> + {$($id: expr => $info:expr),* $(,)?}
> ) => {
> #[export_name =
> concat!("__mod_device_table__", ::core::line!(),
> diff --git a/samples/rust/rust_driver_pci.rs b/samples/rust/rust_driver_pci.rs
> index 2282191e6292..652819dff082 100644
> --- a/samples/rust/rust_driver_pci.rs
> +++ b/samples/rust/rust_driver_pci.rs
> @@ -75,10 +75,9 @@ struct SampleDriverData<'bound> {
> kernel::pci_device_table!(
> PCI_TABLE,
> <SampleDriver as pci::Driver>::IdInfo,
> - [(
> - pci::DeviceId::from_id(pci::Vendor::REDHAT, 0x5),
> - TestIndex::NO_EVENTFD
> - )]
> + {
> + pci::DeviceId::from_id(pci::Vendor::REDHAT, 0x5) => TestIndex::NO_EVENTFD,
> + }
> );
This LGTM, do you want to send a follow-up series?
Thanks,
Danilo
next prev parent reply other threads:[~2026-07-30 21:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 12:39 [PATCH v2 00/11] rust: driver: use pointers instead of indices for ID info Gary Guo
2026-06-29 12:39 ` [PATCH v2 01/11] rust: driver: remove `IdTable::id` Gary Guo
2026-06-29 12:39 ` [PATCH v2 02/11] rust: driver: simplify `IdArray::new_without_index` Gary Guo
2026-06-29 12:39 ` [PATCH v2 03/11] rust: pci: use `Option<&IdInfo>` for device ID info Gary Guo
2026-06-29 12:39 ` [PATCH v2 04/11] rust: usb: " Gary Guo
2026-06-29 12:39 ` [PATCH v2 05/11] rust: net/phy: remove expansion from doc Gary Guo
2026-07-30 21:01 ` Danilo Krummrich
2026-06-29 12:39 ` [PATCH v2 06/11] rust: driver: centralize device ID handling Gary Guo
2026-06-29 12:39 ` [PATCH v2 07/11] rust: driver: remove `$module_table_name` from `module_device_table` Gary Guo
2026-06-29 12:39 ` [PATCH v2 08/11] rust: driver: store pointers in `DeviceId` Gary Guo
2026-06-29 12:39 ` [PATCH v2 09/11] rust: driver: remove open-coded matching logic Gary Guo
2026-06-29 12:39 ` [PATCH v2 10/11] rust: driver: remove duplicate ID table Gary Guo
2026-06-29 12:39 ` [PATCH v2 11/11] RFC: rust: driver: support map-like syntax for " Gary Guo
2026-07-30 21:00 ` Danilo Krummrich [this message]
2026-07-16 19:18 ` [PATCH v2 00/11] rust: driver: use pointers instead of indices for ID info Danilo Krummrich
2026-07-17 9:40 ` Greg Kroah-Hartman
2026-07-30 21:01 ` (subset) " Danilo Krummrich
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=DKC7IILD54UO.1N47QGSHMKENI@kernel.org \
--to=dakr@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=abdiel.janulgue@gmail.com \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=bhelgaas@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=david.m.ertman@intel.com \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=driver-core@lists.linux.dev \
--cc=fujita.tomonori@gmail.com \
--cc=fustini@kernel.org \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=guoren@kernel.org \
--cc=igor.korotin@linux.dev \
--cc=iweiny@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=lenb@kernel.org \
--cc=leon@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=m.wilczynski@samsung.com \
--cc=netdev@vger.kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=saravanak@kernel.org \
--cc=simona@ffwll.ch \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=ukleinek@kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=wefu@redhat.com \
--cc=work@onurozkan.dev \
/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