In the previous patch we added Opaque::cast_from() that performs the opposite operation to Opaque::raw_get(). For consistency with this naming, rename raw_get() to cast_from(). There are a few other options such as calling cast_from() something closer to raw_get() rather than renaming this method. However, I could not find a great naming scheme that works with raw_get(). The previous version of this patch used from_raw(), but functions of that name typically have a different signature, so that's not a great option.
Showing the changes to rust/kernel/workqueue.rs (1 of 8 files). Show all
Unified · Split
| @@ -403,7 +403,7 @@ impl<T: ?Sized, const ID: u64> Work<T, ID> { · 402 unmodified lines | |||
| 403 | // | 403 | // |
| 404 | // A pointer cast would also be ok due to `#[repr(transparent)]`. We use `addr_of!` so that | 404 | // A pointer cast would also be ok due to `#[repr(transparent)]`. We use `addr_of!` so that |
| 405 | // the compiler does not complain that the `work` field is unused. | 405 | // the compiler does not complain that the `work` field is unused. |
| 406 | unsafe { Opaque::raw_get(core::ptr::addr_of!((*ptr).work)) } | 406 | unsafe { Opaque::cast_into(core::ptr::addr_of!((*ptr).work)) } |
| 407 | } | 407 | } |
| 408 | } | 408 | } |
| 409 | 409 | ||