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

Pull driver core fixes from Danilo Krummrich:

- Fix swapped handling of lru_gen and lru_gen_full debugfs files in
vmscan

- Fix debugfs mount options (uid, gid, mode) being silently ignored

- Fix leak of devres action in the unwind path of Devres::new()

- Documentation:
- Expand and fix documentation of (outdated) Device, DeviceContext
and generic driver infrastructure
- Fix C header link of faux device abstractions
- Clarify expected interaction with the security team
- Smooth text flow in the security bug reporting process
documentation

* tag 'driver-core-6.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core:
Documentation: smooth the text flow in the security bug reporting process
Documentation: clarify the expected collaboration with security bugs reporters
debugfs: fix mount options not being applied
rust: devres: fix leaking call to devm_add_action()
rust: faux: fix C header link
driver: rust: expand documentation for driver infrastructure
device: rust: expand documentation for Device
device: rust: expand documentation for DeviceContext
mm/vmscan: fix inverted polarity in lru_gen_seq_show()

+318 -48
+16 -9
Documentation/process/security-bugs.rst
··· 8 disclosed as quickly as possible. Please report security bugs to the 9 Linux kernel security team. 10 11 - Contact 12 - ------- 13 14 The Linux kernel security team can be contacted by email at 15 <security@kernel.org>. This is a private list of security officers ··· 32 that can speed up the process considerably. It is possible that the 33 security team will bring in extra help from area maintainers to 34 understand and fix the security vulnerability. 35 - 36 - As it is with any bug, the more information provided the easier it 37 - will be to diagnose and fix. Please review the procedure outlined in 38 - 'Documentation/admin-guide/reporting-issues.rst' if you are unclear about what 39 - information is helpful. Any exploit code is very helpful and will not 40 - be released without consent from the reporter unless it has already been 41 - made public. 42 43 Please send plain text emails without attachments where possible. 44 It is much harder to have a context-quoted discussion about a complex
··· 8 disclosed as quickly as possible. Please report security bugs to the 9 Linux kernel security team. 10 11 + The security team and maintainers almost always require additional 12 + information beyond what was initially provided in a report and rely on 13 + active and efficient collaboration with the reporter to perform further 14 + testing (e.g., verifying versions, configuration options, mitigations, or 15 + patches). Before contacting the security team, the reporter must ensure 16 + they are available to explain their findings, engage in discussions, and 17 + run additional tests. Reports where the reporter does not respond promptly 18 + or cannot effectively discuss their findings may be abandoned if the 19 + communication does not quickly improve. 20 + 21 + As it is with any bug, the more information provided the easier it 22 + will be to diagnose and fix. Please review the procedure outlined in 23 + 'Documentation/admin-guide/reporting-issues.rst' if you are unclear about what 24 + information is helpful. Any exploit code is very helpful and will not 25 + be released without consent from the reporter unless it has already been 26 + made public. 27 28 The Linux kernel security team can be contacted by email at 29 <security@kernel.org>. This is a private list of security officers ··· 18 that can speed up the process considerably. It is possible that the 19 security team will bring in extra help from area maintainers to 20 understand and fix the security vulnerability. 21 22 Please send plain text emails without attachments where possible. 23 It is much harder to have a context-quoted discussion about a complex
+10 -1
fs/debugfs/inode.c
··· 183 struct debugfs_fs_info *sb_opts = sb->s_fs_info; 184 struct debugfs_fs_info *new_opts = fc->s_fs_info; 185 186 sync_filesystem(sb); 187 188 /* structure copy of new mount options to sb */ ··· 285 286 static int debugfs_get_tree(struct fs_context *fc) 287 { 288 if (!(debugfs_allow & DEBUGFS_ALLOW_API)) 289 return -EPERM; 290 291 - return get_tree_single(fc, debugfs_fill_super); 292 } 293 294 static void debugfs_free_fc(struct fs_context *fc)
··· 183 struct debugfs_fs_info *sb_opts = sb->s_fs_info; 184 struct debugfs_fs_info *new_opts = fc->s_fs_info; 185 186 + if (!new_opts) 187 + return 0; 188 + 189 sync_filesystem(sb); 190 191 /* structure copy of new mount options to sb */ ··· 282 283 static int debugfs_get_tree(struct fs_context *fc) 284 { 285 + int err; 286 + 287 if (!(debugfs_allow & DEBUGFS_ALLOW_API)) 288 return -EPERM; 289 290 + err = get_tree_single(fc, debugfs_fill_super); 291 + if (err) 292 + return err; 293 + 294 + return debugfs_reconfigure(fc); 295 } 296 297 static void debugfs_free_fc(struct fs_context *fc)
+2 -2
mm/vmscan.c
··· 5772 if (sysfs_create_group(mm_kobj, &lru_gen_attr_group)) 5773 pr_err("lru_gen: failed to create sysfs group\n"); 5774 5775 - debugfs_create_file_aux_num("lru_gen", 0644, NULL, NULL, 1, 5776 &lru_gen_rw_fops); 5777 - debugfs_create_file_aux_num("lru_gen_full", 0444, NULL, NULL, 0, 5778 &lru_gen_ro_fops); 5779 5780 return 0;
··· 5772 if (sysfs_create_group(mm_kobj, &lru_gen_attr_group)) 5773 pr_err("lru_gen: failed to create sysfs group\n"); 5774 5775 + debugfs_create_file_aux_num("lru_gen", 0644, NULL, NULL, false, 5776 &lru_gen_rw_fops); 5777 + debugfs_create_file_aux_num("lru_gen_full", 0444, NULL, NULL, true, 5778 &lru_gen_ro_fops); 5779 5780 return 0;
+184 -24
rust/kernel/device.rs
··· 15 16 pub mod property; 17 18 - /// A reference-counted device. 19 /// 20 - /// This structure represents the Rust abstraction for a C `struct device`. This implementation 21 - /// abstracts the usage of an already existing C `struct device` within Rust code that we get 22 - /// passed from the C side. 23 /// 24 - /// An instance of this abstraction can be obtained temporarily or permanent. 25 /// 26 - /// A temporary one is bound to the lifetime of the C `struct device` pointer used for creation. 27 - /// A permanent instance is always reference-counted and hence not restricted by any lifetime 28 - /// boundaries. 29 /// 30 - /// For subsystems it is recommended to create a permanent instance to wrap into a subsystem 31 - /// specific device structure (e.g. `pci::Device`). This is useful for passing it to drivers in 32 - /// `T::probe()`, such that a driver can store the `ARef<Device>` (equivalent to storing a 33 - /// `struct device` pointer in a C driver) for arbitrary purposes, e.g. allocating DMA coherent 34 - /// memory. 35 /// 36 /// # Invariants 37 /// ··· 149 /// 150 /// `bindings::device::release` is valid to be called from any thread, hence `ARef<Device>` can be 151 /// dropped from any thread. 152 #[repr(transparent)] 153 pub struct Device<Ctx: DeviceContext = Normal>(Opaque<bindings::device>, PhantomData<Ctx>); 154 ··· 424 // synchronization in `struct device`. 425 unsafe impl Sync for Device {} 426 427 - /// Marker trait for the context of a bus specific device. 428 /// 429 - /// Some functions of a bus specific device should only be called from a certain context, i.e. bus 430 - /// callbacks, such as `probe()`. 431 /// 432 - /// This is the marker trait for structures representing the context of a bus specific device. 433 pub trait DeviceContext: private::Sealed {} 434 435 - /// The [`Normal`] context is the context of a bus specific device when it is not an argument of 436 - /// any bus callback. 437 pub struct Normal; 438 439 - /// The [`Core`] context is the context of a bus specific device when it is supplied as argument of 440 - /// any of the bus callbacks, such as `probe()`. 441 pub struct Core; 442 443 - /// Semantically the same as [`Core`] but reserved for internal usage of the corresponding bus 444 /// abstraction. 445 pub struct CoreInternal; 446 447 - /// The [`Bound`] context is the context of a bus specific device reference when it is guaranteed to 448 - /// be bound for the duration of its lifetime. 449 pub struct Bound; 450 451 mod private {
··· 15 16 pub mod property; 17 18 + /// The core representation of a device in the kernel's driver model. 19 /// 20 + /// This structure represents the Rust abstraction for a C `struct device`. A [`Device`] can either 21 + /// exist as temporary reference (see also [`Device::from_raw`]), which is only valid within a 22 + /// certain scope or as [`ARef<Device>`], owning a dedicated reference count. 23 /// 24 + /// # Device Types 25 /// 26 + /// A [`Device`] can represent either a bus device or a class device. 27 /// 28 + /// ## Bus Devices 29 + /// 30 + /// A bus device is a [`Device`] that is associated with a physical or virtual bus. Examples of 31 + /// buses include PCI, USB, I2C, and SPI. Devices attached to a bus are registered with a specific 32 + /// bus type, which facilitates matching devices with appropriate drivers based on IDs or other 33 + /// identifying information. Bus devices are visible in sysfs under `/sys/bus/<bus-name>/devices/`. 34 + /// 35 + /// ## Class Devices 36 + /// 37 + /// A class device is a [`Device`] that is associated with a logical category of functionality 38 + /// rather than a physical bus. Examples of classes include block devices, network interfaces, sound 39 + /// cards, and input devices. Class devices are grouped under a common class and exposed to 40 + /// userspace via entries in `/sys/class/<class-name>/`. 41 + /// 42 + /// # Device Context 43 + /// 44 + /// [`Device`] references are generic over a [`DeviceContext`], which represents the type state of 45 + /// a [`Device`]. 46 + /// 47 + /// As the name indicates, this type state represents the context of the scope the [`Device`] 48 + /// reference is valid in. For instance, the [`Bound`] context guarantees that the [`Device`] is 49 + /// bound to a driver for the entire duration of the existence of a [`Device<Bound>`] reference. 50 + /// 51 + /// Other [`DeviceContext`] types besides [`Bound`] are [`Normal`], [`Core`] and [`CoreInternal`]. 52 + /// 53 + /// Unless selected otherwise [`Device`] defaults to the [`Normal`] [`DeviceContext`], which by 54 + /// itself has no additional requirements. 55 + /// 56 + /// It is always up to the caller of [`Device::from_raw`] to select the correct [`DeviceContext`] 57 + /// type for the corresponding scope the [`Device`] reference is created in. 58 + /// 59 + /// All [`DeviceContext`] types other than [`Normal`] are intended to be used with 60 + /// [bus devices](#bus-devices) only. 61 + /// 62 + /// # Implementing Bus Devices 63 + /// 64 + /// This section provides a guideline to implement bus specific devices, such as [`pci::Device`] or 65 + /// [`platform::Device`]. 66 + /// 67 + /// A bus specific device should be defined as follows. 68 + /// 69 + /// ```ignore 70 + /// #[repr(transparent)] 71 + /// pub struct Device<Ctx: device::DeviceContext = device::Normal>( 72 + /// Opaque<bindings::bus_device_type>, 73 + /// PhantomData<Ctx>, 74 + /// ); 75 + /// ``` 76 + /// 77 + /// Since devices are reference counted, [`AlwaysRefCounted`] should be implemented for `Device` 78 + /// (i.e. `Device<Normal>`). Note that [`AlwaysRefCounted`] must not be implemented for any other 79 + /// [`DeviceContext`], since all other device context types are only valid within a certain scope. 80 + /// 81 + /// In order to be able to implement the [`DeviceContext`] dereference hierarchy, bus device 82 + /// implementations should call the [`impl_device_context_deref`] macro as shown below. 83 + /// 84 + /// ```ignore 85 + /// // SAFETY: `Device` is a transparent wrapper of a type that doesn't depend on `Device`'s 86 + /// // generic argument. 87 + /// kernel::impl_device_context_deref!(unsafe { Device }); 88 + /// ``` 89 + /// 90 + /// In order to convert from a any [`Device<Ctx>`] to [`ARef<Device>`], bus devices can implement 91 + /// the following macro call. 92 + /// 93 + /// ```ignore 94 + /// kernel::impl_device_context_into_aref!(Device); 95 + /// ``` 96 + /// 97 + /// Bus devices should also implement the following [`AsRef`] implementation, such that users can 98 + /// easily derive a generic [`Device`] reference. 99 + /// 100 + /// ```ignore 101 + /// impl<Ctx: device::DeviceContext> AsRef<device::Device<Ctx>> for Device<Ctx> { 102 + /// fn as_ref(&self) -> &device::Device<Ctx> { 103 + /// ... 104 + /// } 105 + /// } 106 + /// ``` 107 + /// 108 + /// # Implementing Class Devices 109 + /// 110 + /// Class device implementations require less infrastructure and depend slightly more on the 111 + /// specific subsystem. 112 + /// 113 + /// An example implementation for a class device could look like this. 114 + /// 115 + /// ```ignore 116 + /// #[repr(C)] 117 + /// pub struct Device<T: class::Driver> { 118 + /// dev: Opaque<bindings::class_device_type>, 119 + /// data: T::Data, 120 + /// } 121 + /// ``` 122 + /// 123 + /// This class device uses the sub-classing pattern to embed the driver's private data within the 124 + /// allocation of the class device. For this to be possible the class device is generic over the 125 + /// class specific `Driver` trait implementation. 126 + /// 127 + /// Just like any device, class devices are reference counted and should hence implement 128 + /// [`AlwaysRefCounted`] for `Device`. 129 + /// 130 + /// Class devices should also implement the following [`AsRef`] implementation, such that users can 131 + /// easily derive a generic [`Device`] reference. 132 + /// 133 + /// ```ignore 134 + /// impl<T: class::Driver> AsRef<device::Device> for Device<T> { 135 + /// fn as_ref(&self) -> &device::Device { 136 + /// ... 137 + /// } 138 + /// } 139 + /// ``` 140 + /// 141 + /// An example for a class device implementation is [`drm::Device`]. 142 /// 143 /// # Invariants 144 /// ··· 42 /// 43 /// `bindings::device::release` is valid to be called from any thread, hence `ARef<Device>` can be 44 /// dropped from any thread. 45 + /// 46 + /// [`AlwaysRefCounted`]: kernel::types::AlwaysRefCounted 47 + /// [`drm::Device`]: kernel::drm::Device 48 + /// [`impl_device_context_deref`]: kernel::impl_device_context_deref 49 + /// [`pci::Device`]: kernel::pci::Device 50 + /// [`platform::Device`]: kernel::platform::Device 51 #[repr(transparent)] 52 pub struct Device<Ctx: DeviceContext = Normal>(Opaque<bindings::device>, PhantomData<Ctx>); 53 ··· 311 // synchronization in `struct device`. 312 unsafe impl Sync for Device {} 313 314 + /// Marker trait for the context or scope of a bus specific device. 315 /// 316 + /// [`DeviceContext`] is a marker trait for types representing the context of a bus specific 317 + /// [`Device`]. 318 /// 319 + /// The specific device context types are: [`CoreInternal`], [`Core`], [`Bound`] and [`Normal`]. 320 + /// 321 + /// [`DeviceContext`] types are hierarchical, which means that there is a strict hierarchy that 322 + /// defines which [`DeviceContext`] type can be derived from another. For instance, any 323 + /// [`Device<Core>`] can dereference to a [`Device<Bound>`]. 324 + /// 325 + /// The following enumeration illustrates the dereference hierarchy of [`DeviceContext`] types. 326 + /// 327 + /// - [`CoreInternal`] => [`Core`] => [`Bound`] => [`Normal`] 328 + /// 329 + /// Bus devices can automatically implement the dereference hierarchy by using 330 + /// [`impl_device_context_deref`]. 331 + /// 332 + /// Note that the guarantee for a [`Device`] reference to have a certain [`DeviceContext`] comes 333 + /// from the specific scope the [`Device`] reference is valid in. 334 + /// 335 + /// [`impl_device_context_deref`]: kernel::impl_device_context_deref 336 pub trait DeviceContext: private::Sealed {} 337 338 + /// The [`Normal`] context is the default [`DeviceContext`] of any [`Device`]. 339 + /// 340 + /// The normal context does not indicate any specific context. Any `Device<Ctx>` is also a valid 341 + /// [`Device<Normal>`]. It is the only [`DeviceContext`] for which it is valid to implement 342 + /// [`AlwaysRefCounted`] for. 343 + /// 344 + /// [`AlwaysRefCounted`]: kernel::types::AlwaysRefCounted 345 pub struct Normal; 346 347 + /// The [`Core`] context is the context of a bus specific device when it appears as argument of 348 + /// any bus specific callback, such as `probe()`. 349 + /// 350 + /// The core context indicates that the [`Device<Core>`] reference's scope is limited to the bus 351 + /// callback it appears in. It is intended to be used for synchronization purposes. Bus device 352 + /// implementations can implement methods for [`Device<Core>`], such that they can only be called 353 + /// from bus callbacks. 354 pub struct Core; 355 356 + /// Semantically the same as [`Core`], but reserved for internal usage of the corresponding bus 357 /// abstraction. 358 + /// 359 + /// The internal core context is intended to be used in exactly the same way as the [`Core`] 360 + /// context, with the difference that this [`DeviceContext`] is internal to the corresponding bus 361 + /// abstraction. 362 + /// 363 + /// This context mainly exists to share generic [`Device`] infrastructure that should only be called 364 + /// from bus callbacks with bus abstractions, but without making them accessible for drivers. 365 pub struct CoreInternal; 366 367 + /// The [`Bound`] context is the [`DeviceContext`] of a bus specific device when it is guaranteed to 368 + /// be bound to a driver. 369 + /// 370 + /// The bound context indicates that for the entire duration of the lifetime of a [`Device<Bound>`] 371 + /// reference, the [`Device`] is guaranteed to be bound to a driver. 372 + /// 373 + /// Some APIs, such as [`dma::CoherentAllocation`] or [`Devres`] rely on the [`Device`] to be bound, 374 + /// which can be proven with the [`Bound`] device context. 375 + /// 376 + /// Any abstraction that can guarantee a scope where the corresponding bus device is bound, should 377 + /// provide a [`Device<Bound>`] reference to its users for this scope. This allows users to benefit 378 + /// from optimizations for accessing device resources, see also [`Devres::access`]. 379 + /// 380 + /// [`Devres`]: kernel::devres::Devres 381 + /// [`Devres::access`]: kernel::devres::Devres::access 382 + /// [`dma::CoherentAllocation`]: kernel::dma::CoherentAllocation 383 pub struct Bound; 384 385 mod private {
+18 -9
rust/kernel/devres.rs
··· 115 /// Contains all the fields shared with [`Self::callback`]. 116 // TODO: Replace with `UnsafePinned`, once available. 117 // 118 - // Subsequently, the `drop_in_place()` in `Devres::drop` and the explicit `Send` and `Sync' 119 - // impls can be removed. 120 #[pin] 121 inner: Opaque<Inner<T>>, 122 } 123 124 impl<T: Send> Devres<T> { ··· 141 dev: dev.into(), 142 callback, 143 // INVARIANT: `inner` is properly initialized. 144 - inner <- { 145 // SAFETY: `this` is a valid pointer to uninitialized memory. 146 let inner = unsafe { &raw mut (*this.as_ptr()).inner }; 147 ··· 161 // live at least as long as the returned `impl PinInit<Self, Error>`. 162 to_result(unsafe { 163 bindings::devm_add_action(dev.as_raw(), Some(callback), inner.cast()) 164 - })?; 165 166 - Opaque::pin_init(try_pin_init!(Inner { 167 - devm <- Completion::new(), 168 - revoke <- Completion::new(), 169 - data <- Revocable::new(data), 170 - })) 171 }, 172 }) 173 }
··· 115 /// Contains all the fields shared with [`Self::callback`]. 116 // TODO: Replace with `UnsafePinned`, once available. 117 // 118 + // Subsequently, the `drop_in_place()` in `Devres::drop` and `Devres::new` as well as the 119 + // explicit `Send` and `Sync' impls can be removed. 120 #[pin] 121 inner: Opaque<Inner<T>>, 122 + _add_action: (), 123 } 124 125 impl<T: Send> Devres<T> { ··· 140 dev: dev.into(), 141 callback, 142 // INVARIANT: `inner` is properly initialized. 143 + inner <- Opaque::pin_init(try_pin_init!(Inner { 144 + devm <- Completion::new(), 145 + revoke <- Completion::new(), 146 + data <- Revocable::new(data), 147 + })), 148 + // TODO: Replace with "initializer code blocks" [1] once available. 149 + // 150 + // [1] https://github.com/Rust-for-Linux/pin-init/pull/69 151 + _add_action: { 152 // SAFETY: `this` is a valid pointer to uninitialized memory. 153 let inner = unsafe { &raw mut (*this.as_ptr()).inner }; 154 ··· 152 // live at least as long as the returned `impl PinInit<Self, Error>`. 153 to_result(unsafe { 154 bindings::devm_add_action(dev.as_raw(), Some(callback), inner.cast()) 155 + }).inspect_err(|_| { 156 + let inner = Opaque::cast_into(inner); 157 158 + // SAFETY: `inner` is a valid pointer to an `Inner<T>` and valid for both reads 159 + // and writes. 160 + unsafe { core::ptr::drop_in_place(inner) }; 161 + })?; 162 }, 163 }) 164 }
+87 -2
rust/kernel/driver.rs
··· 2 3 //! Generic support for drivers of different buses (e.g., PCI, Platform, Amba, etc.). 4 //! 5 - //! Each bus / subsystem is expected to implement [`RegistrationOps`], which allows drivers to 6 - //! register using the [`Registration`] class. 7 8 use crate::error::{Error, Result}; 9 use crate::{acpi, device, of, str::CStr, try_pin_init, types::Opaque, ThisModule};
··· 2 3 //! Generic support for drivers of different buses (e.g., PCI, Platform, Amba, etc.). 4 //! 5 + //! This documentation describes how to implement a bus specific driver API and how to align it with 6 + //! the design of (bus specific) devices. 7 + //! 8 + //! Note: Readers are expected to know the content of the documentation of [`Device`] and 9 + //! [`DeviceContext`]. 10 + //! 11 + //! # Driver Trait 12 + //! 13 + //! The main driver interface is defined by a bus specific driver trait. For instance: 14 + //! 15 + //! ```ignore 16 + //! pub trait Driver: Send { 17 + //! /// The type holding information about each device ID supported by the driver. 18 + //! type IdInfo: 'static; 19 + //! 20 + //! /// The table of OF device ids supported by the driver. 21 + //! const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = None; 22 + //! 23 + //! /// The table of ACPI device ids supported by the driver. 24 + //! const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = None; 25 + //! 26 + //! /// Driver probe. 27 + //! fn probe(dev: &Device<device::Core>, id_info: &Self::IdInfo) -> Result<Pin<KBox<Self>>>; 28 + //! 29 + //! /// Driver unbind (optional). 30 + //! fn unbind(dev: &Device<device::Core>, this: Pin<&Self>) { 31 + //! let _ = (dev, this); 32 + //! } 33 + //! } 34 + //! ``` 35 + //! 36 + //! For specific examples see [`auxiliary::Driver`], [`pci::Driver`] and [`platform::Driver`]. 37 + //! 38 + //! The `probe()` callback should return a `Result<Pin<KBox<Self>>>`, i.e. the driver's private 39 + //! data. The bus abstraction should store the pointer in the corresponding bus device. The generic 40 + //! [`Device`] infrastructure provides common helpers for this purpose on its 41 + //! [`Device<CoreInternal>`] implementation. 42 + //! 43 + //! All driver callbacks should provide a reference to the driver's private data. Once the driver 44 + //! is unbound from the device, the bus abstraction should take back the ownership of the driver's 45 + //! private data from the corresponding [`Device`] and [`drop`] it. 46 + //! 47 + //! All driver callbacks should provide a [`Device<Core>`] reference (see also [`device::Core`]). 48 + //! 49 + //! # Adapter 50 + //! 51 + //! The adapter implementation of a bus represents the abstraction layer between the C bus 52 + //! callbacks and the Rust bus callbacks. It therefore has to be generic over an implementation of 53 + //! the [driver trait](#driver-trait). 54 + //! 55 + //! ```ignore 56 + //! pub struct Adapter<T: Driver>; 57 + //! ``` 58 + //! 59 + //! There's a common [`Adapter`] trait that can be implemented to inherit common driver 60 + //! infrastructure, such as finding the ID info from an [`of::IdTable`] or [`acpi::IdTable`]. 61 + //! 62 + //! # Driver Registration 63 + //! 64 + //! In order to register C driver types (such as `struct platform_driver`) the [adapter](#adapter) 65 + //! should implement the [`RegistrationOps`] trait. 66 + //! 67 + //! This trait implementation can be used to create the actual registration with the common 68 + //! [`Registration`] type. 69 + //! 70 + //! Typically, bus abstractions want to provide a bus specific `module_bus_driver!` macro, which 71 + //! creates a kernel module with exactly one [`Registration`] for the bus specific adapter. 72 + //! 73 + //! The generic driver infrastructure provides a helper for this with the [`module_driver`] macro. 74 + //! 75 + //! # Device IDs 76 + //! 77 + //! Besides the common device ID types, such as [`of::DeviceId`] and [`acpi::DeviceId`], most buses 78 + //! may need to implement their own device ID types. 79 + //! 80 + //! For this purpose the generic infrastructure in [`device_id`] should be used. 81 + //! 82 + //! [`auxiliary::Driver`]: kernel::auxiliary::Driver 83 + //! [`Core`]: device::Core 84 + //! [`Device`]: device::Device 85 + //! [`Device<Core>`]: device::Device<device::Core> 86 + //! [`Device<CoreInternal>`]: device::Device<device::CoreInternal> 87 + //! [`DeviceContext`]: device::DeviceContext 88 + //! [`device_id`]: kernel::device_id 89 + //! [`module_driver`]: kernel::module_driver 90 + //! [`pci::Driver`]: kernel::pci::Driver 91 + //! [`platform::Driver`]: kernel::platform::Driver 92 93 use crate::error::{Error, Result}; 94 use crate::{acpi, device, of, str::CStr, try_pin_init, types::Opaque, ThisModule};
+1 -1
rust/kernel/faux.rs
··· 4 //! 5 //! This module provides bindings for working with faux devices in kernel modules. 6 //! 7 - //! C header: [`include/linux/device/faux.h`] 8 9 use crate::{bindings, device, error::code::*, prelude::*}; 10 use core::ptr::{addr_of_mut, null, null_mut, NonNull};
··· 4 //! 5 //! This module provides bindings for working with faux devices in kernel modules. 6 //! 7 + //! C header: [`include/linux/device/faux.h`](srctree/include/linux/device/faux.h) 8 9 use crate::{bindings, device, error::code::*, prelude::*}; 10 use core::ptr::{addr_of_mut, null, null_mut, NonNull};