drivers/scsi/snic/snic_main.c
Source file repositories/reference/linux-study-clean/drivers/scsi/snic/snic_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/snic/snic_main.c- Extension
.c- Size
- 23235 bytes
- Lines
- 999
- Domain
- Driver Families
- Bucket
- drivers/scsi
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/module.hlinux/mempool.hlinux/string.hlinux/slab.hlinux/errno.hlinux/init.hlinux/pci.hlinux/skbuff.hlinux/interrupt.hlinux/spinlock.hlinux/workqueue.hscsi/scsi_host.hscsi/scsi_tcq.hsnic.hsnic_fwint.h
Detected Declarations
function snic_sdev_initfunction snic_sdev_configurefunction snic_change_queue_depthfunction snic_handle_link_eventfunction snic_notify_setfunction snic_dev_waitfunction snic_cleanupfunction snic_iounmapfunction snic_vdev_open_donefunction snic_add_hostfunction snic_del_hostfunction snic_get_statefunction snic_set_statefunction snic_probefunction snic_removefunction snic_global_data_initfunction snic_global_data_cleanupfunction snic_init_modulefunction snic_cleanup_modulemodule init snic_init_module
Annotated Snippet
static struct pci_driver snic_driver = {
.name = SNIC_DRV_NAME,
.id_table = snic_id_table,
.probe = snic_probe,
.remove = snic_remove,
};
static int __init
snic_init_module(void)
{
int ret = 0;
#ifndef __x86_64__
SNIC_INFO("SNIC Driver is supported only for x86_64 platforms!\n");
add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);
#endif
SNIC_INFO("%s, ver %s\n", SNIC_DRV_DESCRIPTION, SNIC_DRV_VERSION);
ret = snic_global_data_init();
if (ret) {
SNIC_ERR("Failed to Initialize Global Data.\n");
return ret;
}
ret = pci_register_driver(&snic_driver);
if (ret < 0) {
SNIC_ERR("PCI driver register error\n");
goto err_pci_reg;
}
return ret;
err_pci_reg:
snic_global_data_cleanup();
return ret;
}
static void __exit
snic_cleanup_module(void)
{
pci_unregister_driver(&snic_driver);
snic_global_data_cleanup();
}
module_init(snic_init_module);
module_exit(snic_cleanup_module);
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION(SNIC_DRV_DESCRIPTION);
MODULE_VERSION(SNIC_DRV_VERSION);
MODULE_DEVICE_TABLE(pci, snic_id_table);
MODULE_AUTHOR("Narsimhulu Musini <nmusini@cisco.com>, "
"Sesidhar Baddela <sebaddel@cisco.com>");
Annotation
- Immediate include surface: `linux/module.h`, `linux/mempool.h`, `linux/string.h`, `linux/slab.h`, `linux/errno.h`, `linux/init.h`, `linux/pci.h`, `linux/skbuff.h`.
- Detected declarations: `function snic_sdev_init`, `function snic_sdev_configure`, `function snic_change_queue_depth`, `function snic_handle_link_event`, `function snic_notify_set`, `function snic_dev_wait`, `function snic_cleanup`, `function snic_iounmap`, `function snic_vdev_open_done`, `function snic_add_host`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.