Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1354283imu; Fri, 11 Jan 2019 21:36:02 -0800 (PST) X-Google-Smtp-Source: ALg8bN5m0bM47s/5Vda/kPuy5BGr67+AyCPOVeN2Qdwvg8nJEC0AxrwnhFHZAdvPKM7huY8nlv4L X-Received: by 2002:a62:9f1b:: with SMTP id g27mr16866553pfe.87.1547271362091; Fri, 11 Jan 2019 21:36:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547271362; cv=none; d=google.com; s=arc-20160816; b=jlKitQjZItD8J24puHVP8k3Z850ko7jXstd+EoCd11rOAZTZoGltJBosHVT2mcU4Es Ji/YiNRvJN90HVtcGURXKfT0TzwxVpCnnmGocbZZFoKkLGyY1uMoNu7Ry6PRzuwIaqZq jp8pAFn8C8Gpi85aNZATxM5k5buBt34oA349FDDFrPoDk+3nGRL9b9F1QN3lRj2Z6xDQ ADIK8p00JZJZftn/hIsM4tVks6gF3iaAP2mzgFzvvbI6H060IYClZAtm9z1wU67TFQDa P53koCEzAm4AapmR5s1bSmSxdMmWi3jKgWBjm4Ij7oJLYqxaWBg24ZUNA7RAzmFc0cGF 0vrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=7ShIJq766Qc8Y/A5T5dsWbItZEA7Q8RE8v6LaoGJ1gw=; b=yuEHEL0suAxoCZzH65rEs5mojL83HUoiZf/17JIr3VK5fcNTj78ClFC69YXVBvHY73 5tbT8EaKuiacFkRsY1gccUe4TZdi7Ng61Iqie0a9gyVMvaqA/F5kq6ATBYpIaGWzDC1X EbERMMpCnafTC4JBtoEARxbht7tq5cHEsWlodZxQw9s4iBSYHTSB8wwkgCjz4zU/gRWm rxE4Nn022pxMYYeKLvKtAnf43RI6r+vCwRmnBVGxVS83eKyxlwT7YjjjvX2e1I8y6CQM 21pmKBxb04/hlMAptxih0MBme+CmRCggXWWQSlaWkfwbhBqZ8/Xp1jNjCne83kbqd2i2 vRMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YlV8HKMn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h127si11814228pfe.204.2019.01.11.21.35.46; Fri, 11 Jan 2019 21:36:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YlV8HKMn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725837AbfALFem (ORCPT + 99 others); Sat, 12 Jan 2019 00:34:42 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34648 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbfALFem (ORCPT ); Sat, 12 Jan 2019 00:34:42 -0500 Received: by mail-wr1-f67.google.com with SMTP id j2so17397210wrw.1; Fri, 11 Jan 2019 21:34:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=7ShIJq766Qc8Y/A5T5dsWbItZEA7Q8RE8v6LaoGJ1gw=; b=YlV8HKMnm/F7wBLC6aCmAmXrM36Ps+o5Sb0jW5P2t5uuoKLyTuG8uOhwswAu4evegb mMrORjpbx+fiDXP++ahC0v1O82st3hNNSWI8gkHaj0VHgu/2aWZ0+akn4H7kOg2lZ36W i5/Qmz3YWtnXOlGz0VQ1yGd27qK/3IjWQZtIygCzBpmurlHSobFnGLc8b6nOkVdWtq8o oIlJnNsuNhIAkRGMipCSHdQtK6BAZ9fRflIhsR81hetOyn0Rui6KZP5wOEv1DAW1qbN6 lEE/ZU98hw7X8+PPNTFXL7sgLciJeVz27FLIrwmVSiPJa9m5o0Eu+SCMhQDMa80XJBhw nMUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=7ShIJq766Qc8Y/A5T5dsWbItZEA7Q8RE8v6LaoGJ1gw=; b=Cq3AwsyO71udseyNje3s8on5hfQJRvxOr+2TBlaF+Ycff9Xsg1DUVNCcFSuJ/oLRr2 NefxGBvTOKngUS9QMnMybUkO7F0A1W/zkqB09m1LRc1gxFIGCxztd9N1HbjzbJvlBdVO QToJ4hAPwL95nTLj+5Hd2J01cUUz/VRjSxBE1cGx90uG3hdERWM3oO0KNzvF6HH0FMtY BrFbhrIqLh3+flM9opnpIxomH8+1G0TQ/39XZANu3kPenNttwjugJYUsufYHCSAOenrv PXEMAZjt8ZJi0HFCAd+UrNhNRKJqk7ghFsdmIFQGXs1QXBaMQiLIw5TLvxAGLq+1VIC+ FgRA== X-Gm-Message-State: AJcUukca6qH7A1Bf8G1XGDbZUupB99mATie/mue5VvdOwqjn1GSFOrhn Iaypg9fGvXkJAWTU9PzW9Zc3PGdVAMQ= X-Received: by 2002:a5d:5111:: with SMTP id s17mr15690705wrt.43.1547271279218; Fri, 11 Jan 2019 21:34:39 -0800 (PST) Received: from alpaca.bmw-carit.intra ([145.253.130.2]) by smtp.gmail.com with ESMTPSA id k19sm87681706wre.5.2019.01.11.21.34.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Jan 2019 21:34:38 -0800 (PST) From: Lukas Bulwahn To: linux-scsi@vger.kernel.org Cc: QLogic-Storage-Upstream@qlogic.com, "James E.J. Bottomley" , "Martin K. Petersen" , Johannes Thumshirn , QLogic-Storage-Upstream@cavium.com, linux-kernel@vger.kernel.org, Lukas Bulwahn Subject: [PATCH] fcoe: make use of fip_mode enum complete Date: Sat, 12 Jan 2019 06:34:27 +0100 Message-Id: <20190112053427.35696-1-lukas.bulwahn@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 1917d42d14b7 ("fcoe: use enum for fip_mode") introduces a separate enum for the fip_mode that shall be used during initialisation handling until it is passed to fcoe_ctrl_link_up to set the initial fip_state. That change was incomplete and gcc quietly converted in various places between the fip_mode and the fip_state enum values with implicit enum conversions, which fortunately cannot cause any issues in the actual code's execution. clang however warns about these implicit enum conversions in the scsi drivers. This commit consolidates the use of the two enums, guided by clang's enum-conversion warnings. This commit now completes the use of the fip_mode: It expects and uses fip_mode in {bnx2fc,fcoe}_interface_create and fcoe_ctlr_init, and it explicitly converts from fip_mode to fip_state only at the single point in fcoe_ctlr_link_up. To eliminate that adding or removing values from fip_mode or fip_state enum break the right mapping of values, all fip_mode values are assigned to their fip_state counterparts. Signed-off-by: Lukas Bulwahn --- resending of this patch: https://patchwork.kernel.org/patch/10589865/ drivers/scsi/bnx2fc/bnx2fc_fcoe.c | 2 +- drivers/scsi/fcoe/fcoe.c | 2 +- drivers/scsi/fcoe/fcoe_ctlr.c | 4 ++-- drivers/scsi/fcoe/fcoe_transport.c | 2 +- drivers/scsi/qedf/qedf_main.c | 2 +- include/scsi/libfcoe.h | 8 ++++---- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index f00045813378..83aaab4fdab5 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c @@ -1445,7 +1445,7 @@ static struct bnx2fc_hba *bnx2fc_hba_create(struct cnic_dev *cnic) static struct bnx2fc_interface * bnx2fc_interface_create(struct bnx2fc_hba *hba, struct net_device *netdev, - enum fip_state fip_mode) + enum fip_mode fip_mode) { struct fcoe_ctlr_device *ctlr_dev; struct bnx2fc_interface *interface; diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index f46b312d04bc..6768b2e8148a 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c @@ -390,7 +390,7 @@ static int fcoe_interface_setup(struct fcoe_interface *fcoe, * Returns: pointer to a struct fcoe_interface or NULL on error */ static struct fcoe_interface *fcoe_interface_create(struct net_device *netdev, - enum fip_state fip_mode) + enum fip_mode fip_mode) { struct fcoe_ctlr_device *ctlr_dev; struct fcoe_ctlr *ctlr; diff --git a/drivers/scsi/fcoe/fcoe_ctlr.c b/drivers/scsi/fcoe/fcoe_ctlr.c index 54da3166da8d..a52d3ad94876 100644 --- a/drivers/scsi/fcoe/fcoe_ctlr.c +++ b/drivers/scsi/fcoe/fcoe_ctlr.c @@ -147,7 +147,7 @@ static void fcoe_ctlr_map_dest(struct fcoe_ctlr *fip) * fcoe_ctlr_init() - Initialize the FCoE Controller instance * @fip: The FCoE controller to initialize */ -void fcoe_ctlr_init(struct fcoe_ctlr *fip, enum fip_state mode) +void fcoe_ctlr_init(struct fcoe_ctlr *fip, enum fip_mode mode) { fcoe_ctlr_set_state(fip, FIP_ST_LINK_WAIT); fip->mode = mode; @@ -454,7 +454,7 @@ void fcoe_ctlr_link_up(struct fcoe_ctlr *fip) mutex_unlock(&fip->ctlr_mutex); fc_linkup(fip->lp); } else if (fip->state == FIP_ST_LINK_WAIT) { - fcoe_ctlr_set_state(fip, fip->mode); + fcoe_ctlr_set_state(fip, (enum fip_state) fip->mode); switch (fip->mode) { default: LIBFCOE_FIP_DBG(fip, "invalid mode %d\n", fip->mode); diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c index f4909cd206d3..b381ab066b9c 100644 --- a/drivers/scsi/fcoe/fcoe_transport.c +++ b/drivers/scsi/fcoe/fcoe_transport.c @@ -873,7 +873,7 @@ static int fcoe_transport_create(const char *buffer, int rc = -ENODEV; struct net_device *netdev = NULL; struct fcoe_transport *ft = NULL; - enum fip_state fip_mode = (enum fip_state)(long)kp->arg; + enum fip_mode fip_mode = (enum fip_mode)(long)kp->arg; mutex_lock(&ft_mutex); diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index 0a5dd5595dd3..cd61905ca2f5 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -1418,7 +1418,7 @@ static struct libfc_function_template qedf_lport_template = { static void qedf_fcoe_ctlr_setup(struct qedf_ctx *qedf) { - fcoe_ctlr_init(&qedf->ctlr, FIP_ST_AUTO); + fcoe_ctlr_init(&qedf->ctlr, FIP_MODE_AUTO); qedf->ctlr.send = qedf_fip_send; qedf->ctlr.get_src_addr = qedf_get_src_mac; diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h index cb8a273732cf..f8f1f039a611 100644 --- a/include/scsi/libfcoe.h +++ b/include/scsi/libfcoe.h @@ -80,9 +80,9 @@ enum fip_state { */ enum fip_mode { FIP_MODE_AUTO = FIP_ST_AUTO, - FIP_MODE_NON_FIP, - FIP_MODE_FABRIC, - FIP_MODE_VN2VN, + FIP_MODE_NON_FIP = FIP_ST_NON_FIP, + FIP_MODE_FABRIC = FIP_ST_ENABLED, + FIP_MODE_VN2VN = FIP_ST_VNMP_START, }; /** @@ -250,7 +250,7 @@ struct fcoe_rport { }; /* FIP API functions */ -void fcoe_ctlr_init(struct fcoe_ctlr *, enum fip_state); +void fcoe_ctlr_init(struct fcoe_ctlr *fip, enum fip_mode); void fcoe_ctlr_destroy(struct fcoe_ctlr *); void fcoe_ctlr_link_up(struct fcoe_ctlr *); int fcoe_ctlr_link_down(struct fcoe_ctlr *); -- 2.17.1