Lines Matching defs:shost

121 	struct Scsi_Host *shost;
149 data->shost = NULL;
209 * Stores the @shost, @channel, @id, and @lun in the scsi_Device, and
220 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
222 sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size,
230 sdev->host = shost;
284 if (shost->hostt->slave_alloc) {
285 ret = shost->hostt->slave_alloc(sdev);
310 struct Scsi_Host *shost = dev_to_shost(dev->parent);
316 spin_lock_irqsave(shost->host_lock, flags);
317 if (shost->hostt->target_destroy)
318 shost->hostt->target_destroy(starget);
320 spin_unlock_irqrestore(shost->host_lock, flags);
348 struct Scsi_Host *shost = dev_to_shost(parent);
352 list_for_each_entry(starget, &shost->__targets, siblings) {
412 struct Scsi_Host *shost = dev_to_shost(parent);
416 + shost->transportt->target_size;
430 dev_set_name(dev, "target%d:%d:%d", shost->host_no, channel, id);
442 spin_lock_irqsave(shost->host_lock, flags);
448 list_add_tail(&starget->siblings, &shost->__targets);
449 spin_unlock_irqrestore(shost->host_lock, flags);
452 if (shost->hostt->target_alloc) {
453 error = shost->hostt->target_alloc(starget);
476 spin_unlock_irqrestore(shost->host_lock, flags);
1053 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
1083 ((shost->unchecked_isa_dma) ? __GFP_DMA : 0));
1156 res = scsi_add_lun(sdev, result, &bflags, shost->async_scan);
1202 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
1207 max_dev_lun = min(max_scsi_luns, shost->max_lun);
1214 max_dev_lun = shost->max_lun;
1241 max_dev_lun = shost->max_lun;
1300 struct Scsi_Host *shost = dev_to_shost(&starget->dev);
1315 (!(bflags & BLIST_REPORTLUN2) || shost->max_lun <= 8))
1459 struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel,
1463 struct device *parent = &shost->shost_gendev;
1474 mutex_lock(&shost->scan_mutex);
1475 if (!shost->async_scan)
1478 if (scsi_host_scan_allowed(shost) && scsi_autopm_get_host(shost) == 0) {
1480 scsi_autopm_put_host(shost);
1482 mutex_unlock(&shost->scan_mutex);
1533 struct Scsi_Host *shost = dev_to_shost(parent);
1538 if (shost->this_id == id)
1604 struct Scsi_Host *shost = dev_to_shost(parent);
1613 mutex_lock(&shost->scan_mutex);
1614 if (!shost->async_scan)
1617 if (scsi_host_scan_allowed(shost) && scsi_autopm_get_host(shost) == 0) {
1619 scsi_autopm_put_host(shost);
1621 mutex_unlock(&shost->scan_mutex);
1625 static void scsi_scan_channel(struct Scsi_Host *shost, unsigned int channel,
1632 for (id = 0; id < shost->max_id; ++id) {
1638 * XXX add a shost id iterator, so for example,
1642 if (shost->reverse_ordering)
1646 order_id = shost->max_id - id - 1;
1649 __scsi_scan_target(&shost->shost_gendev, channel,
1653 __scsi_scan_target(&shost->shost_gendev, channel,
1657 int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel,
1661 SCSI_LOG_SCAN_BUS(3, shost_printk (KERN_INFO, shost,
1665 if (((channel != SCAN_WILD_CARD) && (channel > shost->max_channel)) ||
1666 ((id != SCAN_WILD_CARD) && (id >= shost->max_id)) ||
1667 ((lun != SCAN_WILD_CARD) && (lun >= shost->max_lun)))
1670 mutex_lock(&shost->scan_mutex);
1671 if (!shost->async_scan)
1674 if (scsi_host_scan_allowed(shost) && scsi_autopm_get_host(shost) == 0) {
1676 for (channel = 0; channel <= shost->max_channel;
1678 scsi_scan_channel(shost, channel, id, lun,
1681 scsi_scan_channel(shost, channel, id, lun, rescan);
1682 scsi_autopm_put_host(shost);
1684 mutex_unlock(&shost->scan_mutex);
1689 static void scsi_sysfs_add_devices(struct Scsi_Host *shost)
1692 shost_for_each_device(sdev, shost) {
1699 if (!scsi_host_scan_allowed(shost) ||
1707 * @shost: the host which will be scanned
1715 static struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost)
1723 mutex_lock(&shost->scan_mutex);
1724 if (shost->async_scan) {
1725 shost_printk(KERN_DEBUG, shost, "%s called twice\n", __func__);
1732 data->shost = scsi_host_get(shost);
1733 if (!data->shost)
1737 spin_lock_irqsave(shost->host_lock, flags);
1738 shost->async_scan = 1;
1739 spin_unlock_irqrestore(shost->host_lock, flags);
1740 mutex_unlock(&shost->scan_mutex);
1751 mutex_unlock(&shost->scan_mutex);
1766 struct Scsi_Host *shost;
1772 shost = data->shost;
1774 mutex_lock(&shost->scan_mutex);
1776 if (!shost->async_scan) {
1777 shost_printk(KERN_INFO, shost, "%s called twice\n", __func__);
1779 mutex_unlock(&shost->scan_mutex);
1785 scsi_sysfs_add_devices(shost);
1787 spin_lock_irqsave(shost->host_lock, flags);
1788 shost->async_scan = 0;
1789 spin_unlock_irqrestore(shost->host_lock, flags);
1791 mutex_unlock(&shost->scan_mutex);
1802 scsi_autopm_put_host(shost);
1803 scsi_host_put(shost);
1807 static void do_scsi_scan_host(struct Scsi_Host *shost)
1809 if (shost->hostt->scan_finished) {
1811 if (shost->hostt->scan_start)
1812 shost->hostt->scan_start(shost);
1814 while (!shost->hostt->scan_finished(shost, jiffies - start))
1817 scsi_scan_host_selected(shost, SCAN_WILD_CARD, SCAN_WILD_CARD,
1825 struct Scsi_Host *shost = data->shost;
1827 do_scsi_scan_host(shost);
1833 * @shost: adapter to scan
1835 void scsi_scan_host(struct Scsi_Host *shost)
1842 if (scsi_autopm_get_host(shost) < 0)
1845 data = scsi_prep_async_scan(shost);
1847 do_scsi_scan_host(shost);
1848 scsi_autopm_put_host(shost);
1857 /* scsi_autopm_put_host(shost) is called in scsi_finish_async_scan() */
1861 void scsi_forget_host(struct Scsi_Host *shost)
1867 spin_lock_irqsave(shost->host_lock, flags);
1868 list_for_each_entry(sdev, &shost->__devices, siblings) {
1871 spin_unlock_irqrestore(shost->host_lock, flags);
1875 spin_unlock_irqrestore(shost->host_lock, flags);
1880 * @shost: Host that needs a scsi_device
1895 struct scsi_device *scsi_get_host_dev(struct Scsi_Host *shost)
1900 mutex_lock(&shost->scan_mutex);
1901 if (!scsi_host_scan_allowed(shost))
1903 starget = scsi_alloc_target(&shost->shost_gendev, 0, shost->this_id);
1914 mutex_unlock(&shost->scan_mutex);