drivers/accel/drm_accel.c
Source file repositories/reference/linux-study-clean/drivers/accel/drm_accel.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/accel/drm_accel.c- Extension
.c- Size
- 4814 bytes
- Lines
- 209
- Domain
- Driver Families
- Bucket
- drivers/accel
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/device.hlinux/xarray.hdrm/drm_accel.hdrm/drm_auth.hdrm/drm_debugfs.hdrm/drm_drv.hdrm/drm_file.hdrm/drm_ioctl.hdrm/drm_print.h
Detected Declarations
function accel_sysfs_initfunction accel_sysfs_destroyfunction accel_name_infofunction accel_debugfs_registerfunction accel_set_device_instance_paramsfunction accel_openfunction accel_stub_openfunction accel_core_exitfunction accel_core_initexport accel_open
Annotated Snippet
const struct file_operations *new_fops;
struct drm_minor *minor;
int err;
minor = drm_minor_acquire(&accel_minors_xa, iminor(inode));
if (IS_ERR(minor))
return PTR_ERR(minor);
new_fops = fops_get(minor->dev->driver->fops);
if (!new_fops) {
err = -ENODEV;
goto out;
}
replace_fops(filp, new_fops);
if (filp->f_op->open)
err = filp->f_op->open(inode, filp);
else
err = 0;
out:
drm_minor_release(minor);
return err;
}
static const struct file_operations accel_stub_fops = {
.owner = THIS_MODULE,
.open = accel_stub_open,
.llseek = noop_llseek,
};
void accel_core_exit(void)
{
unregister_chrdev(ACCEL_MAJOR, "accel");
accel_sysfs_destroy();
WARN_ON(!xa_empty(&accel_minors_xa));
}
int __init accel_core_init(void)
{
int ret;
ret = accel_sysfs_init();
if (ret < 0) {
DRM_ERROR("Cannot create ACCEL class: %d\n", ret);
goto error;
}
ret = register_chrdev(ACCEL_MAJOR, "accel", &accel_stub_fops);
if (ret < 0)
DRM_ERROR("Cannot register ACCEL major: %d\n", ret);
error:
/*
* Any cleanup due to errors will be done in drm_core_exit() that
* will call accel_core_exit()
*/
return ret;
}
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/device.h`, `linux/xarray.h`, `drm/drm_accel.h`, `drm/drm_auth.h`, `drm/drm_debugfs.h`, `drm/drm_drv.h`, `drm/drm_file.h`.
- Detected declarations: `function accel_sysfs_init`, `function accel_sysfs_destroy`, `function accel_name_info`, `function accel_debugfs_register`, `function accel_set_device_instance_params`, `function accel_open`, `function accel_stub_open`, `function accel_core_exit`, `function accel_core_init`, `export accel_open`.
- Atlas domain: Driver Families / drivers/accel.
- Implementation status: pattern implementation candidate.
- 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.