drivers/message/fusion/mptspi.c
Source file repositories/reference/linux-study-clean/drivers/message/fusion/mptspi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/message/fusion/mptspi.c- Extension
.c- Size
- 43798 bytes
- Lines
- 1622
- Domain
- Driver Families
- Bucket
- drivers/message
- 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/kernel.hlinux/slab.hlinux/init.hlinux/errno.hlinux/kdev_t.hlinux/blkdev.hlinux/delay.hlinux/interrupt.hlinux/reboot.hlinux/workqueue.hlinux/raid_class.hscsi/scsi.hscsi/scsi_cmnd.hscsi/scsi_device.hscsi/scsi_host.hscsi/scsi_tcq.hscsi/scsi_transport.hscsi/scsi_transport_spi.hscsi/scsi_dbg.hmptbase.hmptscsih.h
Detected Declarations
struct work_queue_wrapperfunction mptspi_setTargetNegoParmsfunction mptspi_writeIOCPage4function mptspi_initTargetfunction mptspi_is_raidfunction mptspi_target_allocfunction mptspi_target_destroyfunction mptspi_print_write_negofunction mptspi_print_read_negofunction mptspi_read_spi_device_pg0function mptspi_getRPfunction mptspi_read_parametersfunction mptscsih_quiesce_raidfunction mptspi_dv_devicefunction mptscsih_quiesce_raidfunction mptspi_sdev_initfunction mptspi_sdev_configurefunction mptspi_qcmdfunction mptspi_sdev_destroyfunction mptspi_write_spi_device_pg1function mptspi_write_offsetfunction mptspi_write_periodfunction mptspi_write_dtfunction mptspi_write_iufunction mptspi_write_qasfunction mptspi_write_widthfunction mpt_work_wrapperfunction shost_for_each_devicefunction mpt_dv_raidfunction mptspi_event_processfunction mptspi_deny_bindingfunction mptspi_dv_renegotiate_workfunction mptspi_dv_renegotiatefunction mptspi_ioc_resetfunction mptspi_resumefunction mptspi_probefunction mptspi_removefunction mptspi_initfunction mptspi_exitmodule init mptspi_init
Annotated Snippet
static struct pci_driver mptspi_driver = {
.name = "mptspi",
.id_table = mptspi_pci_table,
.probe = mptspi_probe,
.remove = mptspi_remove,
.shutdown = mptscsih_shutdown,
#ifdef CONFIG_PM
.suspend = mptscsih_suspend,
.resume = mptspi_resume,
#endif
};
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/**
* mptspi_init - Register MPT adapter(s) as SCSI host(s) with SCSI mid-layer.
*
* Returns 0 for success, non-zero for failure.
*/
static int __init
mptspi_init(void)
{
int error;
show_mptmod_ver(my_NAME, my_VERSION);
mptspi_transport_template = spi_attach_transport(&mptspi_transport_functions);
if (!mptspi_transport_template)
return -ENODEV;
mptspiDoneCtx = mpt_register(mptscsih_io_done, MPTSPI_DRIVER,
"mptscsih_io_done");
mptspiTaskCtx = mpt_register(mptscsih_taskmgmt_complete, MPTSPI_DRIVER,
"mptscsih_taskmgmt_complete");
mptspiInternalCtx = mpt_register(mptscsih_scandv_complete,
MPTSPI_DRIVER, "mptscsih_scandv_complete");
mpt_event_register(mptspiDoneCtx, mptspi_event_process);
mpt_reset_register(mptspiDoneCtx, mptspi_ioc_reset);
error = pci_register_driver(&mptspi_driver);
if (error)
spi_release_transport(mptspi_transport_template);
return error;
}
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
/**
* mptspi_exit - Unregisters MPT adapter(s)
*/
static void __exit
mptspi_exit(void)
{
pci_unregister_driver(&mptspi_driver);
mpt_reset_deregister(mptspiDoneCtx);
mpt_event_deregister(mptspiDoneCtx);
mpt_deregister(mptspiInternalCtx);
mpt_deregister(mptspiTaskCtx);
mpt_deregister(mptspiDoneCtx);
spi_release_transport(mptspi_transport_template);
}
module_init(mptspi_init);
module_exit(mptspi_exit);
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/slab.h`, `linux/init.h`, `linux/errno.h`, `linux/kdev_t.h`, `linux/blkdev.h`, `linux/delay.h`.
- Detected declarations: `struct work_queue_wrapper`, `function mptspi_setTargetNegoParms`, `function mptspi_writeIOCPage4`, `function mptspi_initTarget`, `function mptspi_is_raid`, `function mptspi_target_alloc`, `function mptspi_target_destroy`, `function mptspi_print_write_nego`, `function mptspi_print_read_nego`, `function mptspi_read_spi_device_pg0`.
- Atlas domain: Driver Families / drivers/message.
- 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.