Lines Matching defs:sdev
95 struct scsi_device *sdev = to_scsi_device(device);
103 ap = ata_shost_to_port(sdev->host);
106 dev = ata_scsi_find_dev(ap, sdev);
135 struct scsi_device *sdev = to_scsi_device(device);
152 ap = ata_shost_to_port(sdev->host);
155 dev = ata_scsi_find_dev(ap, sdev);
268 * @sdev: SCSI device for which BIOS geometry is to be determined
269 * @bdev: block device associated with @sdev
284 int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev,
298 * @sdev: SCSI device to adjust device capacity for
300 * This function is called if a partition on @sdev extends beyond
306 void ata_scsi_unlock_native_capacity(struct scsi_device *sdev)
308 struct ata_port *ap = ata_shost_to_port(sdev->host);
314 dev = ata_scsi_find_dev(ap, sdev);
329 * @sdev: SCSI device to get identify data for
338 static int ata_get_identity(struct ata_port *ap, struct scsi_device *sdev,
341 struct ata_device *dev = ata_scsi_find_dev(ap, sdev);
987 void ata_scsi_sdev_config(struct scsi_device *sdev)
989 sdev->use_10_for_rw = 1;
990 sdev->use_10_for_ms = 1;
991 sdev->no_write_same = 1;
998 sdev->max_device_blocked = 1;
1024 int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev)
1026 struct request_queue *q = sdev->request_queue;
1033 dev->max_sectors = min(dev->max_sectors, sdev->host->max_sectors);
1037 sdev->sector_size = ATA_SECT_SIZE;
1045 sdev->dma_drain_len = ATAPI_MAX_DRAIN;
1046 sdev->dma_drain_buf = kmalloc(sdev->dma_drain_len, GFP_NOIO);
1047 if (!sdev->dma_drain_buf) {
1052 sdev->sector_size = ata_id_logical_sector_size(dev->id);
1063 sdev->manage_runtime_start_stop = 1;
1064 sdev->manage_shutdown = 1;
1065 sdev->force_runtime_start_on_system_start = 1;
1075 if (sdev->sector_size > PAGE_SIZE)
1078 sdev->sector_size);
1080 blk_queue_update_dma_alignment(q, sdev->sector_size - 1);
1083 set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
1086 depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id));
1088 scsi_change_queue_depth(sdev, depth);
1091 sdev->security_supported = 1;
1093 dev->sdev = sdev;
1099 * @sdev: SCSI device to examine
1108 int ata_scsi_slave_alloc(struct scsi_device *sdev)
1110 struct ata_port *ap = ata_shost_to_port(sdev->host);
1113 ata_scsi_sdev_config(sdev);
1120 link = device_link_add(&sdev->sdev_gendev, &ap->tdev,
1125 dev_name(&sdev->sdev_gendev));
1135 * @sdev: SCSI device to examine
1145 int ata_scsi_slave_config(struct scsi_device *sdev)
1147 struct ata_port *ap = ata_shost_to_port(sdev->host);
1148 struct ata_device *dev = __ata_scsi_find_dev(ap, sdev);
1151 return ata_scsi_dev_config(sdev, dev);
1159 * @sdev: SCSI device to be destroyed
1161 * @sdev is about to be destroyed for hot/warm unplugging. If
1163 * dev->sdev, this function doesn't have to do anything.
1165 * Clear dev->sdev, schedule the device for ATA detach and invoke
1171 void ata_scsi_slave_destroy(struct scsi_device *sdev)
1173 struct ata_port *ap = ata_shost_to_port(sdev->host);
1177 device_link_remove(&sdev->sdev_gendev, &ap->tdev);
1180 dev = __ata_scsi_find_dev(ap, sdev);
1181 if (dev && dev->sdev) {
1183 dev->sdev = NULL;
1189 kfree(sdev->dma_drain_buf);
2634 /* SCSI EH automatically locks door if sdev->locked is
2641 * If door lock fails, always clear sdev->locked to
2645 * sure qc->dev->sdev isn't NULL before dereferencing.
2647 if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL && qc->dev->sdev)
2648 qc->dev->sdev->locked = 0;
4425 struct scsi_device *sdev = dev->sdev;
4439 sdev->sdev_gendev.of_node = child;
4460 struct scsi_device *sdev;
4463 if (dev->sdev)
4471 sdev = __scsi_add_device(ap->scsi_host, channel, id, 0,
4473 if (!IS_ERR(sdev)) {
4474 dev->sdev = sdev;
4476 scsi_device_put(sdev);
4478 dev->sdev = NULL;
4489 if (!dev->sdev)
4530 * function is called with host lock which protects dev->sdev
4541 if (dev->sdev) {
4542 scsi_device_set_state(dev->sdev, SDEV_OFFLINE);
4561 struct scsi_device *sdev;
4573 /* clearing dev->sdev is protected by host lock */
4574 sdev = dev->sdev;
4575 dev->sdev = NULL;
4577 if (sdev) {
4578 /* If user initiated unplug races with us, sdev can go
4582 if (scsi_device_get(sdev) == 0) {
4583 /* The following ensures the attached sdev is
4588 scsi_device_set_state(sdev, SDEV_OFFLINE);
4591 sdev = NULL;
4598 if (sdev) {
4600 dev_name(&sdev->sdev_gendev));
4602 scsi_remove_device(sdev);
4603 scsi_device_put(sdev);
4641 if (dev->sdev)
4642 sdev_evt_send_simple(dev->sdev, SDEV_EVT_MEDIA_CHANGE,
4775 struct scsi_device *sdev = dev->sdev;
4784 if (!sdev)
4786 if (scsi_device_get(sdev))
4790 ret = scsi_rescan_device(sdev);
4791 scsi_device_put(sdev);