Lines Matching refs:starget

210  * @starget: which target to allocate a &scsi_device for
222 static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
227 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
241 sdev->id = starget->id;
243 sdev->channel = starget->channel;
254 sdev->sdev_gendev.parent = get_device(&starget->dev);
255 sdev->sdev_target = starget;
283 put_device(&starget->dev);
316 static void scsi_target_destroy(struct scsi_target *starget)
318 struct device *dev = &starget->dev;
322 starget->state = STARGET_DEL;
326 shost->hostt->target_destroy(starget);
327 list_del_init(&starget->siblings);
335 struct scsi_target *starget = to_scsi_target(dev);
337 kfree(starget);
355 struct scsi_target *starget, *found_starget = NULL;
360 list_for_each_entry(starget, &shost->__targets, siblings) {
361 if (starget->id == id &&
362 starget->channel == channel) {
363 found_starget = starget;
384 struct scsi_target *starget
392 if (starget->state != STARGET_CREATED) {
393 transport_remove_device(&starget->dev);
394 device_del(&starget->dev);
396 scsi_target_destroy(starget);
399 static void scsi_target_reap_ref_put(struct scsi_target *starget)
401 kref_put(&starget->reap_ref, scsi_target_reap_ref_release);
424 struct scsi_target *starget;
428 starget = kzalloc(size, GFP_KERNEL);
429 if (!starget) {
433 dev = &starget->dev;
435 kref_init(&starget->reap_ref);
440 starget->id = id;
441 starget->channel = channel;
442 starget->can_queue = 0;
443 INIT_LIST_HEAD(&starget->siblings);
444 INIT_LIST_HEAD(&starget->devices);
445 starget->state = STARGET_CREATED;
446 starget->scsi_level = SCSI_2;
447 starget->max_target_blocked = SCSI_DEFAULT_TARGET_BLOCKED;
455 list_add_tail(&starget->siblings, &shost->__targets);
460 error = shost->hostt->target_alloc(starget);
466 scsi_target_destroy(starget);
472 return starget;
507 * @starget: target to be checked
513 void scsi_target_reap(struct scsi_target *starget)
520 BUG_ON(starget->state == STARGET_DEL);
521 scsi_target_reap_ref_put(starget);
1026 * @starget: pointer to target device structure
1043 static int scsi_probe_and_add_lun(struct scsi_target *starget,
1051 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
1057 sdev = scsi_device_lookup_by_target(starget, lun);
1076 sdev = scsi_alloc_sdev(starget, lun, hostdata);
1144 if (((result[0] >> 5) == 1 || starget->pdt_1f_for_no_lun) &&
1182 * @starget: pointer to target structure to scan
1194 static void scsi_sequential_lun_scan(struct scsi_target *starget,
1199 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
1201 SCSI_LOG_SCAN_BUS(3, starget_printk(KERN_INFO, starget,
1263 if ((scsi_probe_and_add_lun(starget, lun, NULL, NULL, rescan,
1333 * @starget: which target
1345 * If starget->no_report_luns is set, return 1 always.
1351 static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1365 struct Scsi_Host *shost = dev_to_shost(&starget->dev);
1376 if (starget->scsi_level < SCSI_2 &&
1377 starget->scsi_level != SCSI_UNKNOWN)
1379 if (starget->scsi_level < SCSI_3 &&
1384 if (starget->no_report_luns)
1387 if (!(sdev = scsi_device_lookup_by_target(starget, 0))) {
1388 sdev = scsi_alloc_sdev(starget, 0, NULL);
1510 res = scsi_probe_and_add_lun(starget,
1542 struct scsi_target *starget;
1547 starget = scsi_alloc_target(parent, channel, id);
1548 if (!starget)
1550 scsi_autopm_get_target(starget);
1557 scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, hostdata);
1561 scsi_autopm_put_target(starget);
1566 scsi_target_reap(starget);
1567 put_device(&starget->dev);
1608 struct scsi_target *starget;
1616 starget = scsi_alloc_target(parent, channel, id);
1617 if (!starget)
1619 scsi_autopm_get_target(starget);
1625 scsi_probe_and_add_lun(starget, lun, NULL, NULL, rescan, NULL);
1633 res = scsi_probe_and_add_lun(starget, 0, &bflags, NULL, rescan, NULL);
1635 if (scsi_report_lun_scan(starget, bflags, rescan) != 0)
1640 scsi_sequential_lun_scan(starget, bflags,
1641 starget->scsi_level, rescan);
1645 scsi_autopm_put_target(starget);
1650 scsi_target_reap(starget);
1652 put_device(&starget->dev);
1960 struct scsi_target *starget;
1965 starget = scsi_alloc_target(&shost->shost_gendev, 0, shost->this_id);
1966 if (!starget)
1969 sdev = scsi_alloc_sdev(starget, 0, NULL);
1973 scsi_target_reap(starget);
1974 put_device(&starget->dev);