Lines Matching defs:sdev

169 	struct scsi_device *sdev = cmd->device;
170 struct scsi_target *starget = scsi_target(sdev);
171 struct Scsi_Host *shost = sdev->host;
175 scsi_device_unbusy(sdev, cmd);
185 if (atomic_read(&sdev->device_blocked))
186 atomic_set(&sdev->device_blocked, 0);
195 SCSI_LOG_MLCOMPLETE(4, sdev_printk(KERN_INFO, sdev,
219 * @sdev: SCSI Device in question
224 int scsi_change_queue_depth(struct scsi_device *sdev, int depth)
227 sdev->queue_depth = depth;
231 if (sdev->request_queue)
232 blk_set_queue_depth(sdev->request_queue, depth);
234 return sdev->queue_depth;
240 * @sdev: SCSI Device in question
257 int scsi_track_queue_full(struct scsi_device *sdev, int depth)
265 if ((jiffies >> 4) == (sdev->last_queue_full_time >> 4))
268 sdev->last_queue_full_time = jiffies;
269 if (sdev->last_queue_full_depth != depth) {
270 sdev->last_queue_full_count = 1;
271 sdev->last_queue_full_depth = depth;
273 sdev->last_queue_full_count++;
276 if (sdev->last_queue_full_count <= 10)
279 return scsi_change_queue_depth(sdev, depth);
285 * @sdev: The device to ask
295 static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer,
315 result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer,
336 * @sdev: The device to ask
348 int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf,
353 if (sdev->skip_vpd_pages)
357 result = scsi_vpd_inquiry(sdev, buf, 0, buf_len);
376 result = scsi_vpd_inquiry(sdev, buf, page, buf_len);
389 * @sdev: The device to ask
394 static struct scsi_vpd *scsi_get_vpd_buf(struct scsi_device *sdev, u8 page)
404 result = scsi_vpd_inquiry(sdev, vpd_buf->data, page, vpd_len);
420 static void scsi_update_vpd_page(struct scsi_device *sdev, u8 page,
425 vpd_buf = scsi_get_vpd_buf(sdev, page);
429 mutex_lock(&sdev->inquiry_mutex);
431 lockdep_is_held(&sdev->inquiry_mutex));
432 mutex_unlock(&sdev->inquiry_mutex);
440 * @sdev: The device to ask
447 void scsi_attach_vpd(struct scsi_device *sdev)
452 if (!scsi_device_supports_vpd(sdev))
456 vpd_buf = scsi_get_vpd_buf(sdev, 0);
462 scsi_update_vpd_page(sdev, 0x0, &sdev->vpd_pg0);
464 scsi_update_vpd_page(sdev, 0x80, &sdev->vpd_pg80);
466 scsi_update_vpd_page(sdev, 0x83, &sdev->vpd_pg83);
468 scsi_update_vpd_page(sdev, 0x89, &sdev->vpd_pg89);
475 * @sdev: scsi device to query
484 int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer,
491 if (sdev->no_report_opcodes || sdev->scsi_level < SCSI_SPC_3)
502 result = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buffer, len,
519 * @sdev: device to get a reference to
528 int scsi_device_get(struct scsi_device *sdev)
530 if (sdev->sdev_state == SDEV_DEL || sdev->sdev_state == SDEV_CANCEL)
532 if (!get_device(&sdev->sdev_gendev))
534 if (!try_module_get(sdev->host->hostt->module))
539 put_device(&sdev->sdev_gendev);
547 * @sdev: device to release a reference on.
553 void scsi_device_put(struct scsi_device *sdev)
555 struct module *mod = sdev->host->hostt->module;
557 put_device(&sdev->sdev_gendev);
601 struct scsi_device *sdev;
603 shost_for_each_device(sdev, shost) {
604 if ((sdev->channel == starget->channel) &&
605 (sdev->id == starget->id))
606 fn(sdev, data);
629 struct scsi_device *sdev;
631 __shost_for_each_device(sdev, shost) {
632 if ((sdev->channel == starget->channel) &&
633 (sdev->id == starget->id))
634 fn(sdev, data);
657 struct scsi_device *sdev;
659 list_for_each_entry(sdev, &starget->devices, same_target_siblings) {
660 if (sdev->sdev_state == SDEV_DEL)
662 if (sdev->lun ==lun)
663 return sdev;
682 struct scsi_device *sdev;
687 sdev = __scsi_device_lookup_by_target(starget, lun);
688 if (sdev && scsi_device_get(sdev))
689 sdev = NULL;
692 return sdev;
715 struct scsi_device *sdev;
717 list_for_each_entry(sdev, &shost->__devices, siblings) {
718 if (sdev->sdev_state == SDEV_DEL)
720 if (sdev->channel == channel && sdev->id == id &&
721 sdev->lun ==lun)
722 return sdev;
743 struct scsi_device *sdev;
747 sdev = __scsi_device_lookup(shost, channel, id, lun);
748 if (sdev && scsi_device_get(sdev))
749 sdev = NULL;
752 return sdev;