drivers/misc/pvpanic/pvpanic-mmio.c
Source file repositories/reference/linux-study-clean/drivers/misc/pvpanic/pvpanic-mmio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/pvpanic/pvpanic-mmio.c- Extension
.c- Size
- 1705 bytes
- Lines
- 76
- Domain
- Driver Families
- Bucket
- drivers/misc
- 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/err.hlinux/io.hlinux/ioport.hlinux/kexec.hlinux/mod_devicetable.hlinux/module.hlinux/platform_device.hlinux/types.hpvpanic.h
Detected Declarations
function pvpanic_mmio_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* Pvpanic MMIO Device Support
*
* Copyright (C) 2013 Fujitsu.
* Copyright (C) 2018 ZTE.
* Copyright (C) 2021 Oracle.
*/
#include <linux/device.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/kexec.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/types.h>
#include "pvpanic.h"
MODULE_AUTHOR("Hu Tao <hutao@cn.fujitsu.com>");
MODULE_DESCRIPTION("pvpanic-mmio device driver");
MODULE_LICENSE("GPL");
static int pvpanic_mmio_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct resource *res;
void __iomem *base;
res = platform_get_mem_or_io(pdev, 0);
if (!res)
return -EINVAL;
switch (resource_type(res)) {
case IORESOURCE_IO:
base = devm_ioport_map(dev, res->start, resource_size(res));
if (!base)
return -ENOMEM;
break;
case IORESOURCE_MEM:
base = devm_ioremap_resource(dev, res);
if (IS_ERR(base))
return PTR_ERR(base);
break;
default:
return -EINVAL;
}
return devm_pvpanic_probe(dev, base);
}
static const struct of_device_id pvpanic_mmio_match[] = {
{ .compatible = "qemu,pvpanic-mmio", },
{}
};
MODULE_DEVICE_TABLE(of, pvpanic_mmio_match);
static const struct acpi_device_id pvpanic_device_ids[] = {
{ "QEMU0001", 0 },
{ "", 0 }
};
MODULE_DEVICE_TABLE(acpi, pvpanic_device_ids);
static struct platform_driver pvpanic_mmio_driver = {
.driver = {
.name = "pvpanic-mmio",
.of_match_table = pvpanic_mmio_match,
.acpi_match_table = pvpanic_device_ids,
.dev_groups = pvpanic_dev_groups,
},
.probe = pvpanic_mmio_probe,
};
module_platform_driver(pvpanic_mmio_driver);
Annotation
- Immediate include surface: `linux/device.h`, `linux/err.h`, `linux/io.h`, `linux/ioport.h`, `linux/kexec.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/platform_device.h`.
- Detected declarations: `function pvpanic_mmio_probe`.
- Atlas domain: Driver Families / drivers/misc.
- 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.