Lines Matching refs:shost
135 scsi_host_free_command(struct Scsi_Host *shost, struct scsi_cmnd *cmd) in scsi_host_free_command() argument
137 struct scsi_host_cmd_pool *pool = shost->cmd_pool; in scsi_host_free_command()
154 scsi_host_alloc_command(struct Scsi_Host *shost, gfp_t gfp_mask) in scsi_host_alloc_command() argument
156 struct scsi_host_cmd_pool *pool = shost->cmd_pool; in scsi_host_alloc_command()
168 if (scsi_host_get_prot(shost) >= SHOST_DIX_TYPE0_PROTECTION) { in scsi_host_alloc_command()
193 __scsi_get_command(struct Scsi_Host *shost, gfp_t gfp_mask) in __scsi_get_command() argument
195 struct scsi_cmnd *cmd = scsi_host_alloc_command(shost, gfp_mask); in __scsi_get_command()
200 spin_lock_irqsave(&shost->free_list_lock, flags); in __scsi_get_command()
201 if (likely(!list_empty(&shost->free_list))) { in __scsi_get_command()
202 cmd = list_entry(shost->free_list.next, in __scsi_get_command()
206 spin_unlock_irqrestore(&shost->free_list_lock, flags); in __scsi_get_command()
254 static void __scsi_put_command(struct Scsi_Host *shost, struct scsi_cmnd *cmd) in __scsi_put_command() argument
258 if (unlikely(list_empty(&shost->free_list))) { in __scsi_put_command()
259 spin_lock_irqsave(&shost->free_list_lock, flags); in __scsi_put_command()
260 if (list_empty(&shost->free_list)) { in __scsi_put_command()
261 list_add(&cmd->list, &shost->free_list); in __scsi_put_command()
264 spin_unlock_irqrestore(&shost->free_list_lock, flags); in __scsi_put_command()
268 scsi_host_free_command(shost, cmd); in __scsi_put_command()
295 scsi_find_host_cmd_pool(struct Scsi_Host *shost) in scsi_find_host_cmd_pool() argument
297 if (shost->hostt->cmd_size) in scsi_find_host_cmd_pool()
298 return shost->hostt->cmd_pool; in scsi_find_host_cmd_pool()
299 if (shost->unchecked_isa_dma) in scsi_find_host_cmd_pool()
313 scsi_alloc_host_cmd_pool(struct Scsi_Host *shost) in scsi_alloc_host_cmd_pool() argument
315 struct scsi_host_template *hostt = shost->hostt; in scsi_alloc_host_cmd_pool()
330 if (shost->unchecked_isa_dma) { in scsi_alloc_host_cmd_pool()
342 scsi_get_host_cmd_pool(struct Scsi_Host *shost) in scsi_get_host_cmd_pool() argument
344 struct scsi_host_template *hostt = shost->hostt; in scsi_get_host_cmd_pool()
353 pool = scsi_find_host_cmd_pool(shost); in scsi_get_host_cmd_pool()
355 pool = scsi_alloc_host_cmd_pool(shost); in scsi_get_host_cmd_pool()
389 static void scsi_put_host_cmd_pool(struct Scsi_Host *shost) in scsi_put_host_cmd_pool() argument
391 struct scsi_host_template *hostt = shost->hostt; in scsi_put_host_cmd_pool()
395 pool = scsi_find_host_cmd_pool(shost); in scsi_put_host_cmd_pool()
425 int scsi_setup_command_freelist(struct Scsi_Host *shost) in scsi_setup_command_freelist() argument
427 const gfp_t gfp_mask = shost->unchecked_isa_dma ? GFP_DMA : GFP_KERNEL; in scsi_setup_command_freelist()
430 spin_lock_init(&shost->free_list_lock); in scsi_setup_command_freelist()
431 INIT_LIST_HEAD(&shost->free_list); in scsi_setup_command_freelist()
433 shost->cmd_pool = scsi_get_host_cmd_pool(shost); in scsi_setup_command_freelist()
434 if (!shost->cmd_pool) in scsi_setup_command_freelist()
440 cmd = scsi_host_alloc_command(shost, gfp_mask); in scsi_setup_command_freelist()
442 scsi_put_host_cmd_pool(shost); in scsi_setup_command_freelist()
443 shost->cmd_pool = NULL; in scsi_setup_command_freelist()
446 list_add(&cmd->list, &shost->free_list); in scsi_setup_command_freelist()
454 void scsi_destroy_command_freelist(struct Scsi_Host *shost) in scsi_destroy_command_freelist() argument
460 if (!shost->cmd_pool) in scsi_destroy_command_freelist()
463 while (!list_empty(&shost->free_list)) { in scsi_destroy_command_freelist()
466 cmd = list_entry(shost->free_list.next, struct scsi_cmnd, list); in scsi_destroy_command_freelist()
468 scsi_host_free_command(shost, cmd); in scsi_destroy_command_freelist()
470 shost->cmd_pool = NULL; in scsi_destroy_command_freelist()
471 scsi_put_host_cmd_pool(shost); in scsi_destroy_command_freelist()
564 struct Scsi_Host *shost = sdev->host; in scsi_finish_command() local
574 if (atomic_read(&shost->host_blocked)) in scsi_finish_command()
575 atomic_set(&shost->host_blocked, 0); in scsi_finish_command()
945 struct scsi_device *__scsi_iterate_devices(struct Scsi_Host *shost, in __scsi_iterate_devices() argument
948 struct list_head *list = (prev ? &prev->siblings : &shost->__devices); in __scsi_iterate_devices()
952 spin_lock_irqsave(shost->host_lock, flags); in __scsi_iterate_devices()
953 while (list->next != &shost->__devices) { in __scsi_iterate_devices()
961 spin_unlock_irqrestore(shost->host_lock, flags); in __scsi_iterate_devices()
982 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in starget_for_each_device() local
985 shost_for_each_device(sdev, shost) { in starget_for_each_device()
1010 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in __starget_for_each_device() local
1013 __shost_for_each_device(sdev, shost) { in __starget_for_each_device()
1065 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in scsi_device_lookup_by_target() local
1068 spin_lock_irqsave(shost->host_lock, flags); in scsi_device_lookup_by_target()
1072 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_device_lookup_by_target()
1094 struct scsi_device *__scsi_device_lookup(struct Scsi_Host *shost, in __scsi_device_lookup() argument
1099 list_for_each_entry(sdev, &shost->__devices, siblings) { in __scsi_device_lookup()
1120 struct scsi_device *scsi_device_lookup(struct Scsi_Host *shost, in scsi_device_lookup() argument
1126 spin_lock_irqsave(shost->host_lock, flags); in scsi_device_lookup()
1127 sdev = __scsi_device_lookup(shost, channel, id, lun); in scsi_device_lookup()
1130 spin_unlock_irqrestore(shost->host_lock, flags); in scsi_device_lookup()