Lines Matching refs:starget

278 static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,  in scsi_alloc_sdev()  argument
285 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in scsi_alloc_sdev()
297 sdev->id = starget->id; in scsi_alloc_sdev()
299 sdev->channel = starget->channel; in scsi_alloc_sdev()
311 sdev->sdev_gendev.parent = get_device(&starget->dev); in scsi_alloc_sdev()
312 sdev->sdev_target = starget; in scsi_alloc_sdev()
339 put_device(&starget->dev); in scsi_alloc_sdev()
358 put_device(&starget->dev); in scsi_alloc_sdev()
390 static void scsi_target_destroy(struct scsi_target *starget) in scsi_target_destroy() argument
392 struct device *dev = &starget->dev; in scsi_target_destroy()
396 BUG_ON(starget->state == STARGET_DEL); in scsi_target_destroy()
397 starget->state = STARGET_DEL; in scsi_target_destroy()
401 shost->hostt->target_destroy(starget); in scsi_target_destroy()
402 list_del_init(&starget->siblings); in scsi_target_destroy()
410 struct scsi_target *starget = to_scsi_target(dev); in scsi_target_dev_release() local
412 kfree(starget); in scsi_target_dev_release()
430 struct scsi_target *starget, *found_starget = NULL; in __scsi_find_target() local
435 list_for_each_entry(starget, &shost->__targets, siblings) { in __scsi_find_target()
436 if (starget->id == id && in __scsi_find_target()
437 starget->channel == channel) { in __scsi_find_target()
438 found_starget = starget; in __scsi_find_target()
459 struct scsi_target *starget in scsi_target_reap_ref_release() local
467 if ((starget->state != STARGET_CREATED) && in scsi_target_reap_ref_release()
468 (starget->state != STARGET_CREATED_REMOVE)) { in scsi_target_reap_ref_release()
469 transport_remove_device(&starget->dev); in scsi_target_reap_ref_release()
470 device_del(&starget->dev); in scsi_target_reap_ref_release()
472 scsi_target_destroy(starget); in scsi_target_reap_ref_release()
475 static void scsi_target_reap_ref_put(struct scsi_target *starget) in scsi_target_reap_ref_put() argument
477 kref_put(&starget->reap_ref, scsi_target_reap_ref_release); in scsi_target_reap_ref_put()
500 struct scsi_target *starget; in scsi_alloc_target() local
504 starget = kzalloc(size, GFP_KERNEL); in scsi_alloc_target()
505 if (!starget) { in scsi_alloc_target()
509 dev = &starget->dev; in scsi_alloc_target()
511 kref_init(&starget->reap_ref); in scsi_alloc_target()
517 starget->id = id; in scsi_alloc_target()
518 starget->channel = channel; in scsi_alloc_target()
519 starget->can_queue = 0; in scsi_alloc_target()
520 INIT_LIST_HEAD(&starget->siblings); in scsi_alloc_target()
521 INIT_LIST_HEAD(&starget->devices); in scsi_alloc_target()
522 starget->state = STARGET_CREATED; in scsi_alloc_target()
523 starget->scsi_level = SCSI_2; in scsi_alloc_target()
524 starget->max_target_blocked = SCSI_DEFAULT_TARGET_BLOCKED; in scsi_alloc_target()
532 list_add_tail(&starget->siblings, &shost->__targets); in scsi_alloc_target()
537 error = shost->hostt->target_alloc(starget); in scsi_alloc_target()
544 scsi_target_destroy(starget); in scsi_alloc_target()
550 return starget; in scsi_alloc_target()
591 void scsi_target_reap(struct scsi_target *starget) in scsi_target_reap() argument
598 BUG_ON(starget->state == STARGET_DEL); in scsi_target_reap()
599 scsi_target_reap_ref_put(starget); in scsi_target_reap()
1148 static int scsi_probe_and_add_lun(struct scsi_target *starget, in scsi_probe_and_add_lun() argument
1158 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in scsi_probe_and_add_lun()
1164 sdev = scsi_device_lookup_by_target(starget, lun); in scsi_probe_and_add_lun()
1183 sdev = scsi_alloc_sdev(starget, lun, hostdata); in scsi_probe_and_add_lun()
1252 (starget->pdt_1f_for_no_lun && (result[0] & 0x1f) == 0x1f)) && in scsi_probe_and_add_lun()
1301 static void scsi_sequential_lun_scan(struct scsi_target *starget, in scsi_sequential_lun_scan() argument
1307 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in scsi_sequential_lun_scan()
1309 SCSI_LOG_SCAN_BUS(3, starget_printk(KERN_INFO, starget, in scsi_sequential_lun_scan()
1367 if ((scsi_probe_and_add_lun(starget, lun, NULL, NULL, rescan, in scsi_sequential_lun_scan()
1393 static int scsi_report_lun_scan(struct scsi_target *starget, blist_flags_t bflags, in scsi_report_lun_scan() argument
1405 struct Scsi_Host *shost = dev_to_shost(&starget->dev); in scsi_report_lun_scan()
1416 if (starget->scsi_level < SCSI_2 && in scsi_report_lun_scan()
1417 starget->scsi_level != SCSI_UNKNOWN) in scsi_report_lun_scan()
1419 if (starget->scsi_level < SCSI_3 && in scsi_report_lun_scan()
1424 if (starget->no_report_luns) in scsi_report_lun_scan()
1427 if (!(sdev = scsi_device_lookup_by_target(starget, 0))) { in scsi_report_lun_scan()
1428 sdev = scsi_alloc_sdev(starget, 0, NULL); in scsi_report_lun_scan()
1536 res = scsi_probe_and_add_lun(starget, in scsi_report_lun_scan()
1568 struct scsi_target *starget; in __scsi_add_device() local
1573 starget = scsi_alloc_target(parent, channel, id); in __scsi_add_device()
1574 if (!starget) in __scsi_add_device()
1576 scsi_autopm_get_target(starget); in __scsi_add_device()
1583 scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, hostdata); in __scsi_add_device()
1587 scsi_autopm_put_target(starget); in __scsi_add_device()
1592 scsi_target_reap(starget); in __scsi_add_device()
1593 put_device(&starget->dev); in __scsi_add_device()
1640 struct scsi_target *starget; in __scsi_scan_target() local
1648 starget = scsi_alloc_target(parent, channel, id); in __scsi_scan_target()
1649 if (!starget) in __scsi_scan_target()
1651 scsi_autopm_get_target(starget); in __scsi_scan_target()
1657 scsi_probe_and_add_lun(starget, lun, NULL, NULL, rescan, NULL); in __scsi_scan_target()
1665 res = scsi_probe_and_add_lun(starget, 0, &bflags, NULL, rescan, NULL); in __scsi_scan_target()
1667 if (scsi_report_lun_scan(starget, bflags, rescan) != 0) in __scsi_scan_target()
1672 scsi_sequential_lun_scan(starget, bflags, in __scsi_scan_target()
1673 starget->scsi_level, rescan); in __scsi_scan_target()
1677 scsi_autopm_put_target(starget); in __scsi_scan_target()
1682 scsi_target_reap(starget); in __scsi_scan_target()
1684 put_device(&starget->dev); in __scsi_scan_target()