drivers/sbus/char/openprom.c
Source file repositories/reference/linux-study-clean/drivers/sbus/char/openprom.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/sbus/char/openprom.c- Extension
.c- Size
- 15312 bytes
- Lines
- 726
- Domain
- Driver Families
- Bucket
- drivers/sbus
- 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/module.hlinux/kernel.hlinux/errno.hlinux/slab.hlinux/mutex.hlinux/string.hlinux/miscdevice.hlinux/init.hlinux/fs.hasm/oplib.hasm/prom.hlinux/uaccess.hasm/openpromio.hlinux/pci.h
Detected Declarations
function copyinfunction getstringsfunction copyoutfunction opromgetpropfunction opromnxtpropfunction opromsetoptfunction opromnextfunction oprompci2nodefunction oprompath2nodefunction opromgetbootargsfunction openprom_sunos_ioctlfunction copyin_stringfunction opiocgetfunction opiocnextpropfunction opiocsetfunction opiocgetnextfunction openprom_bsd_ioctlfunction openprom_ioctlfunction openprom_compat_ioctlfunction openprom_openfunction openprom_releasefunction openprom_initfunction openprom_cleanupmodule init openprom_init
Annotated Snippet
static const struct file_operations openprom_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = openprom_ioctl,
.compat_ioctl = openprom_compat_ioctl,
.open = openprom_open,
.release = openprom_release,
};
static struct miscdevice openprom_dev = {
.minor = SUN_OPENPROM_MINOR,
.name = "openprom",
.fops = &openprom_fops,
};
static int __init openprom_init(void)
{
int err;
err = misc_register(&openprom_dev);
if (err)
return err;
options_node = of_get_child_by_name(of_find_node_by_path("/"), "options");
if (!options_node) {
misc_deregister(&openprom_dev);
return -EIO;
}
return 0;
}
static void __exit openprom_cleanup(void)
{
misc_deregister(&openprom_dev);
}
module_init(openprom_init);
module_exit(openprom_cleanup);
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/errno.h`, `linux/slab.h`, `linux/mutex.h`, `linux/string.h`, `linux/miscdevice.h`, `linux/init.h`.
- Detected declarations: `function copyin`, `function getstrings`, `function copyout`, `function opromgetprop`, `function opromnxtprop`, `function opromsetopt`, `function opromnext`, `function oprompci2node`, `function oprompath2node`, `function opromgetbootargs`.
- Atlas domain: Driver Families / drivers/sbus.
- 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.