Lines Matching refs:starget

266  * @starget: which target to allocate a &scsi_device for
278 static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
285 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
297 sdev->id = starget->id;
299 sdev->channel = starget->channel;
311 sdev->sdev_gendev.parent = get_device(&starget->dev);
312 sdev->sdev_target = starget;
339 put_device(&starget->dev);
357 put_device(&starget->dev);
389 static void scsi_target_destroy(struct scsi_target *starget)
391 struct device *dev = &starget->dev;
395 BUG_ON(starget->state == STARGET_DEL);
396 starget->state = STARGET_DEL;
400 shost->hostt->target_destroy(starget);
401 list_del_init(&starget->siblings);
409 struct scsi_target *starget = to_scsi_target(dev);
411 kfree(starget);
429 struct scsi_target *starget, *found_starget = NULL;
434 list_for_each_entry(starget, &shost->__targets, siblings) {
435 if (starget->id == id &&
436 starget->channel == channel) {
437 found_starget = starget;
458 struct scsi_target *starget
466 if ((starget->state != STARGET_CREATED) &&
467 (starget->state != STARGET_CREATED_REMOVE)) {
468 transport_remove_device(&starget->dev);
469 device_del(&starget->dev);
471 scsi_target_destroy(starget);
474 static void scsi_target_reap_ref_put(struct scsi_target *starget)
476 kref_put(&starget->reap_ref, scsi_target_reap_ref_release);
499 struct scsi_target *starget;
503 starget = kzalloc(size, GFP_KERNEL);
504 if (!starget) {
508 dev = &starget->dev;
510 kref_init(&starget->reap_ref);
516 starget->id = id;
517 starget->channel = channel;
518 starget->can_queue = 0;
519 INIT_LIST_HEAD(&starget->siblings);
520 INIT_LIST_HEAD(&starget->devices);
521 starget->state = STARGET_CREATED;
522 starget->scsi_level = SCSI_2;
523 starget->max_target_blocked = SCSI_DEFAULT_TARGET_BLOCKED;
531 list_add_tail(&starget->siblings, &shost->__targets);
536 error = shost->hostt->target_alloc(starget);
543 scsi_target_destroy(starget);
549 return starget;
584 * @starget: target to be checked
590 void scsi_target_reap(struct scsi_target *starget)
597 BUG_ON(starget->state == STARGET_DEL);
598 scsi_target_reap_ref_put(starget);
1135 * @starget: pointer to target device structure
1154 static int scsi_probe_and_add_lun(struct scsi_target *starget,
1164 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
1170 sdev = scsi_device_lookup_by_target(starget, lun);
1189 sdev = scsi_alloc_sdev(starget, lun, hostdata);
1256 if (((result[0] >> 5) == 1 || starget->pdt_1f_for_no_lun) &&
1294 * @starget: pointer to target structure to scan
1306 static void scsi_sequential_lun_scan(struct scsi_target *starget,
1312 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
1314 SCSI_LOG_SCAN_BUS(3, starget_printk(KERN_INFO, starget,
1372 if ((scsi_probe_and_add_lun(starget, lun, NULL, NULL, rescan,
1380 * @starget: which target
1392 * If starget->no_report_luns is set, return 1 always.
1398 static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflags,
1410 struct Scsi_Host *shost = dev_to_shost(&starget->dev);
1424 if (starget->scsi_level < SCSI_2 &&
1425 starget->scsi_level != SCSI_UNKNOWN)
1427 if (starget->scsi_level < SCSI_3 &&
1432 if (starget->no_report_luns)
1435 if (!(sdev = scsi_device_lookup_by_target(starget, 0))) {
1436 sdev = scsi_alloc_sdev(starget, 0, NULL);
1545 res = scsi_probe_and_add_lun(starget,
1577 struct scsi_target *starget;
1582 starget = scsi_alloc_target(parent, channel, id);
1583 if (!starget)
1585 scsi_autopm_get_target(starget);
1592 scsi_probe_and_add_lun(starget, lun, NULL, &sdev,
1597 scsi_autopm_put_target(starget);
1602 scsi_target_reap(starget);
1603 put_device(&starget->dev);
1668 struct scsi_target *starget;
1676 starget = scsi_alloc_target(parent, channel, id);
1677 if (!starget)
1679 scsi_autopm_get_target(starget);
1685 scsi_probe_and_add_lun(starget, lun, NULL, NULL, rescan, NULL);
1693 res = scsi_probe_and_add_lun(starget, 0, &bflags, NULL, rescan, NULL);
1695 if (scsi_report_lun_scan(starget, bflags, rescan) != 0)
1700 scsi_sequential_lun_scan(starget, bflags,
1701 starget->scsi_level, rescan);
1705 scsi_autopm_put_target(starget);
1710 scsi_target_reap(starget);
1712 put_device(&starget->dev);