drivers/acpi/pfr_telemetry.c
Source file repositories/reference/linux-study-clean/drivers/acpi/pfr_telemetry.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/acpi/pfr_telemetry.c- Extension
.c- Size
- 11872 bytes
- Lines
- 435
- Domain
- Driver Families
- Bucket
- drivers/acpi
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/device.hlinux/err.hlinux/errno.hlinux/file.hlinux/fs.hlinux/miscdevice.hlinux/module.hlinux/mm.hlinux/platform_device.hlinux/string.hlinux/uaccess.hlinux/uio.hlinux/uuid.huapi/linux/pfrut.h
Detected Declarations
struct pfrt_log_deviceenum log_indexfunction get_pfrt_log_data_infofunction set_pfrt_log_levelfunction get_pfrt_log_levelfunction valid_log_levelfunction valid_log_typefunction valid_log_revidfunction pfrt_log_ioctlfunction pfrt_log_mmapfunction acpi_pfrt_log_removefunction pfrt_log_put_idxfunction acpi_pfrt_log_probe
Annotated Snippet
static const struct file_operations acpi_pfrt_log_fops = {
.owner = THIS_MODULE,
.mmap = pfrt_log_mmap,
.unlocked_ioctl = pfrt_log_ioctl,
.llseek = noop_llseek,
};
static void acpi_pfrt_log_remove(struct platform_device *pdev)
{
struct pfrt_log_device *pfrt_log_dev = platform_get_drvdata(pdev);
misc_deregister(&pfrt_log_dev->miscdev);
}
static void pfrt_log_put_idx(void *data)
{
struct pfrt_log_device *pfrt_log_dev = data;
ida_free(&pfrt_log_ida, pfrt_log_dev->index);
}
static int acpi_pfrt_log_probe(struct platform_device *pdev)
{
struct pfrt_log_device *pfrt_log_dev;
acpi_handle handle;
int ret;
handle = ACPI_HANDLE(&pdev->dev);
if (!handle)
return -ENODEV;
if (!acpi_has_method(handle, "_DSM")) {
dev_dbg(&pdev->dev, "Missing _DSM\n");
return -ENODEV;
}
pfrt_log_dev = devm_kzalloc(&pdev->dev, sizeof(*pfrt_log_dev), GFP_KERNEL);
if (!pfrt_log_dev)
return -ENOMEM;
ret = ida_alloc(&pfrt_log_ida, GFP_KERNEL);
if (ret < 0)
return ret;
pfrt_log_dev->index = ret;
ret = devm_add_action_or_reset(&pdev->dev, pfrt_log_put_idx, pfrt_log_dev);
if (ret)
return ret;
pfrt_log_dev->info.log_revid = PFRT_DEFAULT_REV_ID;
pfrt_log_dev->parent_dev = &pdev->dev;
pfrt_log_dev->miscdev.minor = MISC_DYNAMIC_MINOR;
pfrt_log_dev->miscdev.name = devm_kasprintf(&pdev->dev, GFP_KERNEL,
"pfrt%d",
pfrt_log_dev->index);
if (!pfrt_log_dev->miscdev.name)
return -ENOMEM;
pfrt_log_dev->miscdev.nodename = devm_kasprintf(&pdev->dev, GFP_KERNEL,
"acpi_pfr_telemetry%d",
pfrt_log_dev->index);
if (!pfrt_log_dev->miscdev.nodename)
return -ENOMEM;
pfrt_log_dev->miscdev.fops = &acpi_pfrt_log_fops;
pfrt_log_dev->miscdev.parent = &pdev->dev;
ret = misc_register(&pfrt_log_dev->miscdev);
if (ret)
return ret;
platform_set_drvdata(pdev, pfrt_log_dev);
return 0;
}
static const struct acpi_device_id acpi_pfrt_log_ids[] = {
{"INTC1081"},
{}
};
MODULE_DEVICE_TABLE(acpi, acpi_pfrt_log_ids);
static struct platform_driver acpi_pfrt_log_driver = {
.driver = {
.name = "pfr_telemetry",
.acpi_match_table = acpi_pfrt_log_ids,
},
.probe = acpi_pfrt_log_probe,
.remove = acpi_pfrt_log_remove,
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/device.h`, `linux/err.h`, `linux/errno.h`, `linux/file.h`, `linux/fs.h`, `linux/miscdevice.h`, `linux/module.h`.
- Detected declarations: `struct pfrt_log_device`, `enum log_index`, `function get_pfrt_log_data_info`, `function set_pfrt_log_level`, `function get_pfrt_log_level`, `function valid_log_level`, `function valid_log_type`, `function valid_log_revid`, `function pfrt_log_ioctl`, `function pfrt_log_mmap`.
- Atlas domain: Driver Families / drivers/acpi.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.