[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230224-rust-macros-v1-0-b39fae46e102@asahilina.net>
Date: Fri, 24 Feb 2023 16:25:54 +0900
From: Asahi Lina <lina@...hilina.net>
To: Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>
Cc: rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org,
asahi@...ts.linux.dev, Asahi Lina <lina@...hilina.net>,
Finn Behrens <me@...enk.dev>,
Sumera Priyadarsini <sylphrenadin@...il.com>
Subject: [PATCH 0/3] rust: Miscellaneous macro improvements
Hi everyone!
This short series is part of the set of dependencies for the drm/asahi
Apple M1/M2 GPU driver.
The first two patches make concat_idents!(bindings::foo, bar) work.
I use this later in the DRM abstractions to construct DRM IOCTL command
names [1], which avoids having to import all of bindings::*.
The third patch allows specifying multiple module aliases. Since modules
can have multiple aliases, the macro naturally needs to be able to take
an array instead of a single alias. I don't use this in the current
iteration of the driver, since I introduced proper support for automatic
modpost alias generation for Rust modules, but it can be useful both to
remove that support as a blocking factor (we can specify aliases manually
as a fallback), and for modules which need extra aliases not covered by
device ID tables.
[1] https://github.com/AsahiLinux/linux/blob/gpu/rebase-20230224/rust/kernel/drm/ioctl.rs#L101
Signed-off-by: Asahi Lina <lina@...hilina.net>
---
Asahi Lina (3):
rust: macros: Make expect_punct() return the Punct directly
rust: macros: concat_idents: Allow :: paths in the first argument
rust: macros: Allow specifying multiple module aliases
rust/macros/concat_idents.rs | 24 +++++++++++++++++++++---
rust/macros/helpers.rs | 14 +++++++++++---
rust/macros/module.rs | 34 +++++++++++++++++++++++++++-------
3 files changed, 59 insertions(+), 13 deletions(-)
---
base-commit: 83f978b63fa7ad474ca22d7e2772c5988101c9bd
change-id: 20230224-rust-macros-633dbf870ae1
Thank you,
~~ Lina
Powered by blists - more mailing lists