/* Note - this device is not accessible from any high-level drivers (including generics), which is probably not optimal. We can add hooks later to attach  */
struct scsi_device* scsi_get_host_dev(struct Scsi_Host *shost)
/* Note - this device is not accessible from any high-level drivers (including generics), which is probably not optimal. We can add hooks later to attach  */
struct scsi_device* scsi_get_host_dev(struct Scsi_Host *shost)
{
	struct scsi_device *sdev = NULL;
	struct scsi_target *starget;
	mutex_lock(&shost->scan_mutex);
	if (!scsi_host_scan_allowed(shost))
		goto out;
	starget = scsi_alloc_target(&shost->shost_gendev, 0, shost->this_id);
	if (!starget)
		goto out;
	sdev = scsi_alloc_sdev(starget, 0, NULL);
	if (sdev) {
		sdev->sdev_gendev.parent = get_device(&starget->dev);
		sdev->borken = 0;
	} else
		scsi_target_reap(starget);
	put_device(&starget->dev);
 out:
	mutex_unlock(&shost->scan_mutex);
	return sdev;
}