mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-04 20:57:45 -04:00
samples: rust: i2c: replace kernel::c_str! with C-Strings
C-String literals were added in Rust 1.77. Replace instances of `kernel::c_str!` with C-String literals where possible. Signed-off-by: Tamir Duberstein <tamird@gmail.com> Acked-by: Igor Korotin <igor.korotin.linux@gmail.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Link: https://patch.msgid.link/20251222-cstr-i2c-v1-2-df1c258d4615@gmail.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
committed by
Miguel Ojeda
parent
eeaad2f021
commit
32d61c516f
@@ -4,7 +4,6 @@
|
||||
|
||||
use kernel::{
|
||||
acpi,
|
||||
c_str,
|
||||
device::Core,
|
||||
i2c,
|
||||
of,
|
||||
@@ -17,21 +16,21 @@ kernel::acpi_device_table! {
|
||||
ACPI_TABLE,
|
||||
MODULE_ACPI_TABLE,
|
||||
<SampleDriver as i2c::Driver>::IdInfo,
|
||||
[(acpi::DeviceId::new(c_str!("LNUXBEEF")), 0)]
|
||||
[(acpi::DeviceId::new(c"LNUXBEEF"), 0)]
|
||||
}
|
||||
|
||||
kernel::i2c_device_table! {
|
||||
I2C_TABLE,
|
||||
MODULE_I2C_TABLE,
|
||||
<SampleDriver as i2c::Driver>::IdInfo,
|
||||
[(i2c::DeviceId::new(c_str!("rust_driver_i2c")), 0)]
|
||||
[(i2c::DeviceId::new(c"rust_driver_i2c"), 0)]
|
||||
}
|
||||
|
||||
kernel::of_device_table! {
|
||||
OF_TABLE,
|
||||
MODULE_OF_TABLE,
|
||||
<SampleDriver as i2c::Driver>::IdInfo,
|
||||
[(of::DeviceId::new(c_str!("test,rust_driver_i2c")), 0)]
|
||||
[(of::DeviceId::new(c"test,rust_driver_i2c"), 0)]
|
||||
}
|
||||
|
||||
impl i2c::Driver for SampleDriver {
|
||||
|
||||
@@ -69,7 +69,6 @@
|
||||
|
||||
use kernel::{
|
||||
acpi,
|
||||
c_str,
|
||||
device,
|
||||
devres::Devres,
|
||||
i2c,
|
||||
@@ -90,20 +89,20 @@ kernel::of_device_table!(
|
||||
OF_TABLE,
|
||||
MODULE_OF_TABLE,
|
||||
<SampleDriver as platform::Driver>::IdInfo,
|
||||
[(of::DeviceId::new(c_str!("test,rust-device")), ())]
|
||||
[(of::DeviceId::new(c"test,rust-device"), ())]
|
||||
);
|
||||
|
||||
kernel::acpi_device_table!(
|
||||
ACPI_TABLE,
|
||||
MODULE_ACPI_TABLE,
|
||||
<SampleDriver as platform::Driver>::IdInfo,
|
||||
[(acpi::DeviceId::new(c_str!("LNUXBEEF")), ())]
|
||||
[(acpi::DeviceId::new(c"LNUXBEEF"), ())]
|
||||
);
|
||||
|
||||
const SAMPLE_I2C_CLIENT_ADDR: u16 = 0x30;
|
||||
const SAMPLE_I2C_ADAPTER_INDEX: i32 = 0;
|
||||
const BOARD_INFO: i2c::I2cBoardInfo =
|
||||
i2c::I2cBoardInfo::new(c_str!("rust_driver_i2c"), SAMPLE_I2C_CLIENT_ADDR);
|
||||
i2c::I2cBoardInfo::new(c"rust_driver_i2c", SAMPLE_I2C_CLIENT_ADDR);
|
||||
|
||||
impl platform::Driver for SampleDriver {
|
||||
type IdInfo = ();
|
||||
|
||||
Reference in New Issue
Block a user