From patchwork Wed Apr 17 21:44:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10906199 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E837517E0 for ; Wed, 17 Apr 2019 21:45:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEE932867C for ; Wed, 17 Apr 2019 21:45:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BFAA4287C8; Wed, 17 Apr 2019 21:45:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A3252867C for ; Wed, 17 Apr 2019 21:45:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387919AbfDQVpA (ORCPT ); Wed, 17 Apr 2019 17:45:00 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:44016 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726162AbfDQVpA (ORCPT ); Wed, 17 Apr 2019 17:45:00 -0400 Received: by mail-pl1-f196.google.com with SMTP id n8so106066plp.10 for ; Wed, 17 Apr 2019 14:44:59 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=BTVDSEoCQnj984xC3RsloCv0YmRe1xZCWqn9kcLbPO8=; b=TXh4YoAZmkxN4mjsQqK2oHs1EO3DwMidgsExQq10Km7chrIPBiykXUvHLBOs9111rM VPA/TR6ddLkelfoHsddI9Sr0yTrfKXtO98NC0bPv7zvpeUEjcSHlV73hVGi+QGFSToCc gHJNr2ss4jYwKHK9rqevlxq6+ZFmXWdqq0Dag0whJUUbnzxAkRGZgtVrdpMyem5dso/z nJElh4z+U7f3Jz/HLyJ5g0GlWBinUJGlj5CgsQC7qPv5ZoAJuxcViUA60g2gRHJspr2F ZJbZQ5m4dNyESrUHtpJZA4VazD0wgOHL7WtnLNmWqyOwK6PzK1AiSA7f2AELVWNrJQJD EDcA== X-Gm-Message-State: APjAAAXfn0rfolVJG9FdiWaw0c3zG9UI1xKzUfMr2gwNXsHflTO6az/l VCCT+7B/jJAI5bMg+Xh+rHVeDB8l X-Google-Smtp-Source: APXvYqze2TFDZq6TVZwHvPX3+G456vAtRSB4WFvk3/gxCjTqTw4swWAjoPea/M4fXavvyNPL0yty0Q== X-Received: by 2002:a17:902:4643:: with SMTP id o61mr80927860pld.249.1555537499151; Wed, 17 Apr 2019 14:44:59 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:203:5cdc:422c:7b28:ebb5]) by smtp.gmail.com with ESMTPSA id d68sm219314pfg.16.2019.04.17.14.44.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Apr 2019 14:44:58 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Himanshu Madhani , Giridhar Malavali Subject: [PATCH 04/34] qla2xxx: Declare qla2x00_find_new_loop_id() static Date: Wed, 17 Apr 2019 14:44:13 -0700 Message-Id: <20190417214443.243152-5-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT In-Reply-To: <20190417214443.243152-1-bvanassche@acm.org> References: <20190417214443.243152-1-bvanassche@acm.org> MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since all qla2x00_find_new_loop_id() calls occur in the same source file as the definition of this function, move that function to just before its first caller and declare it static. Convert the header above this function into kernel-doc format. Cc: Himanshu Madhani Cc: Giridhar Malavali Signed-off-by: Bart Van Assche --- drivers/scsi/qla2xxx/qla_gbl.h | 2 - drivers/scsi/qla2xxx/qla_init.c | 92 +++++++++++++++------------------ 2 files changed, 43 insertions(+), 51 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 034cfc152336..97be390e027d 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -39,8 +39,6 @@ extern int qla81xx_load_risc(scsi_qla_host_t *, uint32_t *); extern int qla2x00_perform_loop_resync(scsi_qla_host_t *); extern int qla2x00_loop_resync(scsi_qla_host_t *); -extern int qla2x00_find_new_loop_id(scsi_qla_host_t *, fc_port_t *); - extern int qla2x00_fabric_login(scsi_qla_host_t *, fc_port_t *, uint16_t *); extern int qla2x00_local_device_login(scsi_qla_host_t *, fc_port_t *); diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 948f20805111..14edf3614614 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -514,6 +514,49 @@ qla2x00_async_adisc(struct scsi_qla_host *vha, fc_port_t *fcport, return rval; } +/** + * qla2x00_find_new_loop_id - scan through our port list and find a new usable loop ID + * @vha: adapter state pointer. + * @dev: port structure pointer. + * + * Returns: + * qla2x00 local function return status code. + * + * Context: + * Kernel context. + */ +static int qla2x00_find_new_loop_id(scsi_qla_host_t *vha, fc_port_t *dev) +{ + int rval; + struct qla_hw_data *ha = vha->hw; + unsigned long flags = 0; + + rval = QLA_SUCCESS; + + spin_lock_irqsave(&ha->vport_slock, flags); + + dev->loop_id = find_first_zero_bit(ha->loop_id_map, LOOPID_MAP_SIZE); + if (dev->loop_id >= LOOPID_MAP_SIZE || + qla2x00_is_reserved_id(vha, dev->loop_id)) { + dev->loop_id = FC_NO_LOOP_ID; + rval = QLA_FUNCTION_FAILED; + } else { + set_bit(dev->loop_id, ha->loop_id_map); + } + spin_unlock_irqrestore(&ha->vport_slock, flags); + + if (rval == QLA_SUCCESS) + ql_dbg(ql_dbg_disc, dev->vha, 0x2086, + "Assigning new loopid=%x, portid=%x.\n", + dev->loop_id, dev->d_id.b24); + else + ql_log(ql_log_warn, dev->vha, 0x2087, + "No loop_id's available, portid=%x.\n", + dev->d_id.b24); + + return rval; +} + static void qla24xx_handle_gnl_done_event(scsi_qla_host_t *vha, struct event_arg *ea) { @@ -5886,55 +5929,6 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha) return (rval); } -/* - * qla2x00_find_new_loop_id - * Scan through our port list and find a new usable loop ID. - * - * Input: - * ha: adapter state pointer. - * dev: port structure pointer. - * - * Returns: - * qla2x00 local function return status code. - * - * Context: - * Kernel context. - */ -int -qla2x00_find_new_loop_id(scsi_qla_host_t *vha, fc_port_t *dev) -{ - int rval; - struct qla_hw_data *ha = vha->hw; - unsigned long flags = 0; - - rval = QLA_SUCCESS; - - spin_lock_irqsave(&ha->vport_slock, flags); - - dev->loop_id = find_first_zero_bit(ha->loop_id_map, - LOOPID_MAP_SIZE); - if (dev->loop_id >= LOOPID_MAP_SIZE || - qla2x00_is_reserved_id(vha, dev->loop_id)) { - dev->loop_id = FC_NO_LOOP_ID; - rval = QLA_FUNCTION_FAILED; - } else - set_bit(dev->loop_id, ha->loop_id_map); - - spin_unlock_irqrestore(&ha->vport_slock, flags); - - if (rval == QLA_SUCCESS) - ql_dbg(ql_dbg_disc, dev->vha, 0x2086, - "Assigning new loopid=%x, portid=%x.\n", - dev->loop_id, dev->d_id.b24); - else - ql_log(ql_log_warn, dev->vha, 0x2087, - "No loop_id's available, portid=%x.\n", - dev->d_id.b24); - - return (rval); -} - - /* FW does not set aside Loop id for MGMT Server/FFFFFAh */ int qla2x00_reserve_mgmt_server_loop_id(scsi_qla_host_t *vha)