Lines Matching refs:shost

132 	struct Scsi_Host *shost;
160 data->shost = NULL;
232 * Stores the @shost, @channel, @id, and @lun in the scsi_Device, and
243 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
247 sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size,
255 sdev->host = shost;
306 if (shost->hostt->slave_alloc) {
307 ret = shost->hostt->slave_alloc(sdev);
332 struct Scsi_Host *shost = dev_to_shost(dev->parent);
336 spin_lock_irqsave(shost->host_lock, flags);
337 if (shost->hostt->target_destroy)
338 shost->hostt->target_destroy(starget);
340 spin_unlock_irqrestore(shost->host_lock, flags);
368 struct Scsi_Host *shost = dev_to_shost(parent);
372 list_for_each_entry(starget, &shost->__targets, siblings) {
400 struct Scsi_Host *shost = dev_to_shost(parent);
404 + shost->transportt->target_size;
418 dev_set_name(dev, "target%d:%d:%d", shost->host_no, channel, id);
430 spin_lock_irqsave(shost->host_lock, flags);
436 list_add_tail(&starget->siblings, &shost->__targets);
437 spin_unlock_irqrestore(shost->host_lock, flags);
440 if (shost->hostt->target_alloc) {
441 error = shost->hostt->target_alloc(starget);
457 spin_unlock_irqrestore(shost->host_lock, flags);
489 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
494 spin_lock_irqsave(shost->host_lock, flags);
500 spin_unlock_irqrestore(shost->host_lock, flags);
1009 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
1039 ((shost->unchecked_isa_dma) ? __GFP_DMA : 0));
1112 res = scsi_add_lun(sdev, result, &bflags, shost->async_scan);
1156 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
1161 max_dev_lun = min(max_scsi_luns, shost->max_lun);
1168 max_dev_lun = shost->max_lun;
1195 max_dev_lun = shost->max_lun;
1318 struct Scsi_Host *shost = dev_to_shost(&starget->dev);
1333 (!(bflags & BLIST_REPORTLUN2) || shost->max_lun <= 8))
1351 shost->host_no, sdev->channel, sdev->id);
1504 struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel,
1508 struct device *parent = &shost->shost_gendev;
1519 mutex_lock(&shost->scan_mutex);
1520 if (!shost->async_scan)
1523 if (scsi_host_scan_allowed(shost) && scsi_autopm_get_host(shost) == 0) {
1525 scsi_autopm_put_host(shost);
1527 mutex_unlock(&shost->scan_mutex);
1568 struct Scsi_Host *shost = dev_to_shost(parent);
1573 if (shost->this_id == id)
1634 struct Scsi_Host *shost = dev_to_shost(parent);
1639 mutex_lock(&shost->scan_mutex);
1640 if (!shost->async_scan)
1643 if (scsi_host_scan_allowed(shost) && scsi_autopm_get_host(shost) == 0) {
1645 scsi_autopm_put_host(shost);
1647 mutex_unlock(&shost->scan_mutex);
1651 static void scsi_scan_channel(struct Scsi_Host *shost, unsigned int channel,
1657 for (id = 0; id < shost->max_id; ++id) {
1663 * XXX add a shost id iterator, so for example,
1667 if (shost->reverse_ordering)
1671 order_id = shost->max_id - id - 1;
1674 __scsi_scan_target(&shost->shost_gendev, channel,
1678 __scsi_scan_target(&shost->shost_gendev, channel,
1682 int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel,
1685 SCSI_LOG_SCAN_BUS(3, shost_printk (KERN_INFO, shost,
1689 if (((channel != SCAN_WILD_CARD) && (channel > shost->max_channel)) ||
1690 ((id != SCAN_WILD_CARD) && (id >= shost->max_id)) ||
1691 ((lun != SCAN_WILD_CARD) && (lun > shost->max_lun)))
1694 mutex_lock(&shost->scan_mutex);
1695 if (!shost->async_scan)
1698 if (scsi_host_scan_allowed(shost) && scsi_autopm_get_host(shost) == 0) {
1700 for (channel = 0; channel <= shost->max_channel;
1702 scsi_scan_channel(shost, channel, id, lun,
1705 scsi_scan_channel(shost, channel, id, lun, rescan);
1706 scsi_autopm_put_host(shost);
1708 mutex_unlock(&shost->scan_mutex);
1713 static void scsi_sysfs_add_devices(struct Scsi_Host *shost)
1716 shost_for_each_device(sdev, shost) {
1717 if (!scsi_host_scan_allowed(shost) ||
1725 * @shost: the host which will be scanned
1733 static struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost)
1741 if (shost->async_scan) {
1743 shost->host_no);
1751 data->shost = scsi_host_get(shost);
1752 if (!data->shost)
1756 mutex_lock(&shost->scan_mutex);
1757 spin_lock_irqsave(shost->host_lock, flags);
1758 shost->async_scan = 1;
1759 spin_unlock_irqrestore(shost->host_lock, flags);
1760 mutex_unlock(&shost->scan_mutex);
1785 struct Scsi_Host *shost;
1791 shost = data->shost;
1793 mutex_lock(&shost->scan_mutex);
1795 if (!shost->async_scan) {
1797 shost->host_no);
1799 mutex_unlock(&shost->scan_mutex);
1805 scsi_sysfs_add_devices(shost);
1807 spin_lock_irqsave(shost->host_lock, flags);
1808 shost->async_scan = 0;
1809 spin_unlock_irqrestore(shost->host_lock, flags);
1811 mutex_unlock(&shost->scan_mutex);
1822 scsi_autopm_put_host(shost);
1823 scsi_host_put(shost);
1827 static void do_scsi_scan_host(struct Scsi_Host *shost)
1829 if (shost->hostt->scan_finished) {
1831 if (shost->hostt->scan_start)
1832 shost->hostt->scan_start(shost);
1834 while (!shost->hostt->scan_finished(shost, jiffies - start))
1837 scsi_scan_host_selected(shost, SCAN_WILD_CARD, SCAN_WILD_CARD,
1845 struct Scsi_Host *shost = data->shost;
1847 do_scsi_scan_host(shost);
1854 * @shost: adapter to scan
1856 void scsi_scan_host(struct Scsi_Host *shost)
1863 if (scsi_autopm_get_host(shost) < 0)
1866 data = scsi_prep_async_scan(shost);
1868 do_scsi_scan_host(shost);
1869 scsi_autopm_put_host(shost);
1873 p = kthread_run(do_scan_async, data, "scsi_scan_%d", shost->host_no);
1876 /* scsi_autopm_put_host(shost) is called in scsi_finish_async_scan() */
1880 void scsi_forget_host(struct Scsi_Host *shost)
1886 spin_lock_irqsave(shost->host_lock, flags);
1887 list_for_each_entry(sdev, &shost->__devices, siblings) {
1890 spin_unlock_irqrestore(shost->host_lock, flags);
1894 spin_unlock_irqrestore(shost->host_lock, flags);
1899 * @shost: Host that needs a scsi_device
1914 struct scsi_device *scsi_get_host_dev(struct Scsi_Host *shost)
1919 mutex_lock(&shost->scan_mutex);
1920 if (!scsi_host_scan_allowed(shost))
1922 starget = scsi_alloc_target(&shost->shost_gendev, 0, shost->this_id);
1933 mutex_unlock(&shost->scan_mutex);