Lines Matching refs:sdev

727 	struct scsi_device *sdev = cmd->device;
728 struct scsi_target *starget = scsi_target(sdev);
729 struct Scsi_Host *shost = sdev->host;
733 scsi_device_unbusy(sdev);
743 if (atomic_read(&sdev->device_blocked))
744 atomic_set(&sdev->device_blocked, 0);
753 SCSI_LOG_MLCOMPLETE(4, sdev_printk(KERN_INFO, sdev,
777 * @sdev: SCSI Device in question
793 void scsi_adjust_queue_depth(struct scsi_device *sdev, int tagged, int tags)
803 spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
814 if (!shost_use_blk_mq(sdev->host) && !sdev->host->bqt) {
815 if (blk_queue_tagged(sdev->request_queue) &&
816 blk_queue_resize_tags(sdev->request_queue, tags) != 0)
820 sdev->queue_depth = tags;
823 sdev->ordered_tags = 0;
824 sdev->simple_tags = 0;
827 sdev->ordered_tags = 1;
828 sdev->simple_tags = 1;
831 sdev->ordered_tags = 0;
832 sdev->simple_tags = 1;
835 sdev->ordered_tags = 0;
836 sdev->simple_tags = 0;
837 sdev_printk(KERN_WARNING, sdev,
842 spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
848 * @sdev: SCSI Device in question
865 int scsi_track_queue_full(struct scsi_device *sdev, int depth)
873 if ((jiffies >> 4) == (sdev->last_queue_full_time >> 4))
876 sdev->last_queue_full_time = jiffies;
877 if (sdev->last_queue_full_depth != depth) {
878 sdev->last_queue_full_count = 1;
879 sdev->last_queue_full_depth = depth;
881 sdev->last_queue_full_count++;
884 if (sdev->last_queue_full_count <= 10)
886 if (sdev->last_queue_full_depth < 8) {
888 scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
892 if (sdev->ordered_tags)
893 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, depth);
895 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth);
902 * @sdev: The device to ask
912 static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer,
932 result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer,
946 * @sdev: The device to ask
958 int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf,
963 if (sdev->skip_vpd_pages)
967 result = scsi_vpd_inquiry(sdev, buf, 0, buf_len);
986 result = scsi_vpd_inquiry(sdev, buf, page, buf_len);
999 * @sdev: The device to ask
1006 void scsi_attach_vpd(struct scsi_device *sdev)
1014 if (sdev->skip_vpd_pages)
1022 result = scsi_vpd_inquiry(sdev, vpd_buf, 0, vpd_len);
1048 result = scsi_vpd_inquiry(sdev, vpd_buf, 0x80, vpd_len);
1058 sdev->vpd_pg80_len = result;
1059 sdev->vpd_pg80 = vpd_buf;
1069 result = scsi_vpd_inquiry(sdev, vpd_buf, 0x83, vpd_len);
1079 sdev->vpd_pg83_len = result;
1080 sdev->vpd_pg83 = vpd_buf;
1086 * @sdev: scsi device to query
1095 int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer,
1102 if (sdev->no_report_opcodes || sdev->scsi_level < SCSI_SPC_3)
1113 result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len,
1130 * @sdev: device to get a reference to
1136 int scsi_device_get(struct scsi_device *sdev)
1138 if (sdev->sdev_state == SDEV_DEL)
1140 if (!get_device(&sdev->sdev_gendev))
1144 try_module_get(sdev->host->hostt->module);
1152 * @sdev: device to release a reference on.
1158 void scsi_device_put(struct scsi_device *sdev)
1161 struct module *module = sdev->host->hostt->module;
1168 put_device(&sdev->sdev_gendev);
1211 struct scsi_device *sdev;
1213 shost_for_each_device(sdev, shost) {
1214 if ((sdev->channel == starget->channel) &&
1215 (sdev->id == starget->id))
1216 fn(sdev, data);
1239 struct scsi_device *sdev;
1241 __shost_for_each_device(sdev, shost) {
1242 if ((sdev->channel == starget->channel) &&
1243 (sdev->id == starget->id))
1244 fn(sdev, data);
1267 struct scsi_device *sdev;
1269 list_for_each_entry(sdev, &starget->devices, same_target_siblings) {
1270 if (sdev->sdev_state == SDEV_DEL)
1272 if (sdev->lun ==lun)
1273 return sdev;
1292 struct scsi_device *sdev;
1297 sdev = __scsi_device_lookup_by_target(starget, lun);
1298 if (sdev && scsi_device_get(sdev))
1299 sdev = NULL;
1302 return sdev;
1325 struct scsi_device *sdev;
1327 list_for_each_entry(sdev, &shost->__devices, siblings) {
1328 if (sdev->channel == channel && sdev->id == id &&
1329 sdev->lun ==lun)
1330 return sdev;
1351 struct scsi_device *sdev;
1355 sdev = __scsi_device_lookup(shost, channel, id, lun);
1356 if (sdev && scsi_device_get(sdev))
1357 sdev = NULL;
1360 return sdev;