From: Asahi Lina <lina@asahilina.net>
To: "Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Wedson Almeida Filho" <wedsonaf@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Sven Van Asbroeck" <thesven73@gmail.com>
Cc: Fox Chen <foxhlchen@gmail.com>,
Martin Rodriguez Reboredo <yakoyoku@gmail.com>,
Andreas Hindborg <a.hindborg@samsung.com>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
asahi@lists.linux.dev, Asahi Lina <lina@asahilina.net>
Subject: [PATCH v3 0/6] rust: error: Add missing wrappers to convert to/from kernel error codes
Date: Mon, 03 Apr 2023 18:48:09 +0900 [thread overview]
Message-ID: <20230224-rust-error-v3-0-03779bddc02b@asahilina.net> (raw)
Hi everyone!
This series is part of the set of dependencies for the drm/asahi
Apple M1/M2 GPU driver.
It adds a bunch of missing wrappers in kernel::error, which are useful
to convert to/from kernel error codes. Since these will be used by many
abstractions coming up soon, I think it makes sense to merge them as
soon as possible instead of bundling them with the first user. Hence,
they have allow() tags to silence dead code warnings. These can be
removed as soon as the first user is in the kernel crate.
Getting this in first allows the subsequent abstractions to be merged in
any order, so we don't have to worry about piecewise rebasing and fixing
conflicts in the Error wrappers. See [1] for a complete tree with the DRM
abstractions and all other miscellaneous work-in-progress prerequisites
rebased on top of mainline.
Most of these have been extracted from the rust-for-linux/rust branch,
with author attribution to the first/primary author and Co-developed-by:
for everyone else who touched the code.
Attribution changes:
- One of the patches had Miguel's old email in the tags, updated that per
his request.
- Wedson's email changed from @google.com to @gmail.com (I understand
this is the current one).
Sven: There is one patch from you in this series, do you want to send it
yourself directly? I understand Wedson and Miguel are okay with me
sending stuff on their behalf.
[1] https://github.com/Rust-for-Linux/linux/pull/969/commits
Signed-off-by: Asahi Lina <lina@asahilina.net>
---
Changes in v3:
- Re-introduced from_errno_unchecked() (but private to this module since
it has no outside users) and used it in from_err_ptr().
- Updated safety comment in to_ptr().
- Link to v2: https://lore.kernel.org/r/20230224-rust-error-v2-0-3900319812da@asahilina.net
Changes in v2:
- Removed the redundant _kernel from various function names.
- Replaced the from_result!{} macro with a from_result() function taking a closure.
- Link to v1: https://lore.kernel.org/r/20230224-rust-error-v1-0-f8f9a9a87303@asahilina.net
---
Asahi Lina (2):
rust: error: Rename to_kernel_errno() -> to_errno()
rust: error: Add Error::to_ptr()
Miguel Ojeda (1):
rust: error: Add Error::from_errno{_unchecked}()
Sven Van Asbroeck (1):
rust: error: Add a helper to convert a C ERR_PTR to a `Result`
Wedson Almeida Filho (2):
rust: error: Add to_result() helper
rust: error: Add from_result() helper
rust/helpers.c | 19 +++++++
rust/kernel/error.rs | 137 +++++++++++++++++++++++++++++++++++++++++++++++++-
rust/macros/module.rs | 2 +-
3 files changed, 156 insertions(+), 2 deletions(-)
---
base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
change-id: 20230224-rust-error-f2871fbc907f
Thank you,
~~ Lina
next reply other threads:[~2023-04-03 9:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-03 9:48 Asahi Lina [this message]
2023-04-03 9:48 ` [PATCH v3 1/6] rust: error: Rename to_kernel_errno() -> to_errno() Asahi Lina
2023-04-03 9:48 ` [PATCH v3 2/6] rust: error: Add Error::to_ptr() Asahi Lina
2023-04-03 15:27 ` Gary Guo
2023-04-03 9:48 ` [PATCH v3 3/6] rust: error: Add Error::from_errno{_unchecked}() Asahi Lina
2023-04-03 9:48 ` [PATCH v3 4/6] rust: error: Add to_result() helper Asahi Lina
2023-04-03 9:48 ` [PATCH v3 5/6] rust: error: Add a helper to convert a C ERR_PTR to a `Result` Asahi Lina
2023-04-03 9:48 ` [PATCH v3 6/6] rust: error: Add from_result() helper Asahi Lina
2023-04-10 3:49 ` [PATCH v3 0/6] rust: error: Add missing wrappers to convert to/from kernel error codes Miguel Ojeda
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=20230224-rust-error-v3-0-03779bddc02b@asahilina.net \
--to=lina@asahilina.net \
--cc=a.hindborg@samsung.com \
--cc=alex.gaynor@gmail.com \
--cc=asahi@lists.linux.dev \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=foxhlchen@gmail.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=thesven73@gmail.com \
--cc=wedsonaf@gmail.com \
--cc=yakoyoku@gmail.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).