[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DAACGEDVW8D4.66KOF7PWD1I0@kernel.org>
Date: Sat, 31 May 2025 14:27:52 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Christian Schrefl" <chrisi.schrefl@...il.com>, "Miguel Ojeda"
<ojeda@...nel.org>, "Danilo Krummrich" <dakr@...nel.org>, "Alex Gaynor"
<alex.gaynor@...il.com>, "Boqun Feng" <boqun.feng@...il.com>, "Gary Guo"
<gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, "Andreas Hindborg" <a.hindborg@...nel.org>,
"Alice Ryhl" <aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>,
"Arnd Bergmann" <arnd@...db.de>, "Greg Kroah-Hartman"
<gregkh@...uxfoundation.org>, "Lee Jones" <lee@...nel.org>, "Daniel
Almeida" <daniel.almeida@...labora.com>
Cc: Gerald Wisböck <gerald.wisboeck@...ther.ink>,
<rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 3/3] rust: miscdevice: adjust the rust_misc_device
sample to use RegistrationData.
On Fri May 30, 2025 at 10:46 PM CEST, Christian Schrefl wrote:
> Add a second mutex to the RustMiscDevice, which is shared between all
> instances of the device using an Arc and the RegistrationData of
> MiscDeviceRegistration.
>
> This is mostly to demonstrate the capability to share data in this way.
>
> Signed-off-by: Christian Schrefl <chrisi.schrefl@...il.com>
Two nits below, with those fixed:
Reviewed-by: Benno Lossin <lossin@...nel.org>
> @@ -94,7 +152,6 @@
> //! return 0;
> //! }
> //! ```
> -
Let's keep this newline.
> use core::pin::Pin;
>
> use kernel::{
> @@ -193,7 +263,6 @@ fn ioctl(me: Pin<&RustMiscDevice>, _file: &File, cmd: u32, arg: usize) -> Result
> Ok(0)
> }
> }
> -
This one too.
---
Cheers,
Benno
> #[pinned_drop]
> impl PinnedDrop for RustMiscDevice {
> fn drop(self: Pin<&mut Self>) {
> @@ -204,7 +273,7 @@ fn drop(self: Pin<&mut Self>) {
> impl RustMiscDevice {
> fn set_value(&self, mut reader: UserSliceReader) -> Result<isize> {
> let new_value = reader.read::<i32>()?;
> - let mut guard = self.inner.lock();
> + let mut guard = self.unique.lock();
>
> dev_info!(
> self.dev,
Powered by blists - more mailing lists