Lines Matching refs:shost

116 	struct Scsi_Host *shost;  member
144 data->shost = NULL; in scsi_complete_async_scans()
215 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in scsi_alloc_sdev() local
219 sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size, in scsi_alloc_sdev()
227 sdev->host = shost; in scsi_alloc_sdev()
264 if (shost_use_blk_mq(shost)) in scsi_alloc_sdev()
280 sdev->host->cmd_per_lun, shost->bqt, in scsi_alloc_sdev()
281 shost->hostt->tag_alloc_policy); in scsi_alloc_sdev()
288 if (shost->hostt->slave_alloc) { in scsi_alloc_sdev()
289 ret = shost->hostt->slave_alloc(sdev); in scsi_alloc_sdev()
314 struct Scsi_Host *shost = dev_to_shost(dev->parent); in scsi_target_destroy() local
320 spin_lock_irqsave(shost->host_lock, flags); in scsi_target_destroy()
321 if (shost->hostt->target_destroy) in scsi_target_destroy()
322 shost->hostt->target_destroy(starget); in scsi_target_destroy()
324 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_target_destroy()
352 struct Scsi_Host *shost = dev_to_shost(parent); in __scsi_find_target() local
356 list_for_each_entry(starget, &shost->__targets, siblings) { in __scsi_find_target()
415 struct Scsi_Host *shost = dev_to_shost(parent); in scsi_alloc_target() local
419 + shost->transportt->target_size; in scsi_alloc_target()
433 dev_set_name(dev, "target%d:%d:%d", shost->host_no, channel, id); in scsi_alloc_target()
445 spin_lock_irqsave(shost->host_lock, flags); in scsi_alloc_target()
451 list_add_tail(&starget->siblings, &shost->__targets); in scsi_alloc_target()
452 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_alloc_target()
455 if (shost->hostt->target_alloc) { in scsi_alloc_target()
456 error = shost->hostt->target_alloc(starget); in scsi_alloc_target()
478 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_alloc_target()
1058 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in scsi_probe_and_add_lun() local
1088 ((shost->unchecked_isa_dma) ? __GFP_DMA : 0)); in scsi_probe_and_add_lun()
1161 res = scsi_add_lun(sdev, result, &bflags, shost->async_scan); in scsi_probe_and_add_lun()
1206 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in scsi_sequential_lun_scan() local
1211 max_dev_lun = min(max_scsi_luns, shost->max_lun); in scsi_sequential_lun_scan()
1218 max_dev_lun = shost->max_lun; in scsi_sequential_lun_scan()
1245 max_dev_lun = shost->max_lun; in scsi_sequential_lun_scan()
1309 struct Scsi_Host *shost = dev_to_shost(&starget->dev); in scsi_report_lun_scan() local
1324 (!(bflags & BLIST_REPORTLUN2) || shost->max_lun <= 8)) in scsi_report_lun_scan()
1342 shost->host_no, sdev->channel, sdev->id); in scsi_report_lun_scan()
1471 struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel, in __scsi_add_device() argument
1475 struct device *parent = &shost->shost_gendev; in __scsi_add_device()
1486 mutex_lock(&shost->scan_mutex); in __scsi_add_device()
1487 if (!shost->async_scan) in __scsi_add_device()
1490 if (scsi_host_scan_allowed(shost) && scsi_autopm_get_host(shost) == 0) { in __scsi_add_device()
1492 scsi_autopm_put_host(shost); in __scsi_add_device()
1494 mutex_unlock(&shost->scan_mutex); in __scsi_add_device()
1537 struct Scsi_Host *shost = dev_to_shost(parent); in __scsi_scan_target() local
1542 if (shost->this_id == id) in __scsi_scan_target()
1605 struct Scsi_Host *shost = dev_to_shost(parent); in scsi_scan_target() local
1610 mutex_lock(&shost->scan_mutex); in scsi_scan_target()
1611 if (!shost->async_scan) in scsi_scan_target()
1614 if (scsi_host_scan_allowed(shost) && scsi_autopm_get_host(shost) == 0) { in scsi_scan_target()
1616 scsi_autopm_put_host(shost); in scsi_scan_target()
1618 mutex_unlock(&shost->scan_mutex); in scsi_scan_target()
1622 static void scsi_scan_channel(struct Scsi_Host *shost, unsigned int channel, in scsi_scan_channel() argument
1628 for (id = 0; id < shost->max_id; ++id) { in scsi_scan_channel()
1638 if (shost->reverse_ordering) in scsi_scan_channel()
1642 order_id = shost->max_id - id - 1; in scsi_scan_channel()
1645 __scsi_scan_target(&shost->shost_gendev, channel, in scsi_scan_channel()
1649 __scsi_scan_target(&shost->shost_gendev, channel, in scsi_scan_channel()
1653 int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel, in scsi_scan_host_selected() argument
1656 SCSI_LOG_SCAN_BUS(3, shost_printk (KERN_INFO, shost, in scsi_scan_host_selected()
1660 if (((channel != SCAN_WILD_CARD) && (channel > shost->max_channel)) || in scsi_scan_host_selected()
1661 ((id != SCAN_WILD_CARD) && (id >= shost->max_id)) || in scsi_scan_host_selected()
1662 ((lun != SCAN_WILD_CARD) && (lun >= shost->max_lun))) in scsi_scan_host_selected()
1665 mutex_lock(&shost->scan_mutex); in scsi_scan_host_selected()
1666 if (!shost->async_scan) in scsi_scan_host_selected()
1669 if (scsi_host_scan_allowed(shost) && scsi_autopm_get_host(shost) == 0) { in scsi_scan_host_selected()
1671 for (channel = 0; channel <= shost->max_channel; in scsi_scan_host_selected()
1673 scsi_scan_channel(shost, channel, id, lun, in scsi_scan_host_selected()
1676 scsi_scan_channel(shost, channel, id, lun, rescan); in scsi_scan_host_selected()
1677 scsi_autopm_put_host(shost); in scsi_scan_host_selected()
1679 mutex_unlock(&shost->scan_mutex); in scsi_scan_host_selected()
1684 static void scsi_sysfs_add_devices(struct Scsi_Host *shost) in scsi_sysfs_add_devices() argument
1687 shost_for_each_device(sdev, shost) { in scsi_sysfs_add_devices()
1694 if (!scsi_host_scan_allowed(shost) || in scsi_sysfs_add_devices()
1710 static struct async_scan_data *scsi_prep_async_scan(struct Scsi_Host *shost) in scsi_prep_async_scan() argument
1718 if (shost->async_scan) { in scsi_prep_async_scan()
1719 shost_printk(KERN_DEBUG, shost, "%s called twice\n", __func__); in scsi_prep_async_scan()
1726 data->shost = scsi_host_get(shost); in scsi_prep_async_scan()
1727 if (!data->shost) in scsi_prep_async_scan()
1731 mutex_lock(&shost->scan_mutex); in scsi_prep_async_scan()
1732 spin_lock_irqsave(shost->host_lock, flags); in scsi_prep_async_scan()
1733 shost->async_scan = 1; in scsi_prep_async_scan()
1734 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_prep_async_scan()
1735 mutex_unlock(&shost->scan_mutex); in scsi_prep_async_scan()
1760 struct Scsi_Host *shost; in scsi_finish_async_scan() local
1766 shost = data->shost; in scsi_finish_async_scan()
1768 mutex_lock(&shost->scan_mutex); in scsi_finish_async_scan()
1770 if (!shost->async_scan) { in scsi_finish_async_scan()
1771 shost_printk(KERN_INFO, shost, "%s called twice\n", __func__); in scsi_finish_async_scan()
1773 mutex_unlock(&shost->scan_mutex); in scsi_finish_async_scan()
1779 scsi_sysfs_add_devices(shost); in scsi_finish_async_scan()
1781 spin_lock_irqsave(shost->host_lock, flags); in scsi_finish_async_scan()
1782 shost->async_scan = 0; in scsi_finish_async_scan()
1783 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_finish_async_scan()
1785 mutex_unlock(&shost->scan_mutex); in scsi_finish_async_scan()
1796 scsi_autopm_put_host(shost); in scsi_finish_async_scan()
1797 scsi_host_put(shost); in scsi_finish_async_scan()
1801 static void do_scsi_scan_host(struct Scsi_Host *shost) in do_scsi_scan_host() argument
1803 if (shost->hostt->scan_finished) { in do_scsi_scan_host()
1805 if (shost->hostt->scan_start) in do_scsi_scan_host()
1806 shost->hostt->scan_start(shost); in do_scsi_scan_host()
1808 while (!shost->hostt->scan_finished(shost, jiffies - start)) in do_scsi_scan_host()
1811 scsi_scan_host_selected(shost, SCAN_WILD_CARD, SCAN_WILD_CARD, in do_scsi_scan_host()
1819 struct Scsi_Host *shost = data->shost; in do_scan_async() local
1821 do_scsi_scan_host(shost); in do_scan_async()
1829 void scsi_scan_host(struct Scsi_Host *shost) in scsi_scan_host() argument
1835 if (scsi_autopm_get_host(shost) < 0) in scsi_scan_host()
1838 data = scsi_prep_async_scan(shost); in scsi_scan_host()
1840 do_scsi_scan_host(shost); in scsi_scan_host()
1841 scsi_autopm_put_host(shost); in scsi_scan_host()
1854 void scsi_forget_host(struct Scsi_Host *shost) in scsi_forget_host() argument
1860 spin_lock_irqsave(shost->host_lock, flags); in scsi_forget_host()
1861 list_for_each_entry(sdev, &shost->__devices, siblings) { in scsi_forget_host()
1864 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_forget_host()
1868 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_forget_host()
1888 struct scsi_device *scsi_get_host_dev(struct Scsi_Host *shost) in scsi_get_host_dev() argument
1893 mutex_lock(&shost->scan_mutex); in scsi_get_host_dev()
1894 if (!scsi_host_scan_allowed(shost)) in scsi_get_host_dev()
1896 starget = scsi_alloc_target(&shost->shost_gendev, 0, shost->this_id); in scsi_get_host_dev()
1907 mutex_unlock(&shost->scan_mutex); in scsi_get_host_dev()