drivers/platform/x86/lenovo/wmi-helpers.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/lenovo/wmi-helpers.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/lenovo/wmi-helpers.c- Extension
.c- Size
- 5900 bytes
- Lines
- 191
- Domain
- Driver Families
- Bucket
- drivers/platform
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/cleanup.hlinux/errno.hlinux/export.hlinux/module.hlinux/notifier.hlinux/unaligned.hlinux/wmi.hwmi-helpers.h
Detected Declarations
function lwmi_dev_evaluate_intfunction lwmi_tm_register_notifierfunction lwmi_tm_unregister_notifierfunction devm_lwmi_tm_unregister_notifierfunction devm_lwmi_tm_register_notifierfunction lwmi_tm_notifier_call
Annotated Snippet
switch (ret_obj->type) {
/*
* The ACPI method may simply return a buffer when a u32
* is expected. This is valid on Windows as its WMI-ACPI
* driver converts everything to a common buffer.
*/
case ACPI_TYPE_BUFFER:
if (ret_obj->buffer.length < sizeof(u32))
return -ENXIO;
*retval = get_unaligned_le32(ret_obj->buffer.pointer);
return 0;
case ACPI_TYPE_INTEGER:
*retval = (u32)ret_obj->integer.value;
return 0;
default:
return -ENXIO;
}
}
return 0;
};
EXPORT_SYMBOL_NS_GPL(lwmi_dev_evaluate_int, "LENOVO_WMI_HELPERS");
/**
* lwmi_tm_register_notifier() - Add a notifier to the blocking notifier chain
* @nb: The notifier_block struct to register
*
* Call blocking_notifier_chain_register to register the notifier block to the
* thermal mode notifier chain.
*
* Return: 0 on success, %-EEXIST on error.
*/
int lwmi_tm_register_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_register(&tm_chain_head, nb);
}
EXPORT_SYMBOL_NS_GPL(lwmi_tm_register_notifier, "LENOVO_WMI_HELPERS");
/**
* lwmi_tm_unregister_notifier() - Remove a notifier from the blocking notifier
* chain.
* @nb: The notifier_block struct to register
*
* Call blocking_notifier_chain_unregister to unregister the notifier block from the
* thermal mode notifier chain.
*
* Return: 0 on success, %-ENOENT on error.
*/
int lwmi_tm_unregister_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_unregister(&tm_chain_head, nb);
}
EXPORT_SYMBOL_NS_GPL(lwmi_tm_unregister_notifier, "LENOVO_WMI_HELPERS");
/**
* devm_lwmi_tm_unregister_notifier() - Remove a notifier from the blocking
* notifier chain.
* @data: Void pointer to the notifier_block struct to register.
*
* Call lwmi_tm_unregister_notifier to unregister the notifier block from the
* thermal mode notifier chain.
*
* Return: 0 on success, %-ENOENT on error.
*/
static void devm_lwmi_tm_unregister_notifier(void *data)
{
struct notifier_block *nb = data;
lwmi_tm_unregister_notifier(nb);
}
/**
* devm_lwmi_tm_register_notifier() - Add a notifier to the blocking notifier
* chain.
* @dev: The parent device of the notifier_block struct.
* @nb: The notifier_block struct to register
*
* Call lwmi_tm_register_notifier to register the notifier block to the
* thermal mode notifier chain. Then add devm_lwmi_tm_unregister_notifier
* as a device managed action to automatically unregister the notifier block
* upon parent device removal.
*
* Return: 0 on success, or an error code.
*/
int devm_lwmi_tm_register_notifier(struct device *dev,
struct notifier_block *nb)
{
int ret;
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/cleanup.h`, `linux/errno.h`, `linux/export.h`, `linux/module.h`, `linux/notifier.h`, `linux/unaligned.h`, `linux/wmi.h`.
- Detected declarations: `function lwmi_dev_evaluate_int`, `function lwmi_tm_register_notifier`, `function lwmi_tm_unregister_notifier`, `function devm_lwmi_tm_unregister_notifier`, `function devm_lwmi_tm_register_notifier`, `function lwmi_tm_notifier_call`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: integration 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.