drivers/scsi/mvsas/mv_init.c
Source file repositories/reference/linux-study-clean/drivers/scsi/mvsas/mv_init.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/mvsas/mv_init.c- Extension
.c- Size
- 19628 bytes
- Lines
- 776
- 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
mv_sas.h
Detected Declarations
function mvs_phy_initfunction mvs_freefunction mvs_taskletfunction mvs_interruptfunction mvs_allocfunction mvs_ioremapfunction mvs_iounmapfunction pci_go_64function mvs_prep_sas_ha_initfunction mvs_post_sas_ha_initfunction mvs_init_sas_addfunction mvs_pci_initfunction mvs_pci_removefunction interrupt_coalescing_storefunction interrupt_coalescing_showfunction mvs_initfunction mvs_exitmodule init mvs_init
Annotated Snippet
static struct pci_driver mvs_pci_driver = {
.name = DRV_NAME,
.id_table = mvs_pci_table,
.probe = mvs_pci_init,
.remove = mvs_pci_remove,
};
static DEVICE_STRING_ATTR_RO(driver_version, 0444, DRV_VERSION);
static ssize_t interrupt_coalescing_store(struct device *cdev,
struct device_attribute *attr,
const char *buffer, size_t size)
{
unsigned int val = 0;
struct mvs_info *mvi = NULL;
struct Scsi_Host *shost = class_to_shost(cdev);
struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
u8 i, core_nr;
if (buffer == NULL)
return size;
if (sscanf(buffer, "%u", &val) != 1)
return -EINVAL;
if (val >= 0x10000) {
mv_dprintk("interrupt coalescing timer %d us is"
"too long\n", val);
return strlen(buffer);
}
interrupt_coalescing = val;
core_nr = ((struct mvs_prv_info *)sha->lldd_ha)->n_host;
mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[0];
if (unlikely(!mvi))
return -EINVAL;
for (i = 0; i < core_nr; i++) {
mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[i];
if (MVS_CHIP_DISP->tune_interrupt)
MVS_CHIP_DISP->tune_interrupt(mvi,
interrupt_coalescing);
}
mv_dprintk("set interrupt coalescing time to %d us\n",
interrupt_coalescing);
return strlen(buffer);
}
static ssize_t interrupt_coalescing_show(struct device *cdev,
struct device_attribute *attr, char *buffer)
{
return sysfs_emit(buffer, "%d\n", interrupt_coalescing);
}
static DEVICE_ATTR_RW(interrupt_coalescing);
static int __init mvs_init(void)
{
int rc;
mvs_stt = sas_domain_attach_transport(&mvs_transport_ops);
if (!mvs_stt)
return -ENOMEM;
rc = pci_register_driver(&mvs_pci_driver);
if (rc)
goto err_out;
return 0;
err_out:
sas_release_transport(mvs_stt);
return rc;
}
static void __exit mvs_exit(void)
{
pci_unregister_driver(&mvs_pci_driver);
sas_release_transport(mvs_stt);
}
static struct attribute *mvst_host_attrs[] = {
&dev_attr_driver_version.attr.attr,
&dev_attr_interrupt_coalescing.attr,
NULL,
};
ATTRIBUTE_GROUPS(mvst_host);
static const struct attribute_group *mvst_sdev_groups[] = {
Annotation
- Immediate include surface: `mv_sas.h`.
- Detected declarations: `function mvs_phy_init`, `function mvs_free`, `function mvs_tasklet`, `function mvs_interrupt`, `function mvs_alloc`, `function mvs_ioremap`, `function mvs_iounmap`, `function pci_go_64`, `function mvs_prep_sas_ha_init`, `function mvs_post_sas_ha_init`.
- 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.