Re: [PATCH 13/16] gdth: Make one abuse of scsi_cmnd less obvious

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Boaz Harrosh wrote:
- Christoph or Jeff will work on the finish up of the BUS hotplug API.
  I have looked at code examples elsewhere in the kernel, and Jeff's
master plan sounds very good. But I would hope not to do it myself as it will take me much longer.
  Jeff it sounds like you have it clearer in your head?


TBH I won't have time to look at it, though I will be quite happy to answer as many questions as you can come up with :)

In the on-going effort to kill deprecated pci_find_device (of which this gdth effort is part of), I converted several ISDN drivers to use the new ISA, PNP, and PCI APIs:

     Branch 'isdn-pci' of
     git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git

You can look at those patches for examples.

Really, you should pat yourself on the back, you have already done 96% of the gdth work required to get us there. :)

Once you understand the key concepts of the new hotplug-style APIs, the code changes themselves are easy. They are...

* reference HBA information via per-instance pointers stored in scsi_host->hostdata. Global variables relating to per-HBA information are to be avoided.

* in the API's ->probe() hook,
	* detect a single card/device
	* allocate and init a single scsi_host and gdth_ha_str

* destroy a single gdth_ha_str in the API's ->remove() hook
	* shut down a single card/device
	* destroy one scsi_host and gdth_ha_str

In practice, this tends to mean converting code like

	while ((pdev = pci_find_device(...)) != NULL) {
		alloc, init one PCI device
	}

to

	static int gdth_init_one (struct pci_dev *pdev,
				const struct pci_device_id *ent) {
		alloc, init one PCI devoce
	}

because, as you can see, the loop has been moved to generic code. Also, it should be self-evident that this new API allows devices to be attached (hotplugged) long after the module initialization completes, and other gdth devices are running.

	Jeff



-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux