drivers/scsi/aacraid/linit.c

Source file repositories/reference/linux-study-clean/drivers/scsi/aacraid/linit.c

File Facts

System
Linux kernel
Corpus path
drivers/scsi/aacraid/linit.c
Extension
.c
Size
61885 bytes
Lines
2075
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.

Dependency Surface

Detected Declarations

Annotated Snippet

static const struct file_operations aac_cfg_fops = {
	.owner		= THIS_MODULE,
	.unlocked_ioctl	= aac_cfg_ioctl,
#ifdef CONFIG_COMPAT
	.compat_ioctl   = aac_cfg_ioctl,
#endif
	.open		= aac_cfg_open,
	.llseek		= noop_llseek,
};

static const struct scsi_host_template aac_driver_template = {
	.module				= THIS_MODULE,
	.name				= "AAC",
	.proc_name			= AAC_DRIVERNAME,
	.info				= aac_info,
	.ioctl				= aac_ioctl,
#ifdef CONFIG_COMPAT
	.compat_ioctl			= aac_ioctl,
#endif
	.queuecommand			= aac_queuecommand,
	.bios_param			= aac_biosparm,
	.shost_groups			= aac_host_groups,
	.sdev_configure			= aac_sdev_configure,
	.change_queue_depth		= aac_change_queue_depth,
	.sdev_groups			= aac_dev_groups,
	.eh_abort_handler		= aac_eh_abort,
	.eh_device_reset_handler	= aac_eh_dev_reset,
	.eh_target_reset_handler	= aac_eh_target_reset,
	.eh_bus_reset_handler		= aac_eh_bus_reset,
	.eh_host_reset_handler		= aac_eh_host_reset,
	.can_queue			= AAC_NUM_IO_FIB,
	.this_id			= MAXIMUM_NUM_CONTAINERS,
	.sg_tablesize			= 16,
	.max_sectors			= 128,
#if (AAC_NUM_IO_FIB > 256)
	.cmd_per_lun			= 256,
#else
	.cmd_per_lun			= AAC_NUM_IO_FIB,
#endif
	.emulated			= 1,
	.no_write_same			= 1,
	.cmd_size			= sizeof(struct aac_cmd_priv),
};

static void __aac_shutdown(struct aac_dev * aac)
{
	int i;

	mutex_lock(&aac->ioctl_mutex);
	aac->adapter_shutdown = 1;
	mutex_unlock(&aac->ioctl_mutex);

	if (aac->aif_thread) {
		int i;
		/* Clear out events first */
		for (i = 0; i < (aac->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); i++) {
			struct fib *fib = &aac->fibs[i];
			if (!(fib->hw_fib_va->header.XferState & cpu_to_le32(NoResponseExpected | Async)) &&
			    (fib->hw_fib_va->header.XferState & cpu_to_le32(ResponseExpected)))
				complete(&fib->event_wait);
		}
		kthread_stop(aac->thread);
		aac->thread = NULL;
	}

	aac_send_shutdown(aac);

	aac_adapter_disable_int(aac);

	if (aac_is_src(aac)) {
		if (aac->max_msix > 1) {
			for (i = 0; i < aac->max_msix; i++) {
				free_irq(pci_irq_vector(aac->pdev, i),
					 &(aac->aac_msix[i]));
			}
		} else {
			free_irq(aac->pdev->irq,
				 &(aac->aac_msix[0]));
		}
	} else {
		free_irq(aac->pdev->irq, aac);
	}
	if (aac->msi)
		pci_disable_msi(aac->pdev);
	else if (aac->max_msix > 1)
		pci_disable_msix(aac->pdev);
}
static void aac_init_char(void)
{
	aac_cfg_major = register_chrdev(0, "aac", &aac_cfg_fops);

Annotation

Implementation Notes