drivers/platform/x86/intel/wmi/thunderbolt.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/intel/wmi/thunderbolt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/intel/wmi/thunderbolt.c- Extension
.c- Size
- 1616 bytes
- Lines
- 72
- Domain
- Driver Families
- Bucket
- drivers/platform
- 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/device.hlinux/fs.hlinux/hex.hlinux/kernel.hlinux/module.hlinux/string.hlinux/sysfs.hlinux/types.hlinux/wmi.h
Detected Declarations
function Copyright
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* WMI Thunderbolt driver
*
* Copyright (C) 2017 Dell Inc. All Rights Reserved.
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/hex.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/sysfs.h>
#include <linux/types.h>
#include <linux/wmi.h>
#define INTEL_WMI_THUNDERBOLT_GUID "86CCFD48-205E-4A77-9C48-2021CBEDE341"
static ssize_t force_power_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct wmi_buffer buffer;
int ret;
u8 mode;
buffer.length = sizeof(mode);
buffer.data = &mode;
mode = hex_to_bin(buf[0]);
if (mode > 1)
return -EINVAL;
ret = wmidev_invoke_procedure(to_wmi_device(dev), 0, 1, &buffer);
if (ret < 0)
return ret;
return count;
}
static DEVICE_ATTR_WO(force_power);
static struct attribute *tbt_attrs[] = {
&dev_attr_force_power.attr,
NULL
};
ATTRIBUTE_GROUPS(tbt);
static const struct wmi_device_id intel_wmi_thunderbolt_id_table[] = {
{ .guid_string = INTEL_WMI_THUNDERBOLT_GUID },
{ },
};
static struct wmi_driver intel_wmi_thunderbolt_driver = {
.driver = {
.name = "intel-wmi-thunderbolt",
.dev_groups = tbt_groups,
},
.id_table = intel_wmi_thunderbolt_id_table,
.no_singleton = true,
};
module_wmi_driver(intel_wmi_thunderbolt_driver);
MODULE_DEVICE_TABLE(wmi, intel_wmi_thunderbolt_id_table);
MODULE_AUTHOR("Mario Limonciello <mario.limonciello@dell.com>");
MODULE_DESCRIPTION("Intel WMI Thunderbolt force power driver");
MODULE_LICENSE("GPL v2");
Annotation
- Immediate include surface: `linux/device.h`, `linux/fs.h`, `linux/hex.h`, `linux/kernel.h`, `linux/module.h`, `linux/string.h`, `linux/sysfs.h`, `linux/types.h`.
- Detected declarations: `function Copyright`.
- Atlas domain: Driver Families / drivers/platform.
- 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.