kernel/power/suspend_test.c
Source file repositories/reference/linux-study-clean/kernel/power/suspend_test.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/power/suspend_test.c- Extension
.c- Size
- 5857 bytes
- Lines
- 220
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/rtc.hpower.h
Detected Declarations
function suspend_test_startfunction suspend_test_finishfunction test_wakealarmfunction has_wakealarmfunction setup_test_suspendfunction test_suspend
Annotated Snippet
if (!strcmp(pm_labels[i], suspend_type)) {
test_state_label = pm_labels[i];
return 1;
}
printk(warn_bad_state, suspend_type);
return 1;
}
__setup("test_suspend", setup_test_suspend);
static int __init test_suspend(void)
{
static char warn_no_rtc[] __initdata =
KERN_WARNING "PM: no wakealarm-capable RTC driver is ready\n";
struct rtc_device *rtc = NULL;
struct device *dev;
suspend_state_t test_state;
/* PM is initialized by now; is that state testable? */
if (!test_state_label)
return 0;
for (test_state = PM_SUSPEND_MIN; test_state < PM_SUSPEND_MAX; test_state++) {
const char *state_label = pm_states[test_state];
if (state_label && !strcmp(test_state_label, state_label))
break;
}
if (test_state == PM_SUSPEND_MAX) {
printk(warn_bad_state, test_state_label);
return 0;
}
/* RTCs have initialized by now too ... can we use one? */
dev = class_find_device(&rtc_class, NULL, NULL, has_wakealarm);
if (dev) {
rtc = rtc_class_open(dev_name(dev));
put_device(dev);
}
if (!rtc) {
printk(warn_no_rtc);
return 0;
}
/* go for it */
test_wakealarm(rtc, test_state);
rtc_class_close(rtc);
return 0;
}
late_initcall(test_suspend);
Annotation
- Immediate include surface: `linux/init.h`, `linux/rtc.h`, `power.h`.
- Detected declarations: `function suspend_test_start`, `function suspend_test_finish`, `function test_wakealarm`, `function has_wakealarm`, `function setup_test_suspend`, `function test_suspend`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- 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.