From 12413197eef2a29e0b9fb0fa541f5cbaeb1d3f3f Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sat, 11 Jun 2005 01:05:01 +0200 Subject: [SCSI] remove scsi_set_device scsi_add_host is the proper place to set the device, but people copy the scsi_set_device usage from older drivers again and again. note that this leaves some legacy drivers like qlogicisp/qlogicfc without pci association in sysfs, but they're scheduled to go away soon anyway. Signed-off-by: James Bottomley diff --git a/Documentation/scsi/scsi_mid_low_api.txt b/Documentation/scsi/scsi_mid_low_api.txt index da176c9..7536823 100644 --- a/Documentation/scsi/scsi_mid_low_api.txt +++ b/Documentation/scsi/scsi_mid_low_api.txt @@ -388,7 +388,6 @@ Summary: scsi_remove_device - detach and remove a SCSI device scsi_remove_host - detach and remove all SCSI devices owned by host scsi_report_bus_reset - report scsi _bus_ reset observed - scsi_set_device - place device reference in host structure scsi_track_queue_full - track successive QUEUE_FULL events scsi_unblock_requests - allow further commands to be queued to given host scsi_unregister - [calls scsi_host_put()] @@ -741,20 +740,6 @@ void scsi_report_bus_reset(struct Scsi_Host * shost, int channel) /** - * scsi_set_device - place device reference in host structure - * @shost: a pointer to a scsi host instance - * @pdev: pointer to device instance to assign - * - * Returns nothing - * - * Might block: no - * - * Defined in: include/scsi/scsi_host.h . - **/ -void scsi_set_device(struct Scsi_Host * shost, struct device * dev) - - -/** * scsi_track_queue_full - track successive QUEUE_FULL events on given * device to determine if and when there is a need * to adjust the queue depth on the device. diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c index d8d6539..7995956 100644 --- a/drivers/message/fusion/mptfc.c +++ b/drivers/message/fusion/mptfc.c @@ -267,10 +267,6 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id) sh->sg_tablesize = numSGE; } - /* Set the pci device pointer in Scsi_Host structure. - */ - scsi_set_device(sh, &ioc->pcidev->dev); - spin_unlock_irqrestore(&ioc->FreeQlock, flags); hd = (MPT_SCSI_HOST *) sh->hostdata; diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c index 5f9a61b..d2b53ea 100644 --- a/drivers/message/fusion/mptspi.c +++ b/drivers/message/fusion/mptspi.c @@ -287,10 +287,6 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id) sh->sg_tablesize = numSGE; } - /* Set the pci device pointer in Scsi_Host structure. - */ - scsi_set_device(sh, &ioc->pcidev->dev); - spin_unlock_irqrestore(&ioc->FreeQlock, flags); hd = (MPT_SCSI_HOST *) sh->hostdata; diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 04cb5c4..a53d433 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -4556,8 +4556,6 @@ advansys_detect(struct scsi_host_template *tpnt) continue; } - scsi_set_device(shp, dev); - /* Save a pointer to the Scsi_Host of each board found. */ asc_host[asc_board_count++] = shp; diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c index fac091e..52b72d7 100644 --- a/drivers/scsi/aic7xxx_old.c +++ b/drivers/scsi/aic7xxx_old.c @@ -8448,7 +8448,6 @@ aic7xxx_alloc(Scsi_Host_Template *sht, struct aic7xxx_host *temp) } p->host_no = host->host_no; } - scsi_set_device(host, &p->pdev->dev); return (p); } diff --git a/drivers/scsi/cpqfcTSinit.c b/drivers/scsi/cpqfcTSinit.c index 5674ada..d72be0c 100644 --- a/drivers/scsi/cpqfcTSinit.c +++ b/drivers/scsi/cpqfcTSinit.c @@ -336,7 +336,6 @@ int cpqfcTS_detect(Scsi_Host_Template *ScsiHostTemplate) DEBUG_PCI(printk(" PciDev->baseaddress[3]= %lx\n", PciDev->resource[3].start)); - scsi_set_device(HostAdapter, &PciDev->dev); HostAdapter->irq = PciDev->irq; // copy for Scsi layers // HP Tachlite uses two (255-byte) ranges of Port I/O (lower & upper), diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c index 4ba6a15..aecf32d 100644 --- a/drivers/scsi/fdomain.c +++ b/drivers/scsi/fdomain.c @@ -938,7 +938,6 @@ struct Scsi_Host *__fdomain_16x0_detect(struct scsi_host_template *tpnt ) } shpnt->irq = interrupt_level; shpnt->io_port = port_base; - scsi_set_device(shpnt, &pdev->dev); shpnt->n_io_port = 0x10; print_banner( shpnt ); diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 4552ccc..af68230 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c @@ -4521,9 +4521,7 @@ static int __init gdth_detect(Scsi_Host_Template *shtp) ha->virt_bus = hdr_channel; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - scsi_set_device(shp, &pcistr[ctr].pdev->dev); -#else +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) scsi_set_pci_device(shp, pcistr[ctr].pdev); #endif if (!(ha->cache_feat & ha->raw_feat & ha->screen_feat &GDT_64BIT)|| diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index d7a38b6..5feb886 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -180,11 +180,6 @@ static void scsi_host_dev_release(struct device *dev) scsi_destroy_command_freelist(shost); kfree(shost->shost_data); - /* - * Some drivers (eg aha1542) do scsi_register()/scsi_unregister() - * during probing without performing a scsi_set_device() in between. - * In this case dev->parent is NULL. - */ if (parent) put_device(parent); kfree(shost); diff --git a/drivers/scsi/ips.h b/drivers/scsi/ips.h index 906a761..480e06f 100644 --- a/drivers/scsi/ips.h +++ b/drivers/scsi/ips.h @@ -111,7 +111,7 @@ #define IPS_UNREGISTER_HOSTS(SHT) #define IPS_ADD_HOST(shost,device) do { scsi_add_host(shost,device); scsi_scan_host(shost); } while (0) #define IPS_REMOVE_HOST(shost) scsi_remove_host(shost) - #define IPS_SCSI_SET_DEVICE(sh,ha) scsi_set_device(sh, &(ha)->pcidev->dev) + #define IPS_SCSI_SET_DEVICE(sh,ha) do { } while (0) #define IPS_PRINTK(level, pcidev, format, arg...) \ dev_printk(level , &((pcidev)->dev) , format , ## arg) #endif diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 36b401f..a974dc8 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -3748,7 +3748,7 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, host->max_channel = 1; host->unique_id = ata_unique_id++; host->max_cmd_len = 12; - scsi_set_device(host, ent->dev); + scsi_assign_lock(host, &host_set->lock); ap->flags = ATA_FLAG_PORT_DISABLED; diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index cbe4302..d47be8e 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c @@ -719,7 +719,6 @@ megaraid_io_attach(adapter_t *adapter) // export the parameters required by the mid-layer scsi_assign_lock(host, adapter->host_lock); - scsi_set_device(host, &adapter->pdev->dev); host->irq = adapter->irq; host->unique_id = adapter->unique_id; diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c index 2a0e42e..519486d 100644 --- a/drivers/scsi/ncr53c8xx.c +++ b/drivers/scsi/ncr53c8xx.c @@ -7756,7 +7756,6 @@ struct Scsi_Host * __init ncr_attach(struct scsi_host_template *tpnt, * your module_init */ BUG_ON(!ncr53c8xx_transport_template); instance->transportt = ncr53c8xx_transport_template; - scsi_set_device(instance, device->dev); /* Patch script to physical addresses */ ncr_script_fill(&script0, &scripth0); diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c index 5159cee..6367f00 100644 --- a/drivers/scsi/nsp32.c +++ b/drivers/scsi/nsp32.c @@ -2719,9 +2719,7 @@ static int nsp32_detect(Scsi_Host_Template *sht) host->unique_id = data->BaseAddress; host->n_io_port = data->NumAddress; host->base = (unsigned long)data->MmioAddress; -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,63)) - scsi_set_device(host, &PCIDEV->dev); -#else +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,63)) scsi_set_pci_device(host, PCIDEV); #endif diff --git a/drivers/scsi/qlogicfc.c b/drivers/scsi/qlogicfc.c index ddf0f42..a4b3b3f 100644 --- a/drivers/scsi/qlogicfc.c +++ b/drivers/scsi/qlogicfc.c @@ -746,7 +746,6 @@ static int isp2x00_detect(Scsi_Host_Template * tmpt) printk("qlogicfc%d : could not register host.\n", hosts); continue; } - scsi_set_device(host, &pdev->dev); host->max_id = QLOGICFC_MAX_ID + 1; host->max_lun = QLOGICFC_MAX_LUN; hostdata = (struct isp2x00_hostdata *) host->hostdata; diff --git a/drivers/scsi/qlogicisp.c b/drivers/scsi/qlogicisp.c index 6d29e1b..6c9266b 100644 --- a/drivers/scsi/qlogicisp.c +++ b/drivers/scsi/qlogicisp.c @@ -694,7 +694,6 @@ static int isp1020_detect(Scsi_Host_Template *tmpt) memset(hostdata, 0, sizeof(struct isp1020_hostdata)); hostdata->pci_dev = pdev; - scsi_set_device(host, &pdev->dev); if (isp1020_init(host)) goto fail_and_unregister; diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index db9914a..81d5234 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -641,12 +641,6 @@ static inline void scsi_assign_lock(struct Scsi_Host *shost, spinlock_t *lock) shost->host_lock = lock; } -static inline void scsi_set_device(struct Scsi_Host *shost, - struct device *dev) -{ - shost->shost_gendev.parent = dev; -} - static inline struct device *scsi_get_device(struct Scsi_Host *shost) { return shost->shost_gendev.parent; -- cgit v0.10.2