Lines Matching refs:shost
181 scsi_host_free_command(struct Scsi_Host *shost, struct scsi_cmnd *cmd) in scsi_host_free_command() argument
183 struct scsi_host_cmd_pool *pool = shost->cmd_pool; in scsi_host_free_command()
200 scsi_host_alloc_command(struct Scsi_Host *shost, gfp_t gfp_mask) in scsi_host_alloc_command() argument
202 struct scsi_host_cmd_pool *pool = shost->cmd_pool; in scsi_host_alloc_command()
214 if (scsi_host_get_prot(shost) >= SHOST_DIX_TYPE0_PROTECTION) { in scsi_host_alloc_command()
239 __scsi_get_command(struct Scsi_Host *shost, gfp_t gfp_mask) in __scsi_get_command() argument
241 struct scsi_cmnd *cmd = scsi_host_alloc_command(shost, gfp_mask); in __scsi_get_command()
246 spin_lock_irqsave(&shost->free_list_lock, flags); in __scsi_get_command()
247 if (likely(!list_empty(&shost->free_list))) { in __scsi_get_command()
248 cmd = list_entry(shost->free_list.next, in __scsi_get_command()
252 spin_unlock_irqrestore(&shost->free_list_lock, flags); in __scsi_get_command()
300 static void __scsi_put_command(struct Scsi_Host *shost, struct scsi_cmnd *cmd) in __scsi_put_command() argument
304 if (unlikely(list_empty(&shost->free_list))) { in __scsi_put_command()
305 spin_lock_irqsave(&shost->free_list_lock, flags); in __scsi_put_command()
306 if (list_empty(&shost->free_list)) { in __scsi_put_command()
307 list_add(&cmd->list, &shost->free_list); in __scsi_put_command()
310 spin_unlock_irqrestore(&shost->free_list_lock, flags); in __scsi_put_command()
314 scsi_host_free_command(shost, cmd); in __scsi_put_command()
341 scsi_find_host_cmd_pool(struct Scsi_Host *shost) in scsi_find_host_cmd_pool() argument
343 if (shost->hostt->cmd_size) in scsi_find_host_cmd_pool()
344 return shost->hostt->cmd_pool; in scsi_find_host_cmd_pool()
345 if (shost->unchecked_isa_dma) in scsi_find_host_cmd_pool()
359 scsi_alloc_host_cmd_pool(struct Scsi_Host *shost) in scsi_alloc_host_cmd_pool() argument
361 struct scsi_host_template *hostt = shost->hostt; in scsi_alloc_host_cmd_pool()
376 if (shost->unchecked_isa_dma) { in scsi_alloc_host_cmd_pool()
388 scsi_get_host_cmd_pool(struct Scsi_Host *shost) in scsi_get_host_cmd_pool() argument
390 struct scsi_host_template *hostt = shost->hostt; in scsi_get_host_cmd_pool()
399 pool = scsi_find_host_cmd_pool(shost); in scsi_get_host_cmd_pool()
401 pool = scsi_alloc_host_cmd_pool(shost); in scsi_get_host_cmd_pool()
435 static void scsi_put_host_cmd_pool(struct Scsi_Host *shost) in scsi_put_host_cmd_pool() argument
437 struct scsi_host_template *hostt = shost->hostt; in scsi_put_host_cmd_pool()
441 pool = scsi_find_host_cmd_pool(shost); in scsi_put_host_cmd_pool()
471 int scsi_setup_command_freelist(struct Scsi_Host *shost) in scsi_setup_command_freelist() argument
473 const gfp_t gfp_mask = shost->unchecked_isa_dma ? GFP_DMA : GFP_KERNEL; in scsi_setup_command_freelist()
476 spin_lock_init(&shost->free_list_lock); in scsi_setup_command_freelist()
477 INIT_LIST_HEAD(&shost->free_list); in scsi_setup_command_freelist()
479 shost->cmd_pool = scsi_get_host_cmd_pool(shost); in scsi_setup_command_freelist()
480 if (!shost->cmd_pool) in scsi_setup_command_freelist()
486 cmd = scsi_host_alloc_command(shost, gfp_mask); in scsi_setup_command_freelist()
488 scsi_put_host_cmd_pool(shost); in scsi_setup_command_freelist()
489 shost->cmd_pool = NULL; in scsi_setup_command_freelist()
492 list_add(&cmd->list, &shost->free_list); in scsi_setup_command_freelist()
500 void scsi_destroy_command_freelist(struct Scsi_Host *shost) in scsi_destroy_command_freelist() argument
506 if (!shost->cmd_pool) in scsi_destroy_command_freelist()
509 while (!list_empty(&shost->free_list)) { in scsi_destroy_command_freelist()
512 cmd = list_entry(shost->free_list.next, struct scsi_cmnd, list); in scsi_destroy_command_freelist()
514 scsi_host_free_command(shost, cmd); in scsi_destroy_command_freelist()
516 shost->cmd_pool = NULL; in scsi_destroy_command_freelist()
517 scsi_put_host_cmd_pool(shost); in scsi_destroy_command_freelist()
610 struct Scsi_Host *shost = sdev->host; in scsi_finish_command() local
620 if (atomic_read(&shost->host_blocked)) in scsi_finish_command()
621 atomic_set(&shost->host_blocked, 0); in scsi_finish_command()
1012 struct scsi_device *__scsi_iterate_devices(struct Scsi_Host *shost, in __scsi_iterate_devices() argument
1015 struct list_head *list = (prev ? &prev->siblings : &shost->__devices); in __scsi_iterate_devices()
1019 spin_lock_irqsave(shost->host_lock, flags); in __scsi_iterate_devices()
1020 while (list->next != &shost->__devices) { in __scsi_iterate_devices()
1028 spin_unlock_irqrestore(shost->host_lock, flags); in __scsi_iterate_devices()
1049 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in starget_for_each_device() local
1052 shost_for_each_device(sdev, shost) { in starget_for_each_device()
1077 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in __starget_for_each_device() local
1080 __shost_for_each_device(sdev, shost) { in __starget_for_each_device()
1132 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in scsi_device_lookup_by_target() local
1135 spin_lock_irqsave(shost->host_lock, flags); in scsi_device_lookup_by_target()
1139 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_device_lookup_by_target()
1161 struct scsi_device *__scsi_device_lookup(struct Scsi_Host *shost, in __scsi_device_lookup() argument
1166 list_for_each_entry(sdev, &shost->__devices, siblings) { in __scsi_device_lookup()
1187 struct scsi_device *scsi_device_lookup(struct Scsi_Host *shost, in scsi_device_lookup() argument
1193 spin_lock_irqsave(shost->host_lock, flags); in scsi_device_lookup()
1194 sdev = __scsi_device_lookup(shost, channel, id, lun); in scsi_device_lookup()
1197 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_device_lookup()