drivers/crypto/hifn_795x.c

Source file repositories/reference/linux-study-clean/drivers/crypto/hifn_795x.c

File Facts

System
Linux kernel
Corpus path
drivers/crypto/hifn_795x.c
Extension
.c
Size
72034 bytes
Lines
2562
Domain
Driver Families
Bucket
drivers/crypto
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 hifn_pci_driver = {
	.name     = "hifn795x",
	.id_table = hifn_pci_tbl,
	.probe    = hifn_probe,
	.remove   = hifn_remove,
};

static int __init hifn_init(void)
{
	unsigned int freq;
	int err;

	if (strncmp(hifn_pll_ref, "ext", 3) &&
	    strncmp(hifn_pll_ref, "pci", 3)) {
		pr_err("hifn795x: invalid hifn_pll_ref clock, must be pci or ext");
		return -EINVAL;
	}

	/*
	 * For the 7955/7956 the reference clock frequency must be in the
	 * range of 20MHz-100MHz. For the 7954 the upper bound is 66.67MHz,
	 * but this chip is currently not supported.
	 */
	if (hifn_pll_ref[3] != '\0') {
		freq = simple_strtoul(hifn_pll_ref + 3, NULL, 10);
		if (freq < 20 || freq > 100) {
			pr_err("hifn795x: invalid hifn_pll_ref frequency, must"
			       "be in the range of 20-100");
			return -EINVAL;
		}
	}

	err = pci_register_driver(&hifn_pci_driver);
	if (err < 0) {
		pr_err("Failed to register PCI driver for %s device.\n",
		       hifn_pci_driver.name);
		return -ENODEV;
	}

	pr_info("Driver for HIFN 795x crypto accelerator chip "
		"has been successfully registered.\n");

	return 0;
}

static void __exit hifn_fini(void)
{
	pci_unregister_driver(&hifn_pci_driver);

	pr_info("Driver for HIFN 795x crypto accelerator chip "
		"has been successfully unregistered.\n");
}

module_init(hifn_init);
module_exit(hifn_fini);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Evgeniy Polyakov <johnpol@2ka.mipt.ru>");
MODULE_DESCRIPTION("Driver for HIFN 795x crypto accelerator chip.");

Annotation

Implementation Notes