pull scsi_scan_host out of scsi_add_host
Subsystems (13)
PATCH 1/1 pull scsi_scan_host out of scsi_add_host
As Douglas mentioned on this list a while ago there's hardware these days where we don't want to automatically perform an initial bus scan in scsi_add_host. Currently we only have ieee1394 in the tree but I can imagine more uses like iscsi or certain fc setups.
This patch removes the call to scsi_scan_host from scsi_add_host and moves it into the drivers that want in.
drivers/block/cciss_scsi.c +2 -1
@@ -712,7 +712,8 @@ sh->hostdata[0 ] = (unsigned long ) hba[ctlr]; sh->irq = hba[ctlr]->intr; sh->unique_id = sh->irq; -scsi_add_host (sh, &hba[ctlr]->pdev->dev); +scsi_add_host (sh, &hba[ctlr]->pdev->dev);/* XXX handle failure */ +scsi_scan_host (sh);return 1 ; }
drivers/scsi/NCR_D700.c +2 -1
@@ -218,7 +218,8 @@ goto irq_failed; } -scsi_add_host (host, p->dev); +scsi_add_host (host, p->dev);/* XXX handle failure */ +scsi_scan_host (host); p->hosts[siop] = host; hostdata->dev = p->dev;
drivers/scsi/aha1740.c +2 -1
@@ -636,7 +636,8 @@ }eisa_set_drvdata (edev, shpnt); -scsi_add_host (shpnt, dev); +scsi_add_host (shpnt, dev);/* XXX handle failure */ +scsi_scan_host (shpnt) return 0; err_unmap:
drivers/scsi/aic7xxx/aic79xx_osm.c +2 -1
@@ -2173,7 +2173,8 @@ahd_unlock (ahd, &s);#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,5 ,0 ) -scsi_add_host (host, &ahd->dev_softc->dev); +scsi_add_host (host, &ahd->dev_softc->dev);/* XXX handle failure */ +scsi_scan_host (host);#endif return (0 ); }
drivers/scsi/aic7xxx/aic7xxx_osm.c +2 -1
@@ -1811,7 +1811,8 @@ahc_unlock (ahc, &s);#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,5 ,0 ) -scsi_add_host (host, (ahc->dev_softc ? &ahc->dev_softc->dev :NULL )); +scsi_add_host (host, (ahc->dev_softc ? &ahc->dev_softc->dev :NULL ));/* XXX handle failure */ +scsi_scan_host (host);#endif return (0 ); }
drivers/scsi/arm/acornscsi.c +6 -2
@@ -3043,9 +3043,13 @@acornscsi_resetcard (ashost); ret =scsi_add_host (host, &ec->dev); -if (ret ==0 ) - goto out; +if (ret) + goto err_7; +scsi_scan_host (host); + goto out; + + err_7:free_irq (host->irq, ashost); err_6:release_region (host->io_port,2048 );
drivers/scsi/arm/cumana_1.c +6 -2
@@ -297,9 +297,13 @@printk ("\n" ); ret =scsi_add_host (host, &ec->dev); -if (ret ==0 ) - goto out; +if (ret) + goto out_free_irq; +scsi_scan_host (host); + goto out; + + out_free_irq:free_irq (host->irq, host); out_release:release_region (host->io_port, host->n_io_port);
drivers/scsi/arm/ecoscsi.c +2 -1
@@ -205,7 +205,8 @@NCR5380_print_options (host);printk ("\n" ); -scsi_add_host (host,NULL ); +scsi_add_host (host,NULL );/* XXX handle failure */ +scsi_scan_host (host);return 0 ; release_reg:
drivers/scsi/arm/fas216.c +2 -0
@@ -2861,6 +2861,8 @@ ret =scsi_add_host (host, dev);if (ret)fas216_writeb (info,REG_CMD ,CMD_RESETCHIP ); +else +scsi_scan_host (host);return ret; }
drivers/scsi/arm/oak.c +6 -2
@@ -158,9 +158,13 @@printk ("\n" ); ret =scsi_add_host (host, &ec->dev); -if (ret ==0 ) - goto out; +if (ret) + goto out_release; +scsi_scan_host (host); + goto out; + + out_release:release_region (host->io_port, host->n_io_port); unreg:scsi_host_put (host);
drivers/scsi/dc395x.c +2 -1
@@ -6214,7 +6214,8 @@pci_set_drvdata (pdev, scsi_host);/* get the scsi mid level to scan for new devices on the bus */ -scsi_add_host (scsi_host, &pdev->dev); +scsi_add_host (scsi_host, &pdev->dev);/* XXX handle failure */ +scsi_scan_host (scsi_host);return 0 ; }
drivers/scsi/hosts.c +2 -6
@@ -81,19 +81,15 @@printk (KERN_INFO "scsi%d : %s\n" , shost->host_no, sht->info ? sht->info (shost) : sht->name); - error =scsi_sysfs_add_host (shost, dev); -if (!shost->can_queue) {printk (KERN_ERR "%s: can_queue = 0 no longer supported\n" , sht->name); error = -EINVAL ; } -if (!error) { + error =scsi_sysfs_add_host (shost, dev); +if (!error)scsi_proc_host_add (shost); -scsi_scan_host (shost); - } -return error; }
drivers/scsi/ide-scsi.c +3 -1
@@ -978,8 +978,10 @@idescsi_setup (drive, idescsi); drive->disk->fops = &idescsi_ops; err =scsi_add_host (host, &idescsi_primary); -if (!err) +if (!err) { +scsi_scan_host (host);return 0 ; + }/* fall through on error */ ide_unregister_subdriver (drive); }
drivers/scsi/ips.h +1 -1
@@ -111,7 +111,7 @@#else #define IPS_REGISTER_HOSTS (SHT ) (!ips_detect(SHT))#define IPS_UNREGISTER_HOSTS (SHT ) -#define IPS_ADD_HOST (shost,device) scsi_add_host(shost,device) +#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_PRINTK(level, pcidev, format, arg...) \
drivers/scsi/lasi700.c +2 -1
@@ -128,7 +128,8 @@ }dev_set_drvdata (&dev->dev, host); -scsi_add_host (host, &dev->dev); +scsi_add_host (host, &dev->dev);/* XXX handle failure */ +scsi_scan_host (host);return 0 ;
drivers/scsi/nsp32.c +2 -1
@@ -1820,7 +1820,8 @@ goto free_irq; } -scsi_add_host (host, &pdev->dev); +scsi_add_host (host, &pdev->dev);/* XXX handle failure */ +scsi_scan_host (host);pci_set_drvdata (pdev, host);return 0 ;
drivers/scsi/pcmcia/aha152x_stub.c +2 -1
@@ -278,7 +278,8 @@ goto cs_failed; } -scsi_add_host (host,NULL ); +scsi_add_host (host,NULL );/* XXX handle failure */ +scsi_scan_host (host);sprintf (info->node.dev_name,"scsi%d" , host->host_no); link->dev = &info->node;
drivers/scsi/pcmcia/fdomain_stub.c +2 -1
@@ -254,7 +254,8 @@ goto cs_failed; } -scsi_add_host (host,NULL ); +scsi_add_host (host,NULL );/* XXX handle failure */ +scsi_scan_host (host);sprintf (info->node.dev_name,"scsi%d" , host->host_no); link->dev = &info->node;
drivers/scsi/pcmcia/nsp_cs.c +2 -1
@@ -1773,7 +1773,8 @@ req.Base+req.Size-1);printk ("\n" ); -scsi_add_host (host,NULL ); +scsi_add_host (host,NULL );/* XXX handle failure */ +scsi_scan_host (host); link->state &= ~DEV_CONFIG_PENDING ;return ;
drivers/scsi/pcmcia/qlogic_stub.c +2 -1
@@ -270,7 +270,8 @@ link->dev = &info->node; info->host = host; -scsi_add_host (host,NULL ); +scsi_add_host (host,NULL );/* XXX handle failure */ +scsi_scan_host (host); out: link->state &= ~DEV_CONFIG_PENDING ;
drivers/scsi/scsi_debug.c +2 -1
@@ -1701,7 +1701,8 @@printk (KERN_ERR "%s: scsi_add_host failed\n" , __FUNCTION__); error = -ENODEV ;scsi_host_put (hpnt); - } + }else +scsi_scan_host (hpnt);return error;
drivers/scsi/scsi_module.c +1 -0
@@ -40,6 +40,7 @@ error =scsi_add_host (shost,NULL );if (error) goto fail; +scsi_scan_host (shost); }return 0 ; fail:
drivers/scsi/scsi_priv.h +0 -1
@@ -102,7 +102,6 @@#endif /* CONFIG_PROC_FS */ /* scsi_scan.c */ -extern void scsi_scan_host (struct Scsi_Host *);extern void scsi_forget_host (struct Scsi_Host *);extern void scsi_free_sdev (struct scsi_device *);extern void scsi_free_shost (struct Scsi_Host *);
drivers/scsi/scsi_syms.c +1 -0
@@ -34,6 +34,7 @@EXPORT_SYMBOL (scsi_register_interface);EXPORT_SYMBOL (scsi_host_alloc);EXPORT_SYMBOL (scsi_add_host); +EXPORT_SYMBOL (scsi_scan_host);EXPORT_SYMBOL (scsi_remove_host);EXPORT_SYMBOL (scsi_host_get);EXPORT_SYMBOL (scsi_host_put);
drivers/scsi/sim710.c +2 -1
@@ -138,7 +138,8 @@ goto out_unregister; } -scsi_add_host (host, dev); +scsi_add_host (host, dev);/* XXX handle failure */ +scsi_scan_host (host); hostdata->dev = dev;return 0 ;
drivers/usb/image/hpusbscsi.c +2 -1
@@ -109,7 +109,8 @@ goto out_unlink_controlurb; new->host->hostdata[0 ] = (unsigned long )new; -scsi_add_host (new->host, &intf->dev); +scsi_add_host (new->host, &intf->dev);/* XXX handle failure */ +scsi_scan_host (new->host); new->sense_command[0 ] =REQUEST_SENSE ; new->sense_command[4 ] =HPUSBSCSI_SENSE_LENGTH ;
drivers/usb/image/microtek.c +2 -1
@@ -817,7 +817,8 @@ goto out_free_urb; new_desc->host->hostdata[0 ] = (unsigned long )new_desc; -scsi_add_host (new_desc->host,NULL ); +scsi_add_host (new_desc->host,NULL );/* XXX handle failure */ +scsi_scan_host (new_desc->host);usb_set_intfdata (intf, new_desc);return 0 ;
drivers/usb/storage/usb.c +2 -0
@@ -958,6 +958,8 @@ goto BadDevice; } +scsi_scan_host (us->host); +printk (KERN_DEBUG "WARNING: USB Mass Storage data integrity not assured\n" ); printk(KERN_DEBUG
include/scsi/scsi_host.h +1 -0
@@ -477,6 +477,7 @@extern struct Scsi_Host *scsi_host_alloc (struct scsi_host_template *,int );extern int scsi_add_host (struct Scsi_Host *,struct device *); +extern void scsi_scan_host (struct Scsi_Host *);extern int scsi_remove_host (struct Scsi_Host *);extern void scsi_host_get (struct Scsi_Host *);extern void scsi_host_put (struct Scsi_Host *t);
drivers/scsi/NCR_Q720.c +7 -3
@@ -85,6 +85,7 @@__u8 scsr1 =readb (vaddr +NCR_Q720_SCSR_OFFSET +1 );__u8 differential =readb (vaddr +NCR_Q720_SCSR_OFFSET ) &0x20 ;__u8 version; +int error; scsi_id = scsr1 >>4 ;/* enable burst length 16 (FIXME: should allow this) */
@@ -120,9 +121,12 @@ scsr1 &= ~0x01 ;writeb (scsr1, vaddr +NCR_Q720_SCSR_OFFSET +1 ); -scsi_add_host (p->hosts[siop], p->dev); - -return 0 ; + error =scsi_add_host (p->hosts[siop], p->dev); +if (error) +ncr53c8xx_release (p->hosts[siop]); +else +scsi_scan_host (p->hosts[siop]); +return error; fail:return -ENODEV ;
drivers/scsi/sd.c +1 -28
@@ -606,35 +606,8 @@static void sd_rescan (struct device *dev) { -struct scsi_device *sdp =to_scsi_device (dev);struct scsi_disk *sdkp =dev_get_drvdata (dev); -struct gendisk *gd; -struct scsi_request *SRpnt; -unsigned char *buffer; - -if (!sdkp || sdp->online == FALSE || !sdkp->media_present) -return ; - - gd = sdkp->disk; - -SCSI_LOG_HLQUEUE (3 ,printk ("sd_rescan: disk=%s\n" , gd->disk_name)); - - SRpnt =scsi_allocate_request (sdp); -if (!SRpnt) { -printk (KERN_WARNING "(sd_rescan:) Request allocation " -"failure.\n" ); -return ; - } - -if (sdkp->device->host->unchecked_isa_dma) - buffer =kmalloc (512 ,GFP_DMA ); -else - buffer =kmalloc (512 ,GFP_KERNEL ); - -sd_read_capacity (sdkp, gd->disk_name, SRpnt, buffer); -set_capacity (gd, sdkp->capacity); -scsi_release_request (SRpnt); -kfree (buffer); +sd_revalidate_disk (sdkp->disk); }static struct block_device_operations sd_fops = {
drivers/scsi/zalon.c +10 -3
@@ -85,7 +85,7 @@ {struct gsc_irq gsc_irq;u32 zalon_vers; -int irq; +int irq, error = -ENODEV ;unsigned long zalon = dev->hpa;unsigned long io_port = zalon +GSC_SCSI_ZALON_OFFSET ;static int unit =0 ;
@@ -147,11 +147,18 @@dev_set_drvdata (&dev->dev, host); -scsi_add_host (host, &dev->dev); + error =scsi_add_host (host, &dev->dev); +if (error) + goto fail_free_irq; +scsi_scan_host (host);return 0 ; + + fail_free_irq: +free_irq (irq, host); fail: -return -ENODEV ; +ncr53c8xx_release (host); +return error; }static struct parisc_device_id zalon_tbl[] = {
Quoted 7 lines · Christoph Hellwig [[email protected]] wrote:
As Douglas mentioned on this list a while ago there's hardware these days where we don't want to automatically perform an initial bus scan in
scsi_add_host. Currently we only have ieee1394 in the tree but I can imagine more uses like iscsi or certain fc setups.This patch removes the call to
scsi_scan_hostfromscsi_add_hostand moves it into the drivers that want in.
Would we want to make a symmetric interface and pull the unscan out of scsi_remove_host also?
-andmike
--
Michael Anderson
[email protected]
Quoted 2 lines · Mike Anderson
Would we want to make a symmetric interface and pull the unscan out of
scsi_remove_hostalso?
It would make sense if we something like an unscan. But the closest thing to an unscan is scsi_forget_host which just releases the scsi_device structures. Given that we can't free a host without releasing the devices first and scsi_forget_host is a noop if shost->my_devices is empty I don't this makes gains anything.
Oliver Neukum
maintainerAm Dienstag, 8. Juli 2003 10:03 schrieb Mike Anderson:
Quoted 11 lines
Quoted 7 lines · Christoph Hellwig [[email protected]] wrote:
As Douglas mentioned on this list a while ago there's hardware these days where we don't want to automatically perform an initial bus scan in
scsi_add_host. Currently we only have ieee1394 in the tree but I can imagine more uses like iscsi or certain fc setups.This patch removes the call to
scsi_scan_hostfromscsi_add_hostand moves it into the drivers that want in.Would we want to make a symmetric interface and pull the unscan out of
scsi_remove_hostalso?
Unless you are talking about multipath, you have to forget all devices connected to a controller, so what sense would it make?
Philosophically speaking, scanning is an operation that cannot be simply undone. You can undo device/driver bindings but you cannot undo a bus scan.
Regards
Oliver
Quoted 10 lines · Oliver Neukum [[email protected]] wrote:
Am Dienstag, 8. Juli 2003 10:03 schrieb Mike Anderson:
Quoted 9 lines
Quoted 7 lines · Christoph Hellwig [[email protected]] wrote:
As Douglas mentioned on this list a while ago there's hardware these days where we don't want to automatically perform an initial bus scan in
scsi_add_host. Currently we only have ieee1394 in the tree but I can imagine more uses like iscsi or certain fc setups.This patch removes the call to
scsi_scan_hostfromscsi_add_hostand moves it into the drivers that want in.
Quoted 6 lines
Quoted 2 lines
Would we want to make a symmetric interface and pull the unscan out of
scsi_remove_hostalso?Unless you are talking about multipath, you have to forget all devices connected to a controller, so what sense would it make?
Probably not much sense. I was thinking of a progression to user assisted scanning. In that a driver could never call scsi_scan_host directly and conversely never call scsi_forget_host directly.
But in the removal case there is not much response a user space hotplug handler could make besides a delayed call to scsi_remove_device.
Quoted 4 lines
Philosophically speaking, scanning is an operation that cannot be simply undone. You can undo device/driver bindings but you cannot undo a bus scan.
Maybe it was a confusing choice of words. The operation I was describing was to undo the binding.
-andmike
--
Michael Anderson
[email protected]