drivers/bus/fsl-mc/fsl-mc-uapi.c
Source file repositories/reference/linux-study-clean/drivers/bus/fsl-mc/fsl-mc-uapi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/bus/fsl-mc/fsl-mc-uapi.c- Extension
.c- Size
- 12869 bytes
- Lines
- 605
- Domain
- Driver Families
- Bucket
- drivers/bus
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/slab.hlinux/fs.hlinux/uaccess.hlinux/miscdevice.hfsl-mc-private.h
Detected Declarations
struct uapi_priv_datastruct fsl_mc_cmd_descenum fsl_mc_cmd_indexfunction fsl_mc_command_checkfunction fsl_mc_uapi_send_commandfunction fsl_mc_uapi_dev_openfunction fsl_mc_uapi_dev_releasefunction fsl_mc_uapi_dev_ioctlfunction fsl_mc_uapi_create_device_filefunction fsl_mc_uapi_remove_device_file
Annotated Snippet
static const struct file_operations fsl_mc_uapi_dev_fops = {
.owner = THIS_MODULE,
.open = fsl_mc_uapi_dev_open,
.release = fsl_mc_uapi_dev_release,
.unlocked_ioctl = fsl_mc_uapi_dev_ioctl,
};
int fsl_mc_uapi_create_device_file(struct fsl_mc_bus *mc_bus)
{
struct fsl_mc_device *mc_dev = &mc_bus->mc_dev;
struct fsl_mc_uapi *mc_uapi = &mc_bus->uapi_misc;
int error;
mc_uapi->misc.minor = MISC_DYNAMIC_MINOR;
mc_uapi->misc.name = dev_name(&mc_dev->dev);
mc_uapi->misc.fops = &fsl_mc_uapi_dev_fops;
error = misc_register(&mc_uapi->misc);
if (error)
return error;
mc_uapi->static_mc_io = mc_bus->mc_dev.mc_io;
mutex_init(&mc_uapi->mutex);
return 0;
}
void fsl_mc_uapi_remove_device_file(struct fsl_mc_bus *mc_bus)
{
misc_deregister(&mc_bus->uapi_misc.misc);
}
Annotation
- Immediate include surface: `linux/slab.h`, `linux/fs.h`, `linux/uaccess.h`, `linux/miscdevice.h`, `fsl-mc-private.h`.
- Detected declarations: `struct uapi_priv_data`, `struct fsl_mc_cmd_desc`, `enum fsl_mc_cmd_index`, `function fsl_mc_command_check`, `function fsl_mc_uapi_send_command`, `function fsl_mc_uapi_dev_open`, `function fsl_mc_uapi_dev_release`, `function fsl_mc_uapi_dev_ioctl`, `function fsl_mc_uapi_create_device_file`, `function fsl_mc_uapi_remove_device_file`.
- Atlas domain: Driver Families / drivers/bus.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.