drivers/perf/hisilicon/hns3_pmu.c

Source file repositories/reference/linux-study-clean/drivers/perf/hisilicon/hns3_pmu.c

File Facts

System
Linux kernel
Corpus path
drivers/perf/hisilicon/hns3_pmu.c
Extension
.c
Size
51592 bytes
Lines
1675
Domain
Driver Families
Bucket
drivers/perf
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.

Dependency Surface

Detected Declarations

Annotated Snippet

static struct pci_driver hns3_pmu_driver = {
	.name = "hns3_pmu",
	.id_table = hns3_pmu_ids,
	.probe = hns3_pmu_probe,
	.remove = hns3_pmu_remove,
};

static int __init hns3_pmu_module_init(void)
{
	int ret;

	ret = cpuhp_setup_state_multi(CPUHP_AP_PERF_ARM_HNS3_PMU_ONLINE,
				      "AP_PERF_ARM_HNS3_PMU_ONLINE",
				      hns3_pmu_online_cpu,
				      hns3_pmu_offline_cpu);
	if (ret) {
		pr_err("failed to setup HNS3 PMU hotplug, ret = %d.\n", ret);
		return ret;
	}

	ret = pci_register_driver(&hns3_pmu_driver);
	if (ret) {
		pr_err("failed to register pci driver, ret = %d.\n", ret);
		cpuhp_remove_multi_state(CPUHP_AP_PERF_ARM_HNS3_PMU_ONLINE);
	}

	return ret;
}
module_init(hns3_pmu_module_init);

static void __exit hns3_pmu_module_exit(void)
{
	pci_unregister_driver(&hns3_pmu_driver);
	cpuhp_remove_multi_state(CPUHP_AP_PERF_ARM_HNS3_PMU_ONLINE);
}
module_exit(hns3_pmu_module_exit);

MODULE_DESCRIPTION("HNS3 PMU driver");
MODULE_LICENSE("GPL v2");

Annotation

Implementation Notes