While accessing a scsi_device, the use count of the underlying LLDD module is incremented. The module reference is retrieved through .module field of struct scsi_host_template. This mapping between scsi_device and underlying LLDD module works well except some drivers which consist with the core driver and the actual LLDDs and scsi_host_template is defined in the core driver. In these cases, the actual LLDDs can be unloaded even if the scsi_device is being accessed. This patch series fixes the module reference mismatch problem for ufs, usb-storage, esp_scsi, ahci_platform, and pata_platform drivers by moving owner module reference field from struct scsi_host_template to struct Scsi_Host and allowing the LLDDs to set their correct module reference. * v4: - Patch series is almost rewritten as module reference field in struct scsi_host_template has been unused anymore. So Acked-by: and Reviewed-by: tags that have been received are deleted. * v3: - Add fix for ESP SCSI drivers * v2: - Pass correct module reference to usb_stor_probe1() instead of touching all ums-* drivers, suggested by Alan Stern Akinobu Mita (11): ata: prepare to move module reference from scsi_host_template to Scsi_Host iscsi: prepare to move module reference from scsi_host_template to Scsi_Host cxgbi: prepare to move module reference from scsi_host_template to Scsi_Host libfc: prepare to move module reference from scsi_host_template to Scsi_Host 53c700: prepare move module reference from scsi_host_template to Scsi_Host scsi: legacy: prepare to move module reference from scsi_host_template to Scsi_Host scsi: move module reference from scsi_host_template to Scsi_Host scsi: ufs: adjust module reference for scsi host usb: storage: adjust module reference for scsi host ata: ahci_platform: adjust module reference for scsi host ata: pata_of_platform: adjust module reference for scsi host drivers/ata/libahci_platform.c | 14 +++++----- drivers/ata/libata-core.c | 22 ++++++++------- drivers/ata/libata-scsi.c | 2 +- drivers/ata/libata-sff.c | 61 +++++++++++++++++++++++------------------- drivers/ata/pata_platform.c | 18 +++++++------ drivers/scsi/53c700.c | 9 ++++--- drivers/scsi/53c700.h | 7 +++-- drivers/scsi/cxgbi/libcxgbi.c | 8 +++--- drivers/scsi/cxgbi/libcxgbi.h | 6 +++-- drivers/scsi/hosts.c | 16 ++++++----- drivers/scsi/libfc/fc_lport.c | 26 ++++++++++++++++++ drivers/scsi/libfc/fc_npiv.c | 2 +- drivers/scsi/libiscsi.c | 12 +++++---- drivers/scsi/scsi.c | 4 +-- drivers/scsi/ufs/ufshcd.c | 13 ++++----- drivers/scsi/ufs/ufshcd.h | 5 +++- drivers/usb/storage/scsiglue.c | 3 --- drivers/usb/storage/usb.c | 9 ++++--- drivers/usb/storage/usb.h | 7 +++-- include/linux/ahci_platform.h | 9 ++++--- include/linux/ata_platform.h | 16 ++++++----- include/linux/libata.h | 52 ++++++++++++++++++++++++----------- include/scsi/libfc.h | 27 +++---------------- include/scsi/libiscsi.h | 9 ++++--- include/scsi/scsi_host.h | 13 +++++++-- 25 files changed, 224 insertions(+), 146 deletions(-) Cc: Vinayak Holikatti <vinholikatti@xxxxxxxxx> Cc: Dolev Raviv <draviv@xxxxxxxxxxxxxx> Cc: Sujit Reddy Thumma <sthumma@xxxxxxxxxxxxxx> Cc: Subhash Jadavani <subhashj@xxxxxxxxxxxxxx> Cc: Matthew Dharm <mdharm-usb@xxxxxxxxxxxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx> Cc: Hannes Reinecke <hare@xxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Cc: Hans de Goede <hdegoede@xxxxxxxxxx> Cc: Mike Christie <michaelc@xxxxxxxxxxx> Cc: Karen Xie <kxie@xxxxxxxxxxx> Cc: Robert Love <robert.w.love@xxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: "James E.J. Bottomley" <JBottomley@xxxxxxxxxxxxx> Cc: open-iscsi@xxxxxxxxxxxxxxxx Cc: fcoe-devel@xxxxxxxxxxxxx Cc: linux-ide@xxxxxxxxxxxxxxx Cc: linux-usb@xxxxxxxxxxxxxxx Cc: usb-storage@xxxxxxxxxxxxxxxxxxxxxxxx Cc: linux-scsi@xxxxxxxxxxxxxxx -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html