Lines Matching refs:sdev

200 /* DEVICE_ATTR(state) clashes with dev_attr_state for sdev */
387 struct scsi_device *sdev;
389 sdev = class_to_sdev(class_dev);
390 put_device(&sdev->sdev_gendev);
395 struct scsi_device *sdev;
400 sdev = container_of(work, struct scsi_device, ew.work);
402 parent = sdev->sdev_gendev.parent;
404 spin_lock_irqsave(sdev->host->host_lock, flags);
405 list_del(&sdev->siblings);
406 list_del(&sdev->same_target_siblings);
407 list_del(&sdev->starved_entry);
408 spin_unlock_irqrestore(sdev->host->host_lock, flags);
410 cancel_work_sync(&sdev->event_work);
412 list_for_each_safe(this, tmp, &sdev->event_list) {
420 blk_put_queue(sdev->request_queue);
422 sdev->request_queue = NULL;
424 kfree(sdev->vpd_pg83);
425 kfree(sdev->vpd_pg80);
426 kfree(sdev->inquiry);
427 kfree(sdev);
461 struct scsi_device *sdev;
466 sdev = to_scsi_device(dev);
468 add_uevent_var(env, "MODALIAS=" SCSI_DEVICE_MODALIAS_FMT, sdev->type);
511 struct scsi_device *sdev; \
512 sdev = to_scsi_device(dev); \
513 return snprintf (buf, 20, format_string, sdev->field); \
536 struct scsi_device *sdev; \
537 sdev = to_scsi_device(dev); \
538 sscanf (buf, format_string, &sdev->field); \
558 struct scsi_device *sdev; \
561 sdev = to_scsi_device(dev); \
562 sdev->field = ret; \
599 struct scsi_device *sdev = to_scsi_device(dev);
600 return snprintf(buf, 20, "%d\n", atomic_read(&sdev->device_busy));
608 struct scsi_device *sdev = to_scsi_device(dev);
609 return snprintf(buf, 20, "%d\n", atomic_read(&sdev->device_blocked));
619 struct scsi_device *sdev;
620 sdev = to_scsi_device(dev);
621 return snprintf(buf, 20, "%d\n", sdev->request_queue->rq_timeout / HZ);
628 struct scsi_device *sdev;
630 sdev = to_scsi_device(dev);
632 blk_queue_rq_timeout(sdev->request_queue, timeout * HZ);
640 struct scsi_device *sdev;
641 sdev = to_scsi_device(dev);
642 return snprintf(buf, 20, "%u\n", sdev->eh_timeout / HZ);
649 struct scsi_device *sdev;
656 sdev = to_scsi_device(dev);
660 sdev->eh_timeout = eh_timeout * HZ;
690 struct scsi_device *sdev = to_scsi_device(dev);
704 if (scsi_device_set_state(sdev, state))
712 struct scsi_device *sdev = to_scsi_device(dev);
713 const char *name = scsi_device_state_name(sdev->sdev_state);
727 struct scsi_device *sdev = to_scsi_device(dev);
730 if (sdev->ordered_tags)
732 else if (sdev->simple_tags)
742 struct scsi_device *sdev = to_scsi_device(dev);
743 struct scsi_host_template *sht = sdev->host->hostt;
745 int prev_tag_type = scsi_get_tag_type(sdev);
747 if (!sdev->tagged_supported || !sht->change_queue_type)
760 retval = sht->change_queue_type(sdev, tag_type);
777 struct scsi_device *sdev = to_scsi_device(dev); \
778 if (!sdev->vpd_##_page) \
781 sdev->vpd_##_page, \
782 sdev->vpd_##_page##_len); \
807 struct scsi_device *sdev = to_scsi_device(dev); \
808 unsigned long long count = atomic_read(&sdev->field); \
820 struct scsi_device *sdev;
821 sdev = to_scsi_device(dev);
822 return snprintf (buf, 20, SCSI_DEVICE_MODALIAS_FMT "\n", sdev->type);
831 struct scsi_device *sdev = to_scsi_device(dev); \
832 int val = test_bit(SDEV_EVT_##Cap_name, sdev->supported_events);\
841 struct scsi_device *sdev = to_scsi_device(dev); \
844 clear_bit(SDEV_EVT_##Cap_name, sdev->supported_events); \
846 set_bit(SDEV_EVT_##Cap_name, sdev->supported_events); \
871 struct scsi_device *sdev = to_scsi_device(dev);
872 struct scsi_host_template *sht = sdev->host->hostt;
882 retval = sht->change_queue_depth(sdev, depth,
887 sdev->max_queue_depth = sdev->queue_depth;
901 struct scsi_device *sdev;
902 sdev = to_scsi_device(dev);
904 jiffies_to_msecs(sdev->queue_ramp_up_period));
912 struct scsi_device *sdev = to_scsi_device(dev);
918 sdev->queue_ramp_up_period = msecs_to_jiffies(period);
930 struct scsi_device *sdev = to_scsi_device(dev);
934 !sdev->host->hostt->change_queue_depth)
938 !sdev->host->hostt->change_queue_depth)
942 !sdev->host->hostt->change_queue_type)
1019 * @sdev: scsi_device to add
1024 int scsi_sysfs_add_sdev(struct scsi_device *sdev)
1027 struct request_queue *rq = sdev->request_queue;
1028 struct scsi_target *starget = sdev->sdev_target;
1030 error = scsi_device_set_state(sdev, SDEV_RUNNING);
1040 device_enable_async_suspend(&sdev->sdev_gendev);
1042 pm_runtime_set_active(&sdev->sdev_gendev);
1043 pm_runtime_forbid(&sdev->sdev_gendev);
1044 pm_runtime_enable(&sdev->sdev_gendev);
1047 scsi_autopm_get_device(sdev);
1049 error = device_add(&sdev->sdev_gendev);
1051 sdev_printk(KERN_INFO, sdev,
1055 device_enable_async_suspend(&sdev->sdev_dev);
1056 error = device_add(&sdev->sdev_dev);
1058 sdev_printk(KERN_INFO, sdev,
1060 device_del(&sdev->sdev_gendev);
1063 transport_add_device(&sdev->sdev_gendev);
1064 sdev->is_visible = 1;
1066 error = bsg_register_queue(rq, &sdev->sdev_gendev, NULL, NULL);
1071 sdev_printk(KERN_INFO, sdev,
1075 if (sdev->host->hostt->sdev_attrs) {
1076 for (i = 0; sdev->host->hostt->sdev_attrs[i]; i++) {
1077 error = device_create_file(&sdev->sdev_gendev,
1078 sdev->host->hostt->sdev_attrs[i]);
1084 scsi_autopm_put_device(sdev);
1088 void __scsi_remove_device(struct scsi_device *sdev)
1090 struct device *dev = &sdev->sdev_gendev;
1092 if (sdev->is_visible) {
1093 if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0)
1096 bsg_unregister_queue(sdev->request_queue);
1097 device_unregister(&sdev->sdev_dev);
1101 put_device(&sdev->sdev_dev);
1108 scsi_device_set_state(sdev, SDEV_DEL);
1109 blk_cleanup_queue(sdev->request_queue);
1110 cancel_work_sync(&sdev->requeue_work);
1112 if (sdev->host->hostt->slave_destroy)
1113 sdev->host->hostt->slave_destroy(sdev);
1121 scsi_target_reap(scsi_target(sdev));
1128 * @sdev: scsi_device to unregister
1130 void scsi_remove_device(struct scsi_device *sdev)
1132 struct Scsi_Host *shost = sdev->host;
1135 __scsi_remove_device(sdev);
1144 struct scsi_device *sdev;
1148 list_for_each_entry(sdev, &shost->__devices, siblings) {
1149 if (sdev->channel != starget->channel ||
1150 sdev->id != starget->id ||
1151 scsi_device_get(sdev))
1154 scsi_remove_device(sdev);
1155 scsi_device_put(sdev);
1246 void scsi_sysfs_device_initialize(struct scsi_device *sdev)
1249 struct Scsi_Host *shost = sdev->host;
1250 struct scsi_target *starget = sdev->sdev_target;
1252 device_initialize(&sdev->sdev_gendev);
1253 sdev->sdev_gendev.bus = &scsi_bus_type;
1254 sdev->sdev_gendev.type = &scsi_dev_type;
1255 dev_set_name(&sdev->sdev_gendev, "%d:%d:%d:%llu",
1256 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
1258 device_initialize(&sdev->sdev_dev);
1259 sdev->sdev_dev.parent = get_device(&sdev->sdev_gendev);
1260 sdev->sdev_dev.class = &sdev_class;
1261 dev_set_name(&sdev->sdev_dev, "%d:%d:%d:%llu",
1262 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
1266 * sdev->lun_in_cdb for the initial INQUIRY command. For LUN 0 the
1270 sdev->scsi_level = starget->scsi_level;
1271 if (sdev->scsi_level <= SCSI_2 &&
1272 sdev->scsi_level != SCSI_UNKNOWN &&
1274 sdev->lun_in_cdb = 1;
1276 transport_setup_device(&sdev->sdev_gendev);
1278 list_add_tail(&sdev->same_target_siblings, &starget->devices);
1279 list_add_tail(&sdev->siblings, &shost->__devices);