[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025012824-concept-scoring-6e2e@gregkh>
Date: Tue, 28 Jan 2025 19:57:57 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, Stephen Rothwell <sfr@...b.auug.org.au>,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [GIT PULL] Driver core / debugfs updates for 6.14-rc1
On Tue, Jan 28, 2025 at 07:57:21PM +0100, Greg KH wrote:
> The following changes since commit 5bc55a333a2f7316b58edc7573e8e893f7acb532:
>
> Linux 6.13-rc7 (2025-01-12 14:37:56 -0800)
>
> are available in the Git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git tags/driver-core-6.14-rc1
>
> for you to fetch changes up to 01b3cb620815fc3feb90ee117d9445a5b608a9f7:
>
> rust: device: Use as_char_ptr() to avoid explicit cast (2025-01-16 11:07:27 +0100)
>
> ----------------------------------------------------------------
> Driver core and debugfs updates
>
> Here is the big set of driver core and debugfs updates for 6.14-rc1.
> It's coming late in the merge cycle as there are a number of merge
> conflicts with your tree now, and I wanted to make sure they were
> working properly. To resolve them, look in linux-next, and I will send
> the "fixup" patch as a response to the pull request.
And here's the merge resolution patch that I've used to get a clean
build with your tree:
diff --cc kernel/module/sysfs.c
index 254017b58b64,f99616499e2e..000000000000
--- a/kernel/module/sysfs.c
+++ b/kernel/module/sysfs.c
@@@ -196,8 -190,8 +190,8 @@@ static int add_notes_attrs(struct modul
nattr->attr.mode = 0444;
nattr->size = info->sechdrs[i].sh_size;
nattr->private = (void *)info->sechdrs[i].sh_addr;
- nattr->read = sysfs_bin_attr_simple_read;
+ nattr->read_new = sysfs_bin_attr_simple_read;
- ++nattr;
+ *(gattr++) = nattr++;
}
++loaded;
}
diff --cc rust/kernel/lib.rs
index b11fa08de3c0,545d1170ee63..000000000000
--- a/rust/kernel/lib.rs
+++ b/rust/kernel/lib.rs
@@@ -13,16 -13,12 +13,17 @@@
#![no_std]
#![feature(arbitrary_self_types)]
- #![feature(coerce_unsized)]
- #![feature(dispatch_from_dyn)]
+ #![cfg_attr(CONFIG_RUSTC_HAS_COERCE_POINTEE, feature(derive_coerce_pointee))]
+ #![cfg_attr(not(CONFIG_RUSTC_HAS_COERCE_POINTEE), feature(coerce_unsized))]
+ #![cfg_attr(not(CONFIG_RUSTC_HAS_COERCE_POINTEE), feature(dispatch_from_dyn))]
+ #![cfg_attr(not(CONFIG_RUSTC_HAS_COERCE_POINTEE), feature(unsize))]
#![feature(inline_const)]
#![feature(lint_reasons)]
- #![feature(unsize)]
+// Stable in Rust 1.83
+#![feature(const_maybe_uninit_as_mut_ptr)]
+#![feature(const_mut_refs)]
+#![feature(const_ptr_write)]
+#![feature(const_refs_to_cell)]
// Ensure conditional compilation based on the kernel configuration works;
// otherwise we may silently break things like initcall handling.
@@@ -37,12 -33,10 +38,13 @@@ pub use ffi
pub mod alloc;
#[cfg(CONFIG_BLOCK)]
pub mod block;
- mod build_assert;
+ #[doc(hidden)]
+ pub mod build_assert;
pub mod cred;
pub mod device;
+pub mod device_id;
+pub mod devres;
+pub mod driver;
pub mod error;
#[cfg(CONFIG_RUST_FW_LOADER_ABSTRACTIONS)]
pub mod firmware;
diff --cc rust/kernel/miscdevice.rs
index dfb363630c70,b3a6cc50b240..000000000000
--- a/rust/kernel/miscdevice.rs
+++ b/rust/kernel/miscdevice.rs
@@@ -10,11 -10,9 +10,12 @@@
use crate::{
bindings,
+ device::Device,
error::{to_result, Error, Result, VTABLE_DEFAULT_ERROR},
+ fs::File,
+ ffi::{c_int, c_long, c_uint, c_ulong},
prelude::*,
+ seq_file::SeqFile,
str::CStr,
types::{ForeignOwnable, Opaque},
};
@@@ -151,17 -132,8 +147,17 @@@ pub trait MiscDevice: Sized
_cmd: u32,
_arg: usize,
) -> Result<isize> {
- kernel::build_error!(VTABLE_DEFAULT_ERROR)
+ build_error!(VTABLE_DEFAULT_ERROR)
}
+
+ /// Show info for this fd.
+ fn show_fdinfo(
+ _device: <Self::Ptr as ForeignOwnable>::Borrowed<'_>,
+ _m: &SeqFile,
+ _file: &File,
+ ) {
- kernel::build_error!(VTABLE_DEFAULT_ERROR)
++ build_error!(VTABLE_DEFAULT_ERROR)
+ }
}
const fn create_vtable<T: MiscDevice>() -> &'static bindings::file_operations {
@@@ -230,12 -188,8 +226,12 @@@ unsafe extern "C" fn fops_open<T: MiscD
Err(err) => return err.to_errno(),
};
- // SAFETY: The open call of a file owns the private data.
- unsafe { (*file).private_data = ptr.into_foreign() };
+ // This overwrites the private data with the value specified by the user, changing the type of
+ // this file's private data. All future accesses to the private data is performed by other
+ // fops_* methods in this file, which all correctly cast the private data to the new type.
+ //
+ // SAFETY: The open call of a file can access the private data.
- unsafe { (*raw_file).private_data = ptr.into_foreign().cast_mut() };
++ unsafe { (*raw_file).private_data = ptr.into_foreign() };
0
}
@@@ -274,12 -225,7 +270,12 @@@ unsafe extern "C" fn fops_ioctl<T: Misc
// SAFETY: Ioctl calls can borrow the private data of the file.
let device = unsafe { <T::Ptr as ForeignOwnable>::borrow(private) };
- match T::ioctl(device, cmd, arg) {
+ // SAFETY:
+ // * The file is valid for the duration of this call.
+ // * There is no active fdget_pos region on the file on this thread.
+ let file = unsafe { File::from_raw_file(file) };
+
- match T::ioctl(device, file, cmd, arg as usize) {
++ match T::ioctl(device, file, cmd, arg) {
Ok(ret) => ret as c_long,
Err(err) => err.to_errno() as c_long,
}
@@@ -299,12 -245,7 +295,12 @@@ unsafe extern "C" fn fops_compat_ioctl<
// SAFETY: Ioctl calls can borrow the private data of the file.
let device = unsafe { <T::Ptr as ForeignOwnable>::borrow(private) };
- match T::compat_ioctl(device, cmd, arg) {
+ // SAFETY:
+ // * The file is valid for the duration of this call.
+ // * There is no active fdget_pos region on the file on this thread.
+ let file = unsafe { File::from_raw_file(file) };
+
- match T::compat_ioctl(device, file, cmd, arg as usize) {
++ match T::compat_ioctl(device, file, cmd, arg) {
Ok(ret) => ret as c_long,
Err(err) => err.to_errno() as c_long,
}
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index c24ccefb015e..e2c2a2ef1c12 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -1310,7 +1310,7 @@ new_device_store(struct device *dev, struct device_attribute *attr,
}
static DEVICE_ATTR_WO(new_device);
-static int __i2c_find_user_addr(struct device *dev, void *addrp)
+static int __i2c_find_user_addr(struct device *dev, const void *addrp)
{
struct i2c_client *client = i2c_verify_client(dev);
unsigned short addr = *(unsigned short *)addrp;
diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c
index 7d3b24c8ecae..4fe1a9c0bc1b 100644
--- a/drivers/leds/leds-turris-omnia.c
+++ b/drivers/leds/leds-turris-omnia.c
@@ -438,7 +438,7 @@ static int omnia_mcu_get_features(const struct i2c_client *mcu_client)
return reply;
}
-static int omnia_match_mcu_client(struct device *dev, void *data)
+static int omnia_match_mcu_client(struct device *dev, const void *data)
{
struct i2c_client *client;
Powered by blists - more mailing lists