From 6835591cd59f7d0dc7a4918b1f10e5acc65f90bb Mon Sep 17 00:00:00 2001 From: James Smart Date: Mon, 20 Sep 2004 13:24:08 -0400 Subject: [PATCH] [PATCH] Allow LLDD's to fail slave alloc (non-existent slave) In the cases where an LLDD knows that a lun does not exist, if it fails slave_alloc(), the midlayer reports an error message indicating slave_alloc failed. This patch allows the LLDD to reject the slave_alloc() call if it knows the lun doesn't exist, and skips the reporting of the slave_alloc failure message. This avoids jumping through hoops in the LLDD to avoid error messages from slave_alloc. Also saves cycles in that the probe is also cancelled for the non-existent device. Signed-off-by: James Bottomley --- drivers/scsi/scsi_scan.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 4ad924dbb110a..d85bf359c2b04 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -204,6 +204,7 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost, { struct scsi_device *sdev, *device; unsigned long flags; + int display_failure_msg = 1, ret; sdev = kmalloc(sizeof(*sdev) + shost->transportt->size, GFP_ATOMIC); if (!sdev) @@ -252,8 +253,16 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost, scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun); if (shost->hostt->slave_alloc) { - if (shost->hostt->slave_alloc(sdev)) + ret = shost->hostt->slave_alloc(sdev); + if (ret) { + /* + * if LLDD reports slave not present, don't clutter + * console with alloc failure messages + */ + if (ret == -ENXIO) + display_failure_msg = 0; goto out_free_queue; + } } if (shost->transportt->setup) { @@ -325,7 +334,8 @@ out_free_queue: out_free_dev: kfree(sdev); out: - printk(ALLOC_FAILURE_MSG, __FUNCTION__); + if (display_failure_msg) + printk(ALLOC_FAILURE_MSG, __FUNCTION__); return NULL; } -- 2.53.0