diff options
| author | Alice Ryhl <[email protected]> | 2024-12-10 09:39:01 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2024-12-16 15:12:30 +0000 |
| commit | 88441d5c6d17211bcbd5b429205b09c25598f756 (patch) | |
| tree | 0355b54a4af11af50d950e8e9b92eb40ee9f58bb /rust/helpers/signal.c | |
| parent | rust: miscdevice: access file in fops (diff) | |
| download | kernel-88441d5c6d17211bcbd5b429205b09c25598f756.tar.gz kernel-88441d5c6d17211bcbd5b429205b09c25598f756.zip | |
rust: miscdevice: access the `struct miscdevice` from fops->open()
Providing access to the underlying `struct miscdevice` is useful for
various reasons. For example, this allows you access the miscdevice's
internal `struct device` for use with the `dev_*` printing macros.
Note that since the underlying `struct miscdevice` could get freed at
any point after the fops->open() call (if misc_deregister is called),
only the open call is given access to it. To use `dev_*` printing macros
from other fops hooks, take a refcount on `miscdevice->this_device` to
keep it alive. See the linked thread for further discussion on the
lifetime of `struct miscdevice`.
Link: https://lore.kernel.org/r/2024120951-botanist-exhale-4845@gregkh
Signed-off-by: Alice Ryhl <[email protected]>
Reviewed-by: Lee Jones <[email protected]>
Tested-by: Lee Jones <[email protected]>
Reviewed-by: Danilo Krummrich <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'rust/helpers/signal.c')
0 files changed, 0 insertions, 0 deletions
