drivers/watchdog/watchdog_hrtimer_pretimeout.c
Source file repositories/reference/linux-study-clean/drivers/watchdog/watchdog_hrtimer_pretimeout.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/watchdog/watchdog_hrtimer_pretimeout.c- Extension
.c- Size
- 1226 bytes
- Lines
- 45
- Domain
- Driver Families
- Bucket
- drivers/watchdog
- Inferred role
- Driver Families: implementation source
- Status
- source 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 or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/hrtimer.hlinux/watchdog.hwatchdog_core.hwatchdog_pretimeout.h
Detected Declarations
function watchdog_hrtimer_pretimeoutfunction watchdog_hrtimer_pretimeout_initfunction watchdog_hrtimer_pretimeout_startfunction watchdog_hrtimer_pretimeout_stop
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* (c) Copyright 2021 Hewlett Packard Enterprise Development LP.
*/
#include <linux/hrtimer.h>
#include <linux/watchdog.h>
#include "watchdog_core.h"
#include "watchdog_pretimeout.h"
static enum hrtimer_restart watchdog_hrtimer_pretimeout(struct hrtimer *timer)
{
struct watchdog_core_data *wd_data;
wd_data = container_of(timer, struct watchdog_core_data, pretimeout_timer);
watchdog_notify_pretimeout(wd_data->wdd);
return HRTIMER_NORESTART;
}
void watchdog_hrtimer_pretimeout_init(struct watchdog_device *wdd)
{
struct watchdog_core_data *wd_data = wdd->wd_data;
hrtimer_setup(&wd_data->pretimeout_timer, watchdog_hrtimer_pretimeout, CLOCK_MONOTONIC,
HRTIMER_MODE_REL);
}
void watchdog_hrtimer_pretimeout_start(struct watchdog_device *wdd)
{
if (!(wdd->info->options & WDIOF_PRETIMEOUT) &&
!watchdog_pretimeout_invalid(wdd, wdd->pretimeout))
hrtimer_start(&wdd->wd_data->pretimeout_timer,
ktime_set(wdd->timeout - wdd->pretimeout, 0),
HRTIMER_MODE_REL);
else
hrtimer_cancel(&wdd->wd_data->pretimeout_timer);
}
void watchdog_hrtimer_pretimeout_stop(struct watchdog_device *wdd)
{
hrtimer_cancel(&wdd->wd_data->pretimeout_timer);
}
Annotation
- Immediate include surface: `linux/hrtimer.h`, `linux/watchdog.h`, `watchdog_core.h`, `watchdog_pretimeout.h`.
- Detected declarations: `function watchdog_hrtimer_pretimeout`, `function watchdog_hrtimer_pretimeout_init`, `function watchdog_hrtimer_pretimeout_start`, `function watchdog_hrtimer_pretimeout_stop`.
- Atlas domain: Driver Families / drivers/watchdog.
- Implementation status: source implementation candidate.
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.