drivers/watchdog/m54xx_wdt.c
Source file repositories/reference/linux-study-clean/drivers/watchdog/m54xx_wdt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/watchdog/m54xx_wdt.c- Extension
.c- Size
- 5006 bytes
- Lines
- 225
- Domain
- Driver Families
- Bucket
- drivers/watchdog
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/moduleparam.hlinux/types.hlinux/kernel.hlinux/fs.hlinux/miscdevice.hlinux/watchdog.hlinux/init.hlinux/bitops.hlinux/ioport.hlinux/uaccess.hlinux/io.hasm/coldfire.hasm/m54xxsim.hasm/m54xxgpt.h
Detected Declarations
function wdt_enablefunction wdt_disablefunction wdt_keepalivefunction m54xx_wdt_openfunction m54xx_wdt_writefunction m54xx_wdt_ioctlfunction m54xx_wdt_releasefunction m54xx_wdt_initfunction m54xx_wdt_exitmodule init m54xx_wdt_init
Annotated Snippet
static const struct file_operations m54xx_wdt_fops = {
.owner = THIS_MODULE,
.write = m54xx_wdt_write,
.unlocked_ioctl = m54xx_wdt_ioctl,
.compat_ioctl = compat_ptr_ioctl,
.open = m54xx_wdt_open,
.release = m54xx_wdt_release,
};
static struct miscdevice m54xx_wdt_miscdev = {
.minor = WATCHDOG_MINOR,
.name = "watchdog",
.fops = &m54xx_wdt_fops,
};
static int __init m54xx_wdt_init(void)
{
if (!request_mem_region(MCF_GPT_GCIR0, 4, "Coldfire M54xx Watchdog")) {
pr_warn("I/O region busy\n");
return -EBUSY;
}
pr_info("driver is loaded\n");
return misc_register(&m54xx_wdt_miscdev);
}
static void __exit m54xx_wdt_exit(void)
{
misc_deregister(&m54xx_wdt_miscdev);
release_mem_region(MCF_GPT_GCIR0, 4);
}
module_init(m54xx_wdt_init);
module_exit(m54xx_wdt_exit);
MODULE_AUTHOR("Philippe De Muyter <phdm@macqel.be>");
MODULE_DESCRIPTION("Coldfire M54xx Watchdog");
module_param(heartbeat, int, 0);
MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds (default 30s)");
module_param(nowayout, bool, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/types.h`, `linux/kernel.h`, `linux/fs.h`, `linux/miscdevice.h`, `linux/watchdog.h`, `linux/init.h`.
- Detected declarations: `function wdt_enable`, `function wdt_disable`, `function wdt_keepalive`, `function m54xx_wdt_open`, `function m54xx_wdt_write`, `function m54xx_wdt_ioctl`, `function m54xx_wdt_release`, `function m54xx_wdt_init`, `function m54xx_wdt_exit`, `module init m54xx_wdt_init`.
- Atlas domain: Driver Families / drivers/watchdog.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.