Lines Matching refs:sdev

608 	struct scsi_device *sdev = cmd->device;  in scsi_finish_command()  local
609 struct scsi_target *starget = scsi_target(sdev); in scsi_finish_command()
610 struct Scsi_Host *shost = sdev->host; in scsi_finish_command()
614 scsi_device_unbusy(sdev); in scsi_finish_command()
624 if (atomic_read(&sdev->device_blocked)) in scsi_finish_command()
625 atomic_set(&sdev->device_blocked, 0); in scsi_finish_command()
634 SCSI_LOG_MLCOMPLETE(4, sdev_printk(KERN_INFO, sdev, in scsi_finish_command()
663 int scsi_change_queue_depth(struct scsi_device *sdev, int depth) in scsi_change_queue_depth() argument
670 spin_lock_irqsave(sdev->request_queue->queue_lock, flags); in scsi_change_queue_depth()
681 if (!shost_use_blk_mq(sdev->host) && !sdev->host->bqt) { in scsi_change_queue_depth()
682 if (blk_queue_tagged(sdev->request_queue) && in scsi_change_queue_depth()
683 blk_queue_resize_tags(sdev->request_queue, depth) != 0) in scsi_change_queue_depth()
687 sdev->queue_depth = depth; in scsi_change_queue_depth()
689 spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags); in scsi_change_queue_depth()
691 return sdev->queue_depth; in scsi_change_queue_depth()
714 int scsi_track_queue_full(struct scsi_device *sdev, int depth) in scsi_track_queue_full() argument
722 if ((jiffies >> 4) == (sdev->last_queue_full_time >> 4)) in scsi_track_queue_full()
725 sdev->last_queue_full_time = jiffies; in scsi_track_queue_full()
726 if (sdev->last_queue_full_depth != depth) { in scsi_track_queue_full()
727 sdev->last_queue_full_count = 1; in scsi_track_queue_full()
728 sdev->last_queue_full_depth = depth; in scsi_track_queue_full()
730 sdev->last_queue_full_count++; in scsi_track_queue_full()
733 if (sdev->last_queue_full_count <= 10) in scsi_track_queue_full()
736 return scsi_change_queue_depth(sdev, depth); in scsi_track_queue_full()
752 static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer, in scsi_vpd_inquiry() argument
772 result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, in scsi_vpd_inquiry()
798 int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf, in scsi_get_vpd_page() argument
803 if (sdev->skip_vpd_pages) in scsi_get_vpd_page()
807 result = scsi_vpd_inquiry(sdev, buf, 0, buf_len); in scsi_get_vpd_page()
826 result = scsi_vpd_inquiry(sdev, buf, page, buf_len); in scsi_get_vpd_page()
846 void scsi_attach_vpd(struct scsi_device *sdev) in scsi_attach_vpd() argument
854 if (sdev->skip_vpd_pages) in scsi_attach_vpd()
862 result = scsi_vpd_inquiry(sdev, vpd_buf, 0, vpd_len); in scsi_attach_vpd()
888 result = scsi_vpd_inquiry(sdev, vpd_buf, 0x80, vpd_len); in scsi_attach_vpd()
898 sdev->vpd_pg80_len = result; in scsi_attach_vpd()
899 sdev->vpd_pg80 = vpd_buf; in scsi_attach_vpd()
909 result = scsi_vpd_inquiry(sdev, vpd_buf, 0x83, vpd_len); in scsi_attach_vpd()
919 sdev->vpd_pg83_len = result; in scsi_attach_vpd()
920 sdev->vpd_pg83 = vpd_buf; in scsi_attach_vpd()
935 int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer, in scsi_report_opcode() argument
942 if (sdev->no_report_opcodes || sdev->scsi_level < SCSI_SPC_3) in scsi_report_opcode()
953 result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len, in scsi_report_opcode()
979 int scsi_device_get(struct scsi_device *sdev) in scsi_device_get() argument
981 if (sdev->sdev_state == SDEV_DEL || sdev->sdev_state == SDEV_CANCEL) in scsi_device_get()
983 if (!get_device(&sdev->sdev_gendev)) in scsi_device_get()
985 if (!try_module_get(sdev->host->hostt->module)) in scsi_device_get()
990 put_device(&sdev->sdev_gendev); in scsi_device_get()
1004 void scsi_device_put(struct scsi_device *sdev) in scsi_device_put() argument
1006 module_put(sdev->host->hostt->module); in scsi_device_put()
1007 put_device(&sdev->sdev_gendev); in scsi_device_put()
1050 struct scsi_device *sdev; in starget_for_each_device() local
1052 shost_for_each_device(sdev, shost) { in starget_for_each_device()
1053 if ((sdev->channel == starget->channel) && in starget_for_each_device()
1054 (sdev->id == starget->id)) in starget_for_each_device()
1055 fn(sdev, data); in starget_for_each_device()
1078 struct scsi_device *sdev; in __starget_for_each_device() local
1080 __shost_for_each_device(sdev, shost) { in __starget_for_each_device()
1081 if ((sdev->channel == starget->channel) && in __starget_for_each_device()
1082 (sdev->id == starget->id)) in __starget_for_each_device()
1083 fn(sdev, data); in __starget_for_each_device()
1106 struct scsi_device *sdev; in __scsi_device_lookup_by_target() local
1108 list_for_each_entry(sdev, &starget->devices, same_target_siblings) { in __scsi_device_lookup_by_target()
1109 if (sdev->sdev_state == SDEV_DEL) in __scsi_device_lookup_by_target()
1111 if (sdev->lun ==lun) in __scsi_device_lookup_by_target()
1112 return sdev; in __scsi_device_lookup_by_target()
1131 struct scsi_device *sdev; in scsi_device_lookup_by_target() local
1136 sdev = __scsi_device_lookup_by_target(starget, lun); in scsi_device_lookup_by_target()
1137 if (sdev && scsi_device_get(sdev)) in scsi_device_lookup_by_target()
1138 sdev = NULL; in scsi_device_lookup_by_target()
1141 return sdev; in scsi_device_lookup_by_target()
1164 struct scsi_device *sdev; in __scsi_device_lookup() local
1166 list_for_each_entry(sdev, &shost->__devices, siblings) { in __scsi_device_lookup()
1167 if (sdev->channel == channel && sdev->id == id && in __scsi_device_lookup()
1168 sdev->lun ==lun) in __scsi_device_lookup()
1169 return sdev; in __scsi_device_lookup()
1190 struct scsi_device *sdev; in scsi_device_lookup() local
1194 sdev = __scsi_device_lookup(shost, channel, id, lun); in scsi_device_lookup()
1195 if (sdev && scsi_device_get(sdev)) in scsi_device_lookup()
1196 sdev = NULL; in scsi_device_lookup()
1199 return sdev; in scsi_device_lookup()