Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'driver-core-6.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core fixes from Greg KH:
"Here is a single driver core fix, and a .mailmap update.

The fix is for the rust driver core bindings, turned out that the
from_raw binding wasn't a good idea (don't want to pass a pointer to a
reference counted object without actually incrementing the pointer.)
So this change fixes it up as the from_raw binding came in in -rc1.

The other change is a .mailmap update.

Both have been in linux-next for a while with no reported issues"

* tag 'driver-core-6.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
mailmap: update mail for Fiona Behrens
rust: device: change the from_raw() function

+7 -13
+3
.mailmap
··· 210 210 Fenglin Wu <quic_fenglinw@quicinc.com> <fenglinw@codeaurora.org> 211 211 Filipe Lautert <filipe@icewall.org> 212 212 Finn Thain <fthain@linux-m68k.org> <fthain@telegraphics.com.au> 213 + Fiona Behrens <me@kloenk.dev> 214 + Fiona Behrens <me@kloenk.dev> <me@kloenk.de> 215 + Fiona Behrens <me@kloenk.dev> <fin@nyantec.com> 213 216 Franck Bui-Huu <vagabon.xyz@gmail.com> 214 217 Frank Rowand <frowand.list@gmail.com> <frank.rowand@am.sony.com> 215 218 Frank Rowand <frowand.list@gmail.com> <frank.rowand@sony.com>
+3 -12
rust/kernel/device.rs
··· 51 51 /// 52 52 /// It must also be ensured that `bindings::device::release` can be called from any thread. 53 53 /// While not officially documented, this should be the case for any `struct device`. 54 - pub unsafe fn from_raw(ptr: *mut bindings::device) -> ARef<Self> { 55 - // SAFETY: By the safety requirements, ptr is valid. 56 - // Initially increase the reference count by one to compensate for the final decrement once 57 - // this newly created `ARef<Device>` instance is dropped. 58 - unsafe { bindings::get_device(ptr) }; 59 - 60 - // CAST: `Self` is a `repr(transparent)` wrapper around `bindings::device`. 61 - let ptr = ptr.cast::<Self>(); 62 - 63 - // SAFETY: `ptr` is valid by the safety requirements of this function. By the above call to 64 - // `bindings::get_device` we also own a reference to the underlying `struct device`. 65 - unsafe { ARef::from_raw(ptr::NonNull::new_unchecked(ptr)) } 54 + pub unsafe fn get_device(ptr: *mut bindings::device) -> ARef<Self> { 55 + // SAFETY: By the safety requirements ptr is valid 56 + unsafe { Self::as_ref(ptr) }.into() 66 57 } 67 58 68 59 /// Obtain the raw `struct device *`.
+1 -1
rust/kernel/firmware.rs
··· 44 44 /// 45 45 /// # fn no_run() -> Result<(), Error> { 46 46 /// # // SAFETY: *NOT* safe, just for the example to get an `ARef<Device>` instance 47 - /// # let dev = unsafe { Device::from_raw(core::ptr::null_mut()) }; 47 + /// # let dev = unsafe { Device::get_device(core::ptr::null_mut()) }; 48 48 /// 49 49 /// let fw = Firmware::request(c_str!("path/to/firmware.bin"), &dev)?; 50 50 /// let blob = fw.data();