Lines Matching refs:shost

121 	struct Scsi_Host *shost;  member
149 data->shost = NULL; in scsi_complete_async_scans()
221 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in scsi_alloc_sdev() local
223 sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size, in scsi_alloc_sdev()
231 sdev->host = shost; in scsi_alloc_sdev()
302 if (shost->hostt->slave_alloc) { in scsi_alloc_sdev()
303 ret = shost->hostt->slave_alloc(sdev); in scsi_alloc_sdev()
328 struct Scsi_Host *shost = dev_to_shost(dev->parent); in scsi_target_destroy() local
334 spin_lock_irqsave(shost->host_lock, flags); in scsi_target_destroy()
335 if (shost->hostt->target_destroy) in scsi_target_destroy()
336 shost->hostt->target_destroy(starget); in scsi_target_destroy()
338 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_target_destroy()
366 struct Scsi_Host *shost = dev_to_shost(parent); in __scsi_find_target() local
370 list_for_each_entry(starget, &shost->__targets, siblings) { in __scsi_find_target()
430 struct Scsi_Host *shost = dev_to_shost(parent); in scsi_alloc_target() local
434 + shost->transportt->target_size; in scsi_alloc_target()
448 dev_set_name(dev, "target%d:%d:%d", shost->host_no, channel, id); in scsi_alloc_target()
460 spin_lock_irqsave(shost->host_lock, flags); in scsi_alloc_target()
466 list_add_tail(&starget->siblings, &shost->__targets); in scsi_alloc_target()
467 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_alloc_target()
470 if (shost->hostt->target_alloc) { in scsi_alloc_target()
471 error = shost->hostt->target_alloc(starget); in scsi_alloc_target()
493 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_alloc_target()
1071 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in scsi_probe_and_add_lun() local
1174 res = scsi_add_lun(sdev, result, &bflags, shost->async_scan); in scsi_probe_and_add_lun()
1220 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in scsi_sequential_lun_scan() local
1225 max_dev_lun = min(max_scsi_luns, shost->max_lun); in scsi_sequential_lun_scan()
1232 max_dev_lun = shost->max_lun; in scsi_sequential_lun_scan()
1259 max_dev_lun = shost->max_lun; in scsi_sequential_lun_scan()
1318 struct Scsi_Host *shost = dev_to_shost(&starget->dev); in scsi_report_lun_scan() local
1333 (!(bflags & BLIST_REPORTLUN2) || shost->max_lun <= 8)) in scsi_report_lun_scan()
1476 struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel, in __scsi_add_device() argument
1480 struct device *parent = &shost->shost_gendev; in __scsi_add_device()
1491 mutex_lock(&shost->scan_mutex); in __scsi_add_device()
1492 if (!shost->async_scan) in __scsi_add_device()
1495 if (scsi_host_scan_allowed(shost) && scsi_autopm_get_host(shost) == 0) { in __scsi_add_device()
1497 scsi_autopm_put_host(shost); in __scsi_add_device()
1499 mutex_unlock(&shost->scan_mutex); in __scsi_add_device()
1550 struct Scsi_Host *shost = dev_to_shost(parent); in __scsi_scan_target() local
1555 if (shost->this_id == id) in __scsi_scan_target()
1621 struct Scsi_Host *shost = dev_to_shost(parent); in scsi_scan_target() local
1630 mutex_lock(&shost->scan_mutex); in scsi_scan_target()
1631 if (!shost->async_scan) in scsi_scan_target()
1634 if (scsi_host_scan_allowed(shost) && scsi_autopm_get_host(shost) == 0) { in scsi_scan_target()
1636 scsi_autopm_put_host(shost); in scsi_scan_target()
1638 mutex_unlock(&shost->scan_mutex); in scsi_scan_target()
1642 static void scsi_scan_channel(struct Scsi_Host *shost, unsigned int channel, in scsi_scan_channel() argument
1649 for (id = 0; id < shost->max_id; ++id) { in scsi_scan_channel()
1659 if (shost->reverse_ordering) in scsi_scan_channel()
1663 order_id = shost->max_id - id - 1; in scsi_scan_channel()
1666 __scsi_scan_target(&shost->shost_gendev, channel, in scsi_scan_channel()
1670 __scsi_scan_target(&shost->shost_gendev, channel, in scsi_scan_channel()
1674 int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel, in scsi_scan_host_selected() argument
1678 SCSI_LOG_SCAN_BUS(3, shost_printk (KERN_INFO, shost, in scsi_scan_host_selected()
1682 if (((channel != SCAN_WILD_CARD) && (channel > shost->max_channel)) || in scsi_scan_host_selected()
1683 ((id != SCAN_WILD_CARD) && (id >= shost->max_id)) || in scsi_scan_host_selected()
1684 ((lun != SCAN_WILD_CARD) && (lun >= shost->max_lun))) in scsi_scan_host_selected()
1687 mutex_lock(&shost->scan_mutex); in scsi_scan_host_selected()
1688 if (!shost->async_scan) in scsi_scan_host_selected()
1691 if (scsi_host_scan_allowed(shost) && scsi_autopm_get_host(shost) == 0) { in scsi_scan_host_selected()
1693 for (channel = 0; channel <= shost->max_channel; in scsi_scan_host_selected()
1695 scsi_scan_channel(shost, channel, id, lun, in scsi_scan_host_selected()
1698 scsi_scan_channel(shost, channel, id, lun, rescan); in scsi_scan_host_selected()
1699 scsi_autopm_put_host(shost); in scsi_scan_host_selected()
1701 mutex_unlock(&shost->scan_mutex); in scsi_scan_host_selected()
1706 static void scsi_sysfs_add_devices(struct Scsi_Host *shost) in scsi_sysfs_add_devices() argument
1709 shost_for_each_device(sdev, shost) { in scsi_sysfs_add_devices()
1716 if (!scsi_host_scan_allowed(shost) || in scsi_sysfs_add_devices()
1732 static struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost) in scsi_prep_async_scan() argument
1740 mutex_lock(&shost->scan_mutex); in scsi_prep_async_scan()
1741 if (shost->async_scan) { in scsi_prep_async_scan()
1742 shost_printk(KERN_DEBUG, shost, "%s called twice\n", __func__); in scsi_prep_async_scan()
1749 data->shost = scsi_host_get(shost); in scsi_prep_async_scan()
1750 if (!data->shost) in scsi_prep_async_scan()
1754 spin_lock_irqsave(shost->host_lock, flags); in scsi_prep_async_scan()
1755 shost->async_scan = 1; in scsi_prep_async_scan()
1756 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_prep_async_scan()
1757 mutex_unlock(&shost->scan_mutex); in scsi_prep_async_scan()
1768 mutex_unlock(&shost->scan_mutex); in scsi_prep_async_scan()
1783 struct Scsi_Host *shost; in scsi_finish_async_scan() local
1789 shost = data->shost; in scsi_finish_async_scan()
1791 mutex_lock(&shost->scan_mutex); in scsi_finish_async_scan()
1793 if (!shost->async_scan) { in scsi_finish_async_scan()
1794 shost_printk(KERN_INFO, shost, "%s called twice\n", __func__); in scsi_finish_async_scan()
1796 mutex_unlock(&shost->scan_mutex); in scsi_finish_async_scan()
1802 scsi_sysfs_add_devices(shost); in scsi_finish_async_scan()
1804 spin_lock_irqsave(shost->host_lock, flags); in scsi_finish_async_scan()
1805 shost->async_scan = 0; in scsi_finish_async_scan()
1806 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_finish_async_scan()
1808 mutex_unlock(&shost->scan_mutex); in scsi_finish_async_scan()
1819 scsi_autopm_put_host(shost); in scsi_finish_async_scan()
1820 scsi_host_put(shost); in scsi_finish_async_scan()
1824 static void do_scsi_scan_host(struct Scsi_Host *shost) in do_scsi_scan_host() argument
1826 if (shost->hostt->scan_finished) { in do_scsi_scan_host()
1828 if (shost->hostt->scan_start) in do_scsi_scan_host()
1829 shost->hostt->scan_start(shost); in do_scsi_scan_host()
1831 while (!shost->hostt->scan_finished(shost, jiffies - start)) in do_scsi_scan_host()
1834 scsi_scan_host_selected(shost, SCAN_WILD_CARD, SCAN_WILD_CARD, in do_scsi_scan_host()
1842 struct Scsi_Host *shost = data->shost; in do_scan_async() local
1844 do_scsi_scan_host(shost); in do_scan_async()
1852 void scsi_scan_host(struct Scsi_Host *shost) in scsi_scan_host() argument
1859 if (scsi_autopm_get_host(shost) < 0) in scsi_scan_host()
1862 data = scsi_prep_async_scan(shost); in scsi_scan_host()
1864 do_scsi_scan_host(shost); in scsi_scan_host()
1865 scsi_autopm_put_host(shost); in scsi_scan_host()
1878 void scsi_forget_host(struct Scsi_Host *shost) in scsi_forget_host() argument
1884 spin_lock_irqsave(shost->host_lock, flags); in scsi_forget_host()
1885 list_for_each_entry(sdev, &shost->__devices, siblings) { in scsi_forget_host()
1888 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_forget_host()
1892 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_forget_host()
1912 struct scsi_device *scsi_get_host_dev(struct Scsi_Host *shost) in scsi_get_host_dev() argument
1917 mutex_lock(&shost->scan_mutex); in scsi_get_host_dev()
1918 if (!scsi_host_scan_allowed(shost)) in scsi_get_host_dev()
1920 starget = scsi_alloc_target(&shost->shost_gendev, 0, shost->this_id); in scsi_get_host_dev()
1931 mutex_unlock(&shost->scan_mutex); in scsi_get_host_dev()