Commit ad0ea64c authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen

scsi_dh_alua: rework alua_check_tpgs() to return the tpgs mode

Instead of returning an error code in alua_check_tpgs() we should
rather return the tpgs mode directly and have a cleaner syntax.
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a7089770
...@@ -262,24 +262,23 @@ static unsigned submit_stpg(struct alua_dh_data *h) ...@@ -262,24 +262,23 @@ static unsigned submit_stpg(struct alua_dh_data *h)
* Examine the TPGS setting of the sdev to find out if ALUA * Examine the TPGS setting of the sdev to find out if ALUA
* is supported. * is supported.
*/ */
static int alua_check_tpgs(struct scsi_device *sdev, struct alua_dh_data *h) static int alua_check_tpgs(struct scsi_device *sdev)
{ {
int err = SCSI_DH_OK; int tpgs = TPGS_MODE_NONE;
/* /*
* ALUA support for non-disk devices is fraught with * ALUA support for non-disk devices is fraught with
* difficulties, so disable it for now. * difficulties, so disable it for now.
*/ */
if (sdev->type != TYPE_DISK) { if (sdev->type != TYPE_DISK) {
h->tpgs = TPGS_MODE_NONE;
sdev_printk(KERN_INFO, sdev, sdev_printk(KERN_INFO, sdev,
"%s: disable for non-disk devices\n", "%s: disable for non-disk devices\n",
ALUA_DH_NAME); ALUA_DH_NAME);
return SCSI_DH_DEV_UNSUPP; return tpgs;
} }
h->tpgs = scsi_device_tpgs(sdev); tpgs = scsi_device_tpgs(sdev);
switch (h->tpgs) { switch (tpgs) {
case TPGS_MODE_EXPLICIT|TPGS_MODE_IMPLICIT: case TPGS_MODE_EXPLICIT|TPGS_MODE_IMPLICIT:
sdev_printk(KERN_INFO, sdev, sdev_printk(KERN_INFO, sdev,
"%s: supports implicit and explicit TPGS\n", "%s: supports implicit and explicit TPGS\n",
...@@ -296,18 +295,16 @@ static int alua_check_tpgs(struct scsi_device *sdev, struct alua_dh_data *h) ...@@ -296,18 +295,16 @@ static int alua_check_tpgs(struct scsi_device *sdev, struct alua_dh_data *h)
case TPGS_MODE_NONE: case TPGS_MODE_NONE:
sdev_printk(KERN_INFO, sdev, "%s: not supported\n", sdev_printk(KERN_INFO, sdev, "%s: not supported\n",
ALUA_DH_NAME); ALUA_DH_NAME);
err = SCSI_DH_DEV_UNSUPP;
break; break;
default: default:
sdev_printk(KERN_INFO, sdev, sdev_printk(KERN_INFO, sdev,
"%s: unsupported TPGS setting %d\n", "%s: unsupported TPGS setting %d\n",
ALUA_DH_NAME, h->tpgs); ALUA_DH_NAME, tpgs);
h->tpgs = TPGS_MODE_NONE; tpgs = TPGS_MODE_NONE;
err = SCSI_DH_DEV_UNSUPP;
break; break;
} }
return err; return tpgs;
} }
/* /*
...@@ -627,10 +624,10 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_ ...@@ -627,10 +624,10 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h, int wait_
*/ */
static int alua_initialize(struct scsi_device *sdev, struct alua_dh_data *h) static int alua_initialize(struct scsi_device *sdev, struct alua_dh_data *h)
{ {
int err; int err = SCSI_DH_DEV_UNSUPP;
err = alua_check_tpgs(sdev, h); h->tpgs = alua_check_tpgs(sdev);
if (err != SCSI_DH_OK) if (h->tpgs == TPGS_MODE_NONE)
goto out; goto out;
err = alua_check_vpd(sdev, h); err = alua_check_vpd(sdev, h);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment