From patchwork Tue Sep 29 10:47:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 7285081 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 22814BEEA4 for ; Tue, 29 Sep 2015 10:48:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3756A206CC for ; Tue, 29 Sep 2015 10:48:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48F7B206D8 for ; Tue, 29 Sep 2015 10:48:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964799AbbI2Ks0 (ORCPT ); Tue, 29 Sep 2015 06:48:26 -0400 Received: from mx2.suse.de ([195.135.220.15]:41949 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934644AbbI2Kr7 (ORCPT ); Tue, 29 Sep 2015 06:47:59 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A0FE27502E; Tue, 29 Sep 2015 10:47:48 +0000 (UTC) From: Hannes Reinecke To: James Bottomley Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart van Assche , Ewan Milne , "Martin K. Petersen" , Hannes Reinecke Subject: [PATCH 18/36] scsi_dh_alua: rework alua_check_tpgs() to return the tpgs mode Date: Tue, 29 Sep 2015 12:47:20 +0200 Message-Id: <1443523658-87622-19-git-send-email-hare@suse.de> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: <1443523658-87622-1-git-send-email-hare@suse.de> References: <1443523658-87622-1-git-send-email-hare@suse.de> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of returning an error code in alua_check_tpgs() we should rather return the tpgs mode directly and have a cleanup syntax. Signed-off-by: Hannes Reinecke --- drivers/scsi/device_handler/scsi_dh_alua.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index b72cea6..c6fcfa5 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -167,24 +167,23 @@ static int submit_stpg(struct scsi_device *sdev, int group_id, * Examine the TPGS setting of the sdev to find out if ALUA * 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 * difficulties, so disable it for now. */ if (sdev->type != TYPE_DISK) { - h->tpgs = TPGS_MODE_NONE; sdev_printk(KERN_INFO, sdev, "%s: disable for non-disk devices\n", ALUA_DH_NAME); - return SCSI_DH_DEV_UNSUPP; + return tpgs; } - h->tpgs = scsi_device_tpgs(sdev); - switch (h->tpgs) { + tpgs = scsi_device_tpgs(sdev); + switch (tpgs) { case TPGS_MODE_EXPLICIT|TPGS_MODE_IMPLICIT: sdev_printk(KERN_INFO, sdev, "%s: supports implicit and explicit TPGS\n", @@ -201,18 +200,16 @@ static int alua_check_tpgs(struct scsi_device *sdev, struct alua_dh_data *h) case TPGS_MODE_NONE: sdev_printk(KERN_INFO, sdev, "%s: not supported\n", ALUA_DH_NAME); - err = SCSI_DH_DEV_UNSUPP; break; default: sdev_printk(KERN_INFO, sdev, "%s: unsupported TPGS setting %d\n", - ALUA_DH_NAME, h->tpgs); - h->tpgs = TPGS_MODE_NONE; - err = SCSI_DH_DEV_UNSUPP; + ALUA_DH_NAME, tpgs); + tpgs = TPGS_MODE_NONE; break; } - return err; + return tpgs; } /* @@ -587,10 +584,10 @@ static unsigned alua_stpg(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); - if (err != SCSI_DH_OK) + h->tpgs = alua_check_tpgs(sdev); + if (h->tpgs == TPGS_MODE_NONE) goto out; err = alua_check_vpd(sdev, h);