aboutsummaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_scan.c
diff options
context:
space:
mode:
authorJames Bottomley <jejb@mulgrave.(none)>2005-05-26 14:14:55 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-05-26 14:14:55 -0400
commit153b1e1fd957861e2c185473dd3c3d93561066e4 (patch)
treec296359e8212ed83c2834b20a62b7a650f3d0fc2 /drivers/scsi/scsi_scan.c
parentcdbbde14cb55dd10771ce79154f787322d88411b (diff)
parentc3e9dda4f5702ee5b346f4770de53f79e8ad1d8d (diff)
Automatic merge of ../scsi-misc-2.6-old/
Diffstat (limited to 'drivers/scsi/scsi_scan.c')
-rw-r--r--drivers/scsi/scsi_scan.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index cca772624ae..4d273ceb1d0 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -293,6 +293,10 @@ static void scsi_target_dev_release(struct device *dev)
{
struct device *parent = dev->parent;
struct scsi_target *starget = to_scsi_target(dev);
+ struct Scsi_Host *shost = dev_to_shost(parent);
+
+ if (shost->hostt->target_destroy)
+ shost->hostt->target_destroy(starget);
kfree(starget);
put_device(parent);
}
@@ -360,9 +364,23 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
list_add_tail(&starget->siblings, &shost->__targets);
spin_unlock_irqrestore(shost->host_lock, flags);
/* allocate and add */
- transport_setup_device(&starget->dev);
- device_add(&starget->dev);
- transport_add_device(&starget->dev);
+ transport_setup_device(dev);
+ device_add(dev);
+ transport_add_device(dev);
+ if (shost->hostt->target_alloc) {
+ int error = shost->hostt->target_alloc(starget);
+
+ if(error) {
+ dev_printk(KERN_ERR, dev, "target allocation failed, error %d\n", error);
+ /* don't want scsi_target_reap to do the final
+ * put because it will be under the host lock */
+ get_device(dev);
+ scsi_target_reap(starget);
+ put_device(dev);
+ return NULL;
+ }
+ }
+
return starget;
found:
@@ -625,6 +643,7 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
case TYPE_MEDIUM_CHANGER:
case TYPE_ENCLOSURE:
case TYPE_COMM:
+ case TYPE_RBC:
sdev->writeable = 1;
break;
case TYPE_WORM: