drivers/platform/x86/lenovo/wmi-events.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/lenovo/wmi-events.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/lenovo/wmi-events.c- Extension
.c- Size
- 5709 bytes
- Lines
- 198
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/export.hlinux/module.hlinux/notifier.hlinux/types.hlinux/wmi.hwmi-events.hwmi-helpers.h
Detected Declarations
struct lwmi_events_privfunction lwmi_events_register_notifierfunction lwmi_events_unregister_notifierfunction devm_lwmi_events_unregister_notifierfunction devm_lwmi_events_register_notifierfunction lwmi_events_notifyfunction lwmi_events_probe
Annotated Snippet
struct lwmi_events_priv {
struct wmi_device *wdev;
enum lwmi_events_type type;
};
/**
* lwmi_events_register_notifier() - Add a notifier to the notifier chain.
* @nb: The notifier_block struct to register
*
* Call blocking_notifier_chain_register to register the notifier block to the
* lenovo-wmi-events driver blocking notifier chain.
*
* Return: 0 on success, %-EEXIST on error.
*/
int lwmi_events_register_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_register(&events_chain_head, nb);
}
EXPORT_SYMBOL_NS_GPL(lwmi_events_register_notifier, "LENOVO_WMI_EVENTS");
/**
* lwmi_events_unregister_notifier() - Remove a notifier from the notifier
* chain.
* @nb: The notifier_block struct to unregister
*
* Call blocking_notifier_chain_unregister to unregister the notifier block
* from the lenovo-wmi-events driver blocking notifier chain.
*
* Return: 0 on success, %-ENOENT on error.
*/
int lwmi_events_unregister_notifier(struct notifier_block *nb)
{
return blocking_notifier_chain_unregister(&events_chain_head, nb);
}
EXPORT_SYMBOL_NS_GPL(lwmi_events_unregister_notifier, "LENOVO_WMI_EVENTS");
/**
* devm_lwmi_events_unregister_notifier() - Remove a notifier from the notifier
* chain.
* @data: Void pointer to the notifier_block struct to unregister.
*
* Call lwmi_events_unregister_notifier to unregister the notifier block from
* the lenovo-wmi-events driver blocking notifier chain.
*
* Return: 0 on success, %-ENOENT on error.
*/
static void devm_lwmi_events_unregister_notifier(void *data)
{
struct notifier_block *nb = data;
lwmi_events_unregister_notifier(nb);
}
/**
* devm_lwmi_events_register_notifier() - Add a notifier to the notifier chain.
* @dev: The parent device of the notifier_block struct.
* @nb: The notifier_block struct to register
*
* Call lwmi_events_register_notifier to register the notifier block to the
* lenovo-wmi-events driver blocking notifier chain. Then add, as a device
* managed action, unregister_notifier to automatically unregister the
* notifier block upon its parent device removal.
*
* Return: 0 on success, or an error code.
*/
int devm_lwmi_events_register_notifier(struct device *dev,
struct notifier_block *nb)
{
int ret;
ret = lwmi_events_register_notifier(nb);
if (ret < 0)
return ret;
return devm_add_action_or_reset(dev, devm_lwmi_events_unregister_notifier, nb);
}
EXPORT_SYMBOL_NS_GPL(devm_lwmi_events_register_notifier, "LENOVO_WMI_EVENTS");
/**
* lwmi_events_notify() - Call functions for the notifier call chain.
* @wdev: The parent WMI device of the driver.
* @obj: ACPI object passed by the registered WMI Event.
*
* Validate WMI event data and notify all registered drivers of the event and
* its output.
*
* Return: 0 on success, or an error code.
*/
static void lwmi_events_notify(struct wmi_device *wdev, union acpi_object *obj)
{
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/export.h`, `linux/module.h`, `linux/notifier.h`, `linux/types.h`, `linux/wmi.h`, `wmi-events.h`, `wmi-helpers.h`.
- Detected declarations: `struct lwmi_events_priv`, `function lwmi_events_register_notifier`, `function lwmi_events_unregister_notifier`, `function devm_lwmi_events_unregister_notifier`, `function devm_lwmi_events_register_notifier`, `function lwmi_events_notify`, `function lwmi_events_probe`.
- 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.