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)
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;
}
......
......@@ -218,7 +218,8 @@ NCR_D700_probe_one(struct NCR_D700_private *p, int siop,
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;
......
......@@ -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 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 @@ NCR_Q720_probe_one(struct NCR_Q720_private *p, int siop,
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;
......
......@@ -636,7 +636,8 @@ static int aha1740_probe (struct device *dev)
}
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:
......
......@@ -2173,7 +2173,8 @@ ahd_linux_register_host(struct ahd_softc *ahd, Scsi_Host_Template *template)
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);
}
......
......@@ -1811,7 +1811,8 @@ ahc_linux_register_host(struct ahc_softc *ahc, Scsi_Host_Template *template)
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);
}
......
......@@ -3043,9 +3043,13 @@ acornscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
acornscsi_resetcard(ashost);
ret = scsi_add_host(host, &ec->dev);
if (ret == 0)
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);
......
......@@ -297,9 +297,13 @@ cumanascsi1_probe(struct expansion_card *ec, const struct ecard_id *id)
printk("\n");
ret = scsi_add_host(host, &ec->dev);
if (ret == 0)
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);
......
......@@ -205,7 +205,8 @@ static int __init ecoscsi_init(void)
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:
......
......@@ -2861,6 +2861,8 @@ int fas216_add(struct Scsi_Host *host, struct device *dev)
ret = scsi_add_host(host, dev);
if (ret)
fas216_writeb(info, REG_CMD, CMD_RESETCHIP);
else
scsi_scan_host(host);
return ret;
}
......
......@@ -158,9 +158,13 @@ oakscsi_probe(struct expansion_card *ec, const struct ecard_id *id)
printk("\n");
ret = scsi_add_host(host, &ec->dev);
if (ret == 0)
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);
......
......@@ -6214,7 +6214,8 @@ int __devinit dc395x_init_one(struct pci_dev *pdev,
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;
}
......
......@@ -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,
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;
}
......
......@@ -978,8 +978,10 @@ static int idescsi_attach(ide_drive_t *drive)
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);
}
......
......@@ -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...) \
......
......@@ -128,7 +128,8 @@ lasi700_driver_callback(struct parisc_device *dev)
}
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;
......
......@@ -1820,7 +1820,8 @@ static int nsp32_detect(struct pci_dev *pdev)
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;
......
......@@ -278,7 +278,8 @@ static void aha152x_config_cs(dev_link_t *link)
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;
......
......@@ -254,7 +254,8 @@ static void fdomain_config(dev_link_t *link)
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;
......
......@@ -1773,7 +1773,8 @@ static void nsp_cs_config(dev_link_t *link)
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;
......
......@@ -270,7 +270,8 @@ static void qlogic_config(dev_link_t * link)
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;
......
......@@ -1701,7 +1701,8 @@ static int sdebug_driver_probe(struct device * dev)
printk(KERN_ERR "%s: scsi_add_host failed\n", __FUNCTION__);
error = -ENODEV;
scsi_host_put(hpnt);
}
} else
scsi_scan_host(hpnt);
return error;
......
......@@ -40,6 +40,7 @@ static int __init init_this_scsi_driver(void)
error = scsi_add_host(shost, NULL);
if (error)
goto fail;
scsi_scan_host(shost);
}
return 0;
fail:
......
......@@ -102,7 +102,6 @@ extern void scsi_exit_procfs(void);
#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 *);
......
......@@ -34,6 +34,7 @@ EXPORT_SYMBOL(scsi_register_driver);
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);
......
......@@ -606,35 +606,8 @@ static int sd_media_changed(struct gendisk *disk)
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 = {
......
......@@ -138,7 +138,8 @@ sim710_probe_common(struct device *dev, unsigned long base_addr,
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;
......
......@@ -85,7 +85,7 @@ zalon_scsi_callback(struct parisc_device *dev)
{
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 @@ zalon_scsi_callback(struct parisc_device *dev)
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[] = {
......
......@@ -109,7 +109,8 @@ hpusbscsi_usb_probe(struct usb_interface *intf,
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;
......
......@@ -817,7 +817,8 @@ static int mts_usb_probe(struct usb_interface *intf,
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;
......
......@@ -958,6 +958,8 @@ static int storage_probe(struct usb_interface *intf,
goto BadDevice;
}
scsi_scan_host(us->host);
printk(KERN_DEBUG
"WARNING: USB Mass Storage data integrity not assured\n");
printk(KERN_DEBUG
......
......@@ -477,6 +477,7 @@ struct Scsi_Host {
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);
......
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