drivers/video/fbdev/core/fb_chrdev.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/core/fb_chrdev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/core/fb_chrdev.c- Extension
.c- Size
- 9973 bytes
- Lines
- 439
- Domain
- Driver Families
- Bucket
- drivers/video
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/compat.hlinux/console.hlinux/fb.hlinux/major.hfb_internal.hfbcon.h
Detected Declarations
struct fb_fix_screeninfo32struct fb_cmap32function fb_readfunction fb_writefunction do_fb_ioctlfunction fb_ioctlfunction fb_getput_cmapfunction do_fscreeninfo_to_userfunction fb_get_fscreeninfofunction fb_compat_ioctlfunction fb_mmapfunction fb_openfunction fb_releasefunction get_fb_unmapped_areafunction fb_register_chrdevfunction fb_unregister_chrdev
Annotated Snippet
static const struct file_operations fb_fops = {
.owner = THIS_MODULE,
.read = fb_read,
.write = fb_write,
.unlocked_ioctl = fb_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = fb_compat_ioctl,
#endif
.mmap = fb_mmap,
.open = fb_open,
.release = fb_release,
#if defined(HAVE_ARCH_FB_UNMAPPED_AREA) || \
(defined(CONFIG_FB_PROVIDE_GET_FB_UNMAPPED_AREA) && \
!defined(CONFIG_MMU))
.get_unmapped_area = get_fb_unmapped_area,
#endif
#ifdef CONFIG_FB_DEFERRED_IO
.fsync = fb_deferred_io_fsync,
#endif
.llseek = default_llseek,
};
int fb_register_chrdev(void)
{
int ret;
ret = register_chrdev(FB_MAJOR, "fb", &fb_fops);
if (ret) {
pr_err("Unable to get major %d for fb devs\n", FB_MAJOR);
return ret;
}
return ret;
}
void fb_unregister_chrdev(void)
{
unregister_chrdev(FB_MAJOR, "fb");
}
Annotation
- Immediate include surface: `linux/compat.h`, `linux/console.h`, `linux/fb.h`, `linux/major.h`, `fb_internal.h`, `fbcon.h`.
- Detected declarations: `struct fb_fix_screeninfo32`, `struct fb_cmap32`, `function fb_read`, `function fb_write`, `function do_fb_ioctl`, `function fb_ioctl`, `function fb_getput_cmap`, `function do_fscreeninfo_to_user`, `function fb_get_fscreeninfo`, `function fb_compat_ioctl`.
- Atlas domain: Driver Families / drivers/video.
- 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.