drivers/watchdog/sbc_epx_c3.c
Source file repositories/reference/linux-study-clean/drivers/watchdog/sbc_epx_c3.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/watchdog/sbc_epx_c3.c- Extension
.c- Size
- 4916 bytes
- Lines
- 219
- 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/mm.hlinux/miscdevice.hlinux/watchdog.hlinux/notifier.hlinux/reboot.hlinux/init.hlinux/ioport.hlinux/uaccess.hlinux/io.h
Detected Declarations
function epx_c3_startfunction epx_c3_stopfunction epx_c3_petfunction epx_c3_openfunction epx_c3_releasefunction epx_c3_writefunction epx_c3_ioctlfunction epx_c3_notify_sysfunction watchdog_initfunction watchdog_exitmodule init watchdog_init
Annotated Snippet
static const struct file_operations epx_c3_fops = {
.owner = THIS_MODULE,
.write = epx_c3_write,
.unlocked_ioctl = epx_c3_ioctl,
.compat_ioctl = compat_ptr_ioctl,
.open = epx_c3_open,
.release = epx_c3_release,
};
static struct miscdevice epx_c3_miscdev = {
.minor = WATCHDOG_MINOR,
.name = "watchdog",
.fops = &epx_c3_fops,
};
static struct notifier_block epx_c3_notifier = {
.notifier_call = epx_c3_notify_sys,
};
static int __init watchdog_init(void)
{
int ret;
if (!request_region(EPXC3_WATCHDOG_CTL_REG, 2, "epxc3_watchdog"))
return -EBUSY;
ret = register_reboot_notifier(&epx_c3_notifier);
if (ret) {
pr_err("cannot register reboot notifier (err=%d)\n", ret);
goto out;
}
ret = misc_register(&epx_c3_miscdev);
if (ret) {
pr_err("cannot register miscdev on minor=%d (err=%d)\n",
WATCHDOG_MINOR, ret);
unregister_reboot_notifier(&epx_c3_notifier);
goto out;
}
pr_info("Hardware Watchdog Timer for Winsystems EPX-C3 SBC: 0.1\n");
return 0;
out:
release_region(EPXC3_WATCHDOG_CTL_REG, 2);
return ret;
}
static void __exit watchdog_exit(void)
{
misc_deregister(&epx_c3_miscdev);
unregister_reboot_notifier(&epx_c3_notifier);
release_region(EPXC3_WATCHDOG_CTL_REG, 2);
}
module_init(watchdog_init);
module_exit(watchdog_exit);
MODULE_AUTHOR("Calin A. Culianu <calin@ajvar.org>");
MODULE_DESCRIPTION("Hardware Watchdog Device for Winsystems EPX-C3 SBC. "
"Note that there is no way to probe for this device -- "
"so only use it if you are *sure* you are running on this specific "
"SBC system from Winsystems! It writes to IO ports 0x1ee and 0x1ef!");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/types.h`, `linux/kernel.h`, `linux/fs.h`, `linux/mm.h`, `linux/miscdevice.h`, `linux/watchdog.h`.
- Detected declarations: `function epx_c3_start`, `function epx_c3_stop`, `function epx_c3_pet`, `function epx_c3_open`, `function epx_c3_release`, `function epx_c3_write`, `function epx_c3_ioctl`, `function epx_c3_notify_sys`, `function watchdog_init`, `function watchdog_exit`.
- 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.