Commit 892af51c authored by Christoph Hellwig's avatar Christoph Hellwig

[PATCH] 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.
parent a1b6bcff
...@@ -712,7 +712,8 @@ cciss_scsi_detect(int ctlr) ...@@ -712,7 +712,8 @@ cciss_scsi_detect(int ctlr)
sh->hostdata[0] = (unsigned long) hba[ctlr]; sh->hostdata[0] = (unsigned long) hba[ctlr];
sh->irq = hba[ctlr]->intr; sh->irq = hba[ctlr]->intr;
sh->unique_id = sh->irq; 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; return 1;
} }
......
...@@ -218,7 +218,8 @@ NCR_D700_probe_one(struct NCR_D700_private *p, int siop, ...@@ -218,7 +218,8 @@ NCR_D700_probe_one(struct NCR_D700_private *p, int siop,
goto irq_failed; 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; p->hosts[siop] = host;
hostdata->dev = p->dev; hostdata->dev = p->dev;
......
...@@ -85,6 +85,7 @@ NCR_Q720_probe_one(struct NCR_Q720_private *p, int siop, ...@@ -85,6 +85,7 @@ NCR_Q720_probe_one(struct NCR_Q720_private *p, int siop,
__u8 scsr1 = readb(vaddr + NCR_Q720_SCSR_OFFSET + 1); __u8 scsr1 = readb(vaddr + NCR_Q720_SCSR_OFFSET + 1);
__u8 differential = readb(vaddr + NCR_Q720_SCSR_OFFSET) & 0x20; __u8 differential = readb(vaddr + NCR_Q720_SCSR_OFFSET) & 0x20;
__u8 version; __u8 version;
int error;
scsi_id = scsr1 >> 4; scsi_id = scsr1 >> 4;
/* enable burst length 16 (FIXME: should allow this) */ /* enable burst length 16 (FIXME: should allow this) */
...@@ -120,9 +121,12 @@ NCR_Q720_probe_one(struct NCR_Q720_private *p, int siop, ...@@ -120,9 +121,12 @@ NCR_Q720_probe_one(struct NCR_Q720_private *p, int siop,
scsr1 &= ~0x01; scsr1 &= ~0x01;
writeb(scsr1, vaddr + NCR_Q720_SCSR_OFFSET + 1); writeb(scsr1, vaddr + NCR_Q720_SCSR_OFFSET + 1);
scsi_add_host(p->hosts[siop], p->dev); error = scsi_add_host(p->hosts[siop], p->dev);
if (error)
return 0; ncr53c8xx_release(p->hosts[siop]);
else
scsi_scan_host(p->hosts[siop]);
return error;
fail: fail:
return -ENODEV; return -ENODEV;
......
...@@ -636,7 +636,8 @@ static int aha1740_probe (struct device *dev) ...@@ -636,7 +636,8 @@ static int aha1740_probe (struct device *dev)
} }
eisa_set_drvdata (edev, shpnt); eisa_set_drvdata (edev, shpnt);
scsi_add_host (shpnt, dev); scsi_add_host (shpnt, dev); /* XXX handle failure */
scsi_scan_host (shpnt)
return 0; return 0;
err_unmap: err_unmap:
......
...@@ -2173,7 +2173,8 @@ ahd_linux_register_host(struct ahd_softc *ahd, Scsi_Host_Template *template) ...@@ -2173,7 +2173,8 @@ ahd_linux_register_host(struct ahd_softc *ahd, Scsi_Host_Template *template)
ahd_unlock(ahd, &s); ahd_unlock(ahd, &s);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) #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 #endif
return (0); return (0);
} }
......
...@@ -1811,7 +1811,8 @@ ahc_linux_register_host(struct ahc_softc *ahc, Scsi_Host_Template *template) ...@@ -1811,7 +1811,8 @@ ahc_linux_register_host(struct ahc_softc *ahc, Scsi_Host_Template *template)
ahc_unlock(ahc, &s); ahc_unlock(ahc, &s);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) #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 #endif
return (0); return (0);
} }
......
...@@ -3043,9 +3043,13 @@ acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -3043,9 +3043,13 @@ acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
acornscsi_resetcard(ashost); acornscsi_resetcard(ashost);
ret = scsi_add_host(host, &ec->dev); ret = scsi_add_host(host, &ec->dev);
if (ret == 0) if (ret)
goto out; goto err_7;
scsi_scan_host(host);
goto out;
err_7:
free_irq(host->irq, ashost); free_irq(host->irq, ashost);
err_6: err_6:
release_region(host->io_port, 2048); release_region(host->io_port, 2048);
......
...@@ -297,9 +297,13 @@ cumanascsi1_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -297,9 +297,13 @@ cumanascsi1_probe(struct expansion_card *ec, const struct ecard_id *id)
printk("\n"); printk("\n");
ret = scsi_add_host(host, &ec->dev); ret = scsi_add_host(host, &ec->dev);
if (ret == 0) if (ret)
goto out; goto out_free_irq;
scsi_scan_host(host);
goto out;
out_free_irq:
free_irq(host->irq, host); free_irq(host->irq, host);
out_release: out_release:
release_region(host->io_port, host->n_io_port); release_region(host->io_port, host->n_io_port);
......
...@@ -205,7 +205,8 @@ static int __init ecoscsi_init(void) ...@@ -205,7 +205,8 @@ static int __init ecoscsi_init(void)
NCR5380_print_options(host); NCR5380_print_options(host);
printk("\n"); printk("\n");
scsi_add_host(host, NULL); scsi_add_host(host, NULL); /* XXX handle failure */
scsi_scan_host(host);
return 0; return 0;
release_reg: release_reg:
......
...@@ -2861,6 +2861,8 @@ int fas216_add(struct Scsi_Host *host, struct device *dev) ...@@ -2861,6 +2861,8 @@ int fas216_add(struct Scsi_Host *host, struct device *dev)
ret = scsi_add_host(host, dev); ret = scsi_add_host(host, dev);
if (ret) if (ret)
fas216_writeb(info, REG_CMD, CMD_RESETCHIP); fas216_writeb(info, REG_CMD, CMD_RESETCHIP);
else
scsi_scan_host(host);
return ret; return ret;
} }
......
...@@ -158,9 +158,13 @@ oakscsi_probe(struct expansion_card *ec, const struct ecard_id *id) ...@@ -158,9 +158,13 @@ oakscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
printk("\n"); printk("\n");
ret = scsi_add_host(host, &ec->dev); ret = scsi_add_host(host, &ec->dev);
if (ret == 0) if (ret)
goto out; goto out_release;
scsi_scan_host(host);
goto out;
out_release:
release_region(host->io_port, host->n_io_port); release_region(host->io_port, host->n_io_port);
unreg: unreg:
scsi_host_put(host); scsi_host_put(host);
......
...@@ -6214,7 +6214,8 @@ int __devinit dc395x_init_one(struct pci_dev *pdev, ...@@ -6214,7 +6214,8 @@ int __devinit dc395x_init_one(struct pci_dev *pdev,
pci_set_drvdata(pdev, scsi_host); pci_set_drvdata(pdev, scsi_host);
/* get the scsi mid level to scan for new devices on the bus */ /* 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; return 0;
} }
......
...@@ -81,19 +81,15 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev) ...@@ -81,19 +81,15 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
printk(KERN_INFO "scsi%d : %s\n", shost->host_no, printk(KERN_INFO "scsi%d : %s\n", shost->host_no,
sht->info ? sht->info(shost) : sht->name); sht->info ? sht->info(shost) : sht->name);
error = scsi_sysfs_add_host(shost, dev);
if (!shost->can_queue) { if (!shost->can_queue) {
printk(KERN_ERR "%s: can_queue = 0 no longer supported\n", printk(KERN_ERR "%s: can_queue = 0 no longer supported\n",
sht->name); sht->name);
error = -EINVAL; error = -EINVAL;
} }
if (!error) { error = scsi_sysfs_add_host(shost, dev);
if (!error)
scsi_proc_host_add(shost); scsi_proc_host_add(shost);
scsi_scan_host(shost);
}
return error; return error;
} }
......
...@@ -978,8 +978,10 @@ static int idescsi_attach(ide_drive_t *drive) ...@@ -978,8 +978,10 @@ static int idescsi_attach(ide_drive_t *drive)
idescsi_setup (drive, idescsi); idescsi_setup (drive, idescsi);
drive->disk->fops = &idescsi_ops; drive->disk->fops = &idescsi_ops;
err = scsi_add_host(host, &idescsi_primary); err = scsi_add_host(host, &idescsi_primary);
if (!err) if (!err) {
scsi_scan_host(host);
return 0; return 0;
}
/* fall through on error */ /* fall through on error */
ide_unregister_subdriver(drive); ide_unregister_subdriver(drive);
} }
......
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
#else #else
#define IPS_REGISTER_HOSTS(SHT) (!ips_detect(SHT)) #define IPS_REGISTER_HOSTS(SHT) (!ips_detect(SHT))
#define IPS_UNREGISTER_HOSTS(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_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) scsi_set_device(sh, &(ha)->pcidev->dev)
#define IPS_PRINTK(level, pcidev, format, arg...) \ #define IPS_PRINTK(level, pcidev, format, arg...) \
......
...@@ -128,7 +128,8 @@ lasi700_driver_callback(struct parisc_device *dev) ...@@ -128,7 +128,8 @@ lasi700_driver_callback(struct parisc_device *dev)
} }
dev_set_drvdata(&dev->dev, host); 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; return 0;
......
...@@ -1820,7 +1820,8 @@ static int nsp32_detect(struct pci_dev *pdev) ...@@ -1820,7 +1820,8 @@ static int nsp32_detect(struct pci_dev *pdev)
goto free_irq; 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); pci_set_drvdata(pdev, host);
return 0; return 0;
......
...@@ -278,7 +278,8 @@ static void aha152x_config_cs(dev_link_t *link) ...@@ -278,7 +278,8 @@ static void aha152x_config_cs(dev_link_t *link)
goto cs_failed; 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); sprintf(info->node.dev_name, "scsi%d", host->host_no);
link->dev = &info->node; link->dev = &info->node;
......
...@@ -254,7 +254,8 @@ static void fdomain_config(dev_link_t *link) ...@@ -254,7 +254,8 @@ static void fdomain_config(dev_link_t *link)
goto cs_failed; 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); sprintf(info->node.dev_name, "scsi%d", host->host_no);
link->dev = &info->node; link->dev = &info->node;
......
...@@ -1773,7 +1773,8 @@ static void nsp_cs_config(dev_link_t *link) ...@@ -1773,7 +1773,8 @@ static void nsp_cs_config(dev_link_t *link)
req.Base+req.Size-1); req.Base+req.Size-1);
printk("\n"); printk("\n");
scsi_add_host(host, NULL); scsi_add_host(host, NULL); /* XXX handle failure */
scsi_scan_host(host);
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
return; return;
......
...@@ -270,7 +270,8 @@ static void qlogic_config(dev_link_t * link) ...@@ -270,7 +270,8 @@ static void qlogic_config(dev_link_t * link)
link->dev = &info->node; link->dev = &info->node;
info->host = host; info->host = host;
scsi_add_host(host, NULL); scsi_add_host(host, NULL); /* XXX handle failure */
scsi_scan_host(host);
out: out:
link->state &= ~DEV_CONFIG_PENDING; link->state &= ~DEV_CONFIG_PENDING;
......
...@@ -1701,7 +1701,8 @@ static int sdebug_driver_probe(struct device * dev) ...@@ -1701,7 +1701,8 @@ static int sdebug_driver_probe(struct device * dev)
printk(KERN_ERR "%s: scsi_add_host failed\n", __FUNCTION__); printk(KERN_ERR "%s: scsi_add_host failed\n", __FUNCTION__);
error = -ENODEV; error = -ENODEV;
scsi_host_put(hpnt); scsi_host_put(hpnt);
} } else
scsi_scan_host(hpnt);
return error; return error;
......
...@@ -40,6 +40,7 @@ static int __init init_this_scsi_driver(void) ...@@ -40,6 +40,7 @@ static int __init init_this_scsi_driver(void)
error = scsi_add_host(shost, NULL); error = scsi_add_host(shost, NULL);
if (error) if (error)
goto fail; goto fail;
scsi_scan_host(shost);
} }
return 0; return 0;
fail: fail:
......
...@@ -102,7 +102,6 @@ extern void scsi_exit_procfs(void); ...@@ -102,7 +102,6 @@ extern void scsi_exit_procfs(void);
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
/* scsi_scan.c */ /* scsi_scan.c */
extern void scsi_scan_host(struct Scsi_Host *);
extern void scsi_forget_host(struct Scsi_Host *); extern void scsi_forget_host(struct Scsi_Host *);
extern void scsi_free_sdev(struct scsi_device *); extern void scsi_free_sdev(struct scsi_device *);
extern void scsi_free_shost(struct Scsi_Host *); extern void scsi_free_shost(struct Scsi_Host *);
......
...@@ -34,6 +34,7 @@ EXPORT_SYMBOL(scsi_register_driver); ...@@ -34,6 +34,7 @@ EXPORT_SYMBOL(scsi_register_driver);
EXPORT_SYMBOL(scsi_register_interface); EXPORT_SYMBOL(scsi_register_interface);
EXPORT_SYMBOL(scsi_host_alloc); EXPORT_SYMBOL(scsi_host_alloc);
EXPORT_SYMBOL(scsi_add_host); EXPORT_SYMBOL(scsi_add_host);
EXPORT_SYMBOL(scsi_scan_host);
EXPORT_SYMBOL(scsi_remove_host); EXPORT_SYMBOL(scsi_remove_host);
EXPORT_SYMBOL(scsi_host_get); EXPORT_SYMBOL(scsi_host_get);
EXPORT_SYMBOL(scsi_host_put); EXPORT_SYMBOL(scsi_host_put);
......
...@@ -606,35 +606,8 @@ static int sd_media_changed(struct gendisk *disk) ...@@ -606,35 +606,8 @@ static int sd_media_changed(struct gendisk *disk)
static void sd_rescan(struct device *dev) static void sd_rescan(struct device *dev)
{ {
struct scsi_device *sdp = to_scsi_device(dev);
struct scsi_disk *sdkp = dev_get_drvdata(dev); struct scsi_disk *sdkp = dev_get_drvdata(dev);
struct gendisk *gd; sd_revalidate_disk(sdkp->disk);
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);
} }
static struct block_device_operations sd_fops = { static struct block_device_operations sd_fops = {
......
...@@ -138,7 +138,8 @@ sim710_probe_common(struct device *dev, unsigned long base_addr, ...@@ -138,7 +138,8 @@ sim710_probe_common(struct device *dev, unsigned long base_addr,
goto out_unregister; goto out_unregister;
} }
scsi_add_host(host, dev); scsi_add_host(host, dev); /* XXX handle failure */
scsi_scan_host(host);
hostdata->dev = dev; hostdata->dev = dev;
return 0; return 0;
......
...@@ -85,7 +85,7 @@ zalon_scsi_callback(struct parisc_device *dev) ...@@ -85,7 +85,7 @@ zalon_scsi_callback(struct parisc_device *dev)
{ {
struct gsc_irq gsc_irq; struct gsc_irq gsc_irq;
u32 zalon_vers; u32 zalon_vers;
int irq; int irq, error = -ENODEV;
unsigned long zalon = dev->hpa; unsigned long zalon = dev->hpa;
unsigned long io_port = zalon + GSC_SCSI_ZALON_OFFSET; unsigned long io_port = zalon + GSC_SCSI_ZALON_OFFSET;
static int unit = 0; static int unit = 0;
...@@ -147,11 +147,18 @@ zalon_scsi_callback(struct parisc_device *dev) ...@@ -147,11 +147,18 @@ zalon_scsi_callback(struct parisc_device *dev)
dev_set_drvdata(&dev->dev, host); 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; return 0;
fail_free_irq:
free_irq(irq, host);
fail: fail:
return -ENODEV; ncr53c8xx_release(host);
return error;
} }
static struct parisc_device_id zalon_tbl[] = { static struct parisc_device_id zalon_tbl[] = {
......
...@@ -109,7 +109,8 @@ hpusbscsi_usb_probe(struct usb_interface *intf, ...@@ -109,7 +109,8 @@ hpusbscsi_usb_probe(struct usb_interface *intf,
goto out_unlink_controlurb; goto out_unlink_controlurb;
new->host->hostdata[0] = (unsigned long)new; 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[0] = REQUEST_SENSE;
new->sense_command[4] = HPUSBSCSI_SENSE_LENGTH; new->sense_command[4] = HPUSBSCSI_SENSE_LENGTH;
......
...@@ -817,7 +817,8 @@ static int mts_usb_probe(struct usb_interface *intf, ...@@ -817,7 +817,8 @@ static int mts_usb_probe(struct usb_interface *intf,
goto out_free_urb; goto out_free_urb;
new_desc->host->hostdata[0] = (unsigned long)new_desc; 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); usb_set_intfdata(intf, new_desc);
return 0; return 0;
......
...@@ -958,6 +958,8 @@ static int storage_probe(struct usb_interface *intf, ...@@ -958,6 +958,8 @@ static int storage_probe(struct usb_interface *intf,
goto BadDevice; goto BadDevice;
} }
scsi_scan_host(us->host);
printk(KERN_DEBUG printk(KERN_DEBUG
"WARNING: USB Mass Storage data integrity not assured\n"); "WARNING: USB Mass Storage data integrity not assured\n");
printk(KERN_DEBUG printk(KERN_DEBUG
......
...@@ -477,6 +477,7 @@ struct Scsi_Host { ...@@ -477,6 +477,7 @@ struct Scsi_Host {
extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int); extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int);
extern int scsi_add_host(struct Scsi_Host *, struct device *); 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 int scsi_remove_host(struct Scsi_Host *);
extern void scsi_host_get(struct Scsi_Host *); extern void scsi_host_get(struct Scsi_Host *);
extern void scsi_host_put(struct Scsi_Host *t); extern void scsi_host_put(struct Scsi_Host *t);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment