[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: 20c96ed278e362ae4e324ed7d8c69fb48c508d3c
Note: The patch differs from the upstream commit: --- 1: 20c96ed278e36 ! 1: c56dfa9d4bad7 rust: devres: do not dereference to the internal Revocable @@ Metadata ## Commit message ## rust: devres: do not dereference to the internal Revocable
+ [ Upstream commit 20c96ed278e362ae4e324ed7d8c69fb48c508d3c ] + We can't expose direct access to the internal Revocable, since this allows users to directly revoke the internal Revocable without Devres having the chance to synchronize with the devres callback -- we have to @@ rust/kernel/devres.rs #[pin_data] struct DevresInner<T> { dev: ARef<Device>, -@@ rust/kernel/devres.rs: pub fn access<'a>(&'a self, dev: &'a Device<Bound>) -> Result<&'a T> { - // SAFETY: `dev` being the same device as the device this `Devres` has been created for - // proves that `self.0.data` hasn't been revoked and is guaranteed to not be revoked as - // long as `dev` lives; `dev` lives at least as long as `self`. -- Ok(unsafe { self.deref().access() }) -+ Ok(unsafe { self.0.data.access() }) +@@ rust/kernel/devres.rs: pub fn new_foreign_owned(dev: &Device, data: T, flags: Flags) -> Result { + + Ok(()) } -}
@@ rust/kernel/devres.rs: pub fn access<'a>(&'a self, dev: &'a Device<Bound>) -> Re + pub fn try_access(&self) -> Option<RevocableGuard<'_, T>> { + self.0.data.try_access() + } -+ -+ /// [`Devres`] accessor for [`Revocable::try_access_with`]. -+ pub fn try_access_with<R, F: FnOnce(&T) -> R>(&self, f: F) -> Option<R> { -+ self.0.data.try_access_with(f) -+ }
- fn deref(&self) -> &Self::Target { - &self.0.data ---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-5.4.y | Success | Success |