aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_scan.c
diff options
context:
space:
mode:
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 8d0d302844a..9fa209097e3 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)
293{ 293{
294 struct device *parent = dev->parent; 294 struct device *parent = dev->parent;
295 struct scsi_target *starget = to_scsi_target(dev); 295 struct scsi_target *starget = to_scsi_target(dev);
296 struct Scsi_Host *shost = dev_to_shost(parent);
297
298 if (shost->hostt->target_destroy)
299 shost->hostt->target_destroy(starget);
296 kfree(starget); 300 kfree(starget);
297 put_device(parent); 301 put_device(parent);
298} 302}
@@ -360,9 +364,23 @@ static struct scsi_target *scsi_alloc_target(struct device *parent,
360 list_add_tail(&starget->siblings, &shost->__targets); 364 list_add_tail(&starget->siblings, &shost->__targets);
361 spin_unlock_irqrestore(shost->host_lock, flags); 365 spin_unlock_irqrestore(shost->host_lock, flags);
362 /* allocate and add */ 366 /* allocate and add */
363 transport_setup_device(&starget->dev); 367 transport_setup_device(dev);
364 device_add(&starget->dev); 368 device_add(dev);
365 transport_add_device(&starget->dev); 369 transport_add_device(dev);
370 if (shost->hostt->target_alloc) {
371 int error = shost->hostt->target_alloc(starget);
372
373 if(error) {
374 dev_printk(KERN_ERR, dev, "target allocation failed, error %d\n", error);
375 /* don't want scsi_target_reap to do the final
376 * put because it will be under the host lock */
377 get_device(dev);
378 scsi_target_reap(starget);
379 put_device(dev);
380 return NULL;
381 }
382 }
383
366 return starget; 384 return starget;
367 385
368 found: 386 found:
@@ -625,6 +643,7 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
625 case TYPE_MEDIUM_CHANGER: 643 case TYPE_MEDIUM_CHANGER:
626 case TYPE_ENCLOSURE: 644 case TYPE_ENCLOSURE:
627 case TYPE_COMM: 645 case TYPE_COMM:
646 case TYPE_RBC:
628 sdev->writeable = 1; 647 sdev->writeable = 1;
629 break; 648 break;
630 case TYPE_WORM: 649 case TYPE_WORM: