Skip to content

rust/revocable: add try_access_with() convenience method

Alexandre Courbot linux-pci lkml rust-for-linux 4 versions – In review

Get series with b4
b4 am [email protected] change-id 20250313-try_with-cc9f91dd3b60

Versions newest first

  1. v4 Latest2 patches 7 repliesIn review
  2. v32 patches 3 repliesSuperseded
  3. v22 patches 1 replySuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v11 patch13 repliesSuperseded

Changes in v4 from the cover letter

- Collected Reviewed-by tags.
- Link to v3: https://lore.kernel.org/r/[email protected]

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2rust/revocable: add try_access_with() convenience methodrust/kernel/revocable.rs+16 -03 replies
2/2samples: rust: convert PCI rust sample driver to use try_access_with()samples/rust/rust_driver_pci.rs+5 -60 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchDanilo KrummrichBenno LossinJoel FernandesMiguel Ojeda
SeriesA-b
1/2A-b R-b R-b R-b
2/2A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v4 thread

Cover letter [PATCH v4 0/2] rust/revocable: add try_access_with() convenience method

This is a feature I found useful to have while writing Nova driver code that accessed registers alongside other operations. I would find myself quite confused about whether the guard was held or dropped at a given point of the code, and it felt like walking through a minefield; this pattern makes things safer and easier to read according to my experience writing nova-core code.

---
Changes in v4:
- Collected Reviewed-by tags.
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- Add Acked-by from v2.

Changes in v2:
- Use FnOnce for the callback type.
- Rename to try_access_with.
- Don't assume that users will want to map failure to ENXIO and return an option.
- Use a single method and let users adapt the behavior using their own wrappers/macros.

---
Alexandre Courbot (2):
rust/revocable: add try_access_with() convenience method
samples: rust: convert PCI rust sample driver to use try_access_with()

 rust/kernel/revocable.rs        | 16 ++++++++++++++++
 samples/rust/rust_driver_pci.rs | 11 +++++------
 2 files changed, 21 insertions(+), 6 deletions(-)

---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250313-try_with-cc9f91dd3b60

Best regards,

Signature · 1 line
Alexandre Courbot <[email protected]>