From patchwork Thu Apr 4 19:44:38 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: 10886153 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 BCA821575 for ; Thu, 4 Apr 2019 19:45:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9AC8285C7 for ; Thu, 4 Apr 2019 19:45:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B13628675; Thu, 4 Apr 2019 19:45:00 +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 8048B285C7 for ; Thu, 4 Apr 2019 19:44:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730317AbfDDTo7 (ORCPT ); Thu, 4 Apr 2019 15:44:59 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:34503 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729714AbfDDTo6 (ORCPT ); Thu, 4 Apr 2019 15:44:58 -0400 Received: by mail-pg1-f194.google.com with SMTP id v12so1740862pgq.1 for ; Thu, 04 Apr 2019 12:44:58 -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=Y/1AeuECoO+GbTZnDpAL+Qk+ZYtg3CdeE4uKQucxOLg=; b=UK++EiF+mfsLvFEDDmlAcKxLEUvYTvChZH8SN/Q8ovndWjO3zrZ8Y4tTTEhTouKUHG G8Z0DrWW2LU+q5f9J21zRCaGKsYtV2jnIXXfQWtNfWhOKh/K1kpeT942vpbbtya1XMtG VxHuf6ZLHfshjDXuZYGnWu1e/tlosUV6otWyRYjhTrwkLZOhvg8fEeb7TdKhKh5k2xcd 6a7r4spFRFlciRoDD4fHYDIvETr9UtN5veSrUBEy7TSIOEOeUkT6G2BWEhWQ9BtD6l9n ZjPP+DSMtL476J0QssElE0rdF7joxiaWaQCmS/pNT4QBAtP6bqgIqXL14+EHJRuA3GWY 5/HA== X-Gm-Message-State: APjAAAUkchgwnlB7/x3LHipmzr94KPPCzbdFY32lglIXoGvXo8ZTEgM8 c9G5LuLJ1f3hokGzQmcYLzQ= X-Google-Smtp-Source: APXvYqw7Aufn3tgibJSgKwNRINoscxd9xjk64bIwJ7KS+sLRwIp34YPtGKyRLy6qZavExhnG/qrLsw== X-Received: by 2002:a65:5202:: with SMTP id o2mr7346228pgp.402.1554407097786; Thu, 04 Apr 2019 12:44:57 -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 g4sm29404285pfo.38.2019.04.04.12.44.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 12:44:57 -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 , James Smart , Hannes Reinecke , Johannes Thumshirn , Steffen Maier Subject: [PATCH 01/11] Declare wwn_to_u64() argument const Date: Thu, 4 Apr 2019 12:44:38 -0700 Message-Id: <20190404194448.121489-2-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT In-Reply-To: <20190404194448.121489-1-bvanassche@acm.org> References: <20190404194448.121489-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 the wwn_to_u64() function does not change its input, make its argument const. Cc: James Smart Cc: Hannes Reinecke Cc: Johannes Thumshirn Cc: Steffen Maier Signed-off-by: Bart Van Assche Reviewed-by: Johannes Thumshirn --- include/scsi/scsi_transport_fc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 15da45dc2a5d..ad5215aaad80 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -755,7 +755,7 @@ fc_remote_port_chkready(struct fc_rport *rport) return result; } -static inline u64 wwn_to_u64(u8 *wwn) +static inline u64 wwn_to_u64(const u8 *wwn) { return get_unaligned_be64(wwn); } From patchwork Thu Apr 4 19:44:39 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: 10886161 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 089B018E8 for ; Thu, 4 Apr 2019 19:45:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC08E285C7 for ; Thu, 4 Apr 2019 19:45:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E035028684; Thu, 4 Apr 2019 19:45:04 +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 E2A2D285C7 for ; Thu, 4 Apr 2019 19:45:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730380AbfDDTpC (ORCPT ); Thu, 4 Apr 2019 15:45:02 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:46376 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729714AbfDDTo7 (ORCPT ); Thu, 4 Apr 2019 15:44:59 -0400 Received: by mail-pf1-f193.google.com with SMTP id 9so1852188pfj.13 for ; Thu, 04 Apr 2019 12: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=snOtwTqx9ijqKGK9LVtqRBG2NZWgKNSoP0Xpeb9Z3yk=; b=mDIF97CdjrwMt5pFh3ANX45oCM9xD3tdqvUfph271OPn6bq4kfEW/G15eLZrD1iC9Z w68iz1afOegE3ZKahzvLyLygedol79jEZoJodOrBBVmBRHildrsq3aupAEiksPY4jtwi sg20OVLLAwg9uw2mnF+8e/yoe7CD7ABaDPO9TMXBbDYmcymcmkN51bKKUxKqGyHeUfII JPzmtLMC4gaB5C9w8Ja2PBSGmjLHCUgmX+vMiBgXuTjI1+m1xhdbq70NX4jWPweysc7m yma+UJrFNpxg7JE+f8jZj2Y194eaz54UsBjCrtEJOOoBK617EWsTr3xrjoum9cLD8jmE p/tA== X-Gm-Message-State: APjAAAU7bxX8/cpPV4krUUfjE1zrFJoeiOXZFmZkja+YZQK98iTOwhe9 n+KEb4kgmoaidEPN5DL+A2k= X-Google-Smtp-Source: APXvYqx4fJkyZoNpBXeJ+LdwVoC5ewJcCr5AyXrRcc/nA5LiSMtls0eiLYLpKF+dM0qp4//NaKlu6g== X-Received: by 2002:a63:2b4c:: with SMTP id r73mr7864599pgr.181.1554407098956; Thu, 04 Apr 2019 12:44:58 -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 g4sm29404285pfo.38.2019.04.04.12.44.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 12: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 02/11] qla2xxx: Change a stack variable into a static const variable Date: Thu, 4 Apr 2019 12:44:39 -0700 Message-Id: <20190404194448.121489-3-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT In-Reply-To: <20190404194448.121489-1-bvanassche@acm.org> References: <20190404194448.121489-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 Make qla2x00_get_host_fabric_name() slightly faster by changing a stack array into a static array. Declare that array const now that the wwn_to_u64() argument pointer has been declared const. Cc: Himanshu Madhani Cc: Giridhar Malavali Signed-off-by: Bart Van Assche Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_attr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index da64fe54f59e..b8706ed3ae1d 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -2723,8 +2723,9 @@ static void qla2x00_get_host_fabric_name(struct Scsi_Host *shost) { scsi_qla_host_t *vha = shost_priv(shost); - uint8_t node_name[WWN_SIZE] = { 0xFF, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0xFF, 0xFF, 0xFF}; + static const uint8_t node_name[WWN_SIZE] = { + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF + }; u64 fabric_name = wwn_to_u64(node_name); if (vha->device_flags & SWITCH_FOUND) From patchwork Thu Apr 4 19:44:40 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: 10886157 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 5E9BD17E1 for ; Thu, 4 Apr 2019 19:45:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D69228675 for ; Thu, 4 Apr 2019 19:45:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4184328688; Thu, 4 Apr 2019 19:45:04 +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 3604C286AC for ; Thu, 4 Apr 2019 19:45:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730382AbfDDTpC (ORCPT ); Thu, 4 Apr 2019 15:45:02 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:44909 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730322AbfDDTpA (ORCPT ); Thu, 4 Apr 2019 15:45:00 -0400 Received: by mail-pf1-f193.google.com with SMTP id y13so1854880pfm.11 for ; Thu, 04 Apr 2019 12:45:00 -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=cU3+CuoVdB/q7t7ud1QG91OtHeHGLVZ8QQyKe9bPVAU=; b=DOCuTNZDQaOqAoB4LQA5HCblZP6ObM9DG/BQdwafrq8TktW85RLFrtcwi9MI6xQBna xmOAaeITGtoYOTVkp7R0F7Rs9a31GtCY20jCSrZrFbz4G2LUKO9QDiK6JQcSqOmBghOA XWZC8qpKZD6XfkoS4vUjmnPJxgy1t5olwJwC21tWFFAS7BtReqNzFHdjrI2hVFa9BmvI rqNdQY6HYF2OjYNsLLVMhz59u5n3VX/Ot1DCD6W6LN/adp3LpvYMSdTGYxu1qQwjYnW7 NtFUYpKFlub86RtShCCg+OPhe/4DN93dYnhNZOWku5By3sxZvZliaG+duCv3WbZRRvMv iEzQ== X-Gm-Message-State: APjAAAUWGDMib6WcvKXmavCODSDdmjx4ZQjMJzWZYx43LgAuyyn3mYGO MYRJl0hLwYaEHA7xfxQ3Dm5lrsswDhU= X-Google-Smtp-Source: APXvYqw7VD2Pnmn1XWYbuhu6MyihRBcRIBOFzGEglSXZwu30jNZL0gs1va+/5T70jViHE4PmImcwdQ== X-Received: by 2002:a63:e818:: with SMTP id s24mr7714768pgh.190.1554407100146; Thu, 04 Apr 2019 12:45:00 -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 g4sm29404285pfo.38.2019.04.04.12.44.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 12:44:59 -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 03/11] qla2xxx: Remove a comment that refers to the SCSI host lock Date: Thu, 4 Apr 2019 12:44:40 -0700 Message-Id: <20190404194448.121489-4-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT In-Reply-To: <20190404194448.121489-1-bvanassche@acm.org> References: <20190404194448.121489-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 qla2xxx_queuecommand() no longer takes the SCSI host lock, remove a comment that refers to the host lock. Cc: Himanshu Madhani Cc: Giridhar Malavali Signed-off-by: Bart Van Assche Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_os.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 57e1041e4ca2..dddfadc27b75 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -889,9 +889,6 @@ qla2xxx_qpair_sp_compl(void *ptr, int res) qla2xxx_rel_qpair_sp(sp->qpair, sp); } -/* If we are SP1 here, we need to still take and release the host_lock as SP1 - * does not have the changes necessary to avoid taking host->host_lock. - */ static int qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd) { From patchwork Thu Apr 4 19:44:41 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: 10886155 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 41FDD17E1 for ; Thu, 4 Apr 2019 19:45:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E567285C7 for ; Thu, 4 Apr 2019 19:45:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F86828675; Thu, 4 Apr 2019 19:45:03 +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 B4E61285C7 for ; Thu, 4 Apr 2019 19:45:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730374AbfDDTpC (ORCPT ); Thu, 4 Apr 2019 15:45:02 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:35199 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730362AbfDDTpC (ORCPT ); Thu, 4 Apr 2019 15:45:02 -0400 Received: by mail-pg1-f193.google.com with SMTP id g8so1738163pgf.2 for ; Thu, 04 Apr 2019 12:45:01 -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=Wq3KKsIjRgwRgJmp5uRXpWwNAeWiFfNcnEnpJqPsqLo=; b=UX5Ms6stW1vI3p+36+6i9vkUnkZiSqMBuof9G0NU+UGLPKxD0QMJ7MHyysTqsO8Tlb F3KrdQo1njevwAHNM0EiJljZreRH6//4lQ1g2Li+eYyAgWp9k1LwEKlJz3ywJw7Wh6Bq zbCQZY6P+nhqluMLzl1ZaR4OekEuTNzFneY+Shchz7qS1YJycveW/F7lVj1yPjeE7ICF C7mO/pnLapsspzGhlnIJVNzcctDHeViIgWn7RpNTXkjxA3XxZymKWMIoiMdhHSwFfJG6 8xX8uNiezwqlZAHHcqodNPrldeKiRG8SwpivnBAQpjMi+V2bfqbK070LbA3YjUywE/r8 suHg== X-Gm-Message-State: APjAAAWUAa6WpdxaOSAa6eG59blXXRpZyxl/zdlG1S/ZEzhS3cw1qiFD 8zjZZNoBmDDrPXHokG4KPyM= X-Google-Smtp-Source: APXvYqxp9y5enxvZvVancBvcBdGblW0AvI5VHKdWw48BRVu3KajGvOOxEyzotbs7pbnlkFi0dRZc2g== X-Received: by 2002:a65:50cc:: with SMTP id s12mr7323785pgp.130.1554407101297; Thu, 04 Apr 2019 12:45:01 -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 g4sm29404285pfo.38.2019.04.04.12.45.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 12:45:00 -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/11] qla2xxx: Use ARRAY_SIZE() in the definition of QLA_LAST_SPEED Date: Thu, 4 Apr 2019 12:44:41 -0700 Message-Id: <20190404194448.121489-5-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT In-Reply-To: <20190404194448.121489-1-bvanassche@acm.org> References: <20190404194448.121489-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 Make the code easier to read by avoiding to use a hard-coded constant. This patch does not change any functionality. Cc: Himanshu Madhani Cc: Giridhar Malavali Signed-off-by: Bart Van Assche Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_isr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 20f0761b8b87..055d313a0461 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -366,7 +366,7 @@ qla2x00_get_link_speed_str(struct qla_hw_data *ha, uint16_t speed) static const char *const link_speeds[] = { "1", "2", "?", "4", "8", "16", "32", "10" }; -#define QLA_LAST_SPEED 7 +#define QLA_LAST_SPEED (ARRAY_SIZE(link_speeds) - 1) if (IS_QLA2100(ha) || IS_QLA2200(ha)) return link_speeds[0]; From patchwork Thu Apr 4 19:44:42 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: 10886159 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 98F1415AC for ; Thu, 4 Apr 2019 19:45:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87049285E1 for ; Thu, 4 Apr 2019 19:45:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AC7828AB6; Thu, 4 Apr 2019 19:45:04 +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 2D77B285E1 for ; Thu, 4 Apr 2019 19:45:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730392AbfDDTpD (ORCPT ); Thu, 4 Apr 2019 15:45:03 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:40670 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730322AbfDDTpD (ORCPT ); Thu, 4 Apr 2019 15:45:03 -0400 Received: by mail-pg1-f196.google.com with SMTP id u9so1722584pgo.7 for ; Thu, 04 Apr 2019 12:45:03 -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=qrTlDmiz/VY1NHpyhxIbFfKkMvpRgA9SNLxt+io+Vqk=; b=tV1/16IhiGT0ufWPlPoPfjIGNmdeiMxeUC1UKWLXypsnlBcBH4xpqe5Y2GRIBQI5sA QfoVqg+IGJ8xx1u+0W1wid7tjxqXGM49/vp4iQDjHLR+36VwSYA82xaO7oBh2Ew6JfO3 KlcovI6XCRPTSEFsXrV/9lA33+fN25UVSSSj1YKMlPDBqLA+mOAafu5n3hmsPiwCdb9w isE/AhhoJJBw/sJ129qym28eZSvbCgx9OFwjQ9bmj1VpbgYjq8HO4fdXi03ii1Yl8nWC CdGV6bjdXAuDxtwOq/JMlhcInfSYNb7lltJ5iH2SoutgENhHrcmJjqUCBXN+iRV+y+Ry jCCw== X-Gm-Message-State: APjAAAVpRXLR+LAIpuyLwjK5Bnv2aJWSCirnOKDrQiv8oFl+XC3DA/Mh /hXK666+rJoNYpa3f2EawDA= X-Google-Smtp-Source: APXvYqxRMNovUFkCNwhq9QZcm/YMq2qK0AoRBbCdXwq+i9Mwy8Ryth9xiSkDWjLkv2dsTk+qyzedQw== X-Received: by 2002:a63:6fcd:: with SMTP id k196mr7677812pgc.238.1554407102598; Thu, 04 Apr 2019 12:45:02 -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 g4sm29404285pfo.38.2019.04.04.12.45.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 12:45:01 -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 05/11] qla2xxx: Declare local symbols static Date: Thu, 4 Apr 2019 12:44:42 -0700 Message-Id: <20190404194448.121489-6-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT In-Reply-To: <20190404194448.121489-1-bvanassche@acm.org> References: <20190404194448.121489-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 This patch avoids that sparse complains that a declaration is missing. Cc: Himanshu Madhani Cc: Giridhar Malavali Signed-off-by: Bart Van Assche Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_os.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index dddfadc27b75..efb4b91ca768 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -285,14 +285,14 @@ MODULE_PARM_DESC(qla2xuseresexchforels, "Reserve 1/2 of emergency exchanges for ELS.\n" " 0 (default): disabled"); -int ql2xprotmask; +static int ql2xprotmask; module_param(ql2xprotmask, int, 0644); MODULE_PARM_DESC(ql2xprotmask, "Override DIF/DIX protection capabilities mask\n" "Default is 0 which sets protection mask based on " "capabilities reported by HBA firmware.\n"); -int ql2xprotguard; +static int ql2xprotguard; module_param(ql2xprotguard, int, 0644); MODULE_PARM_DESC(ql2xprotguard, "Override choice of DIX checksum\n" " 0 -- Let HBA firmware decide\n" From patchwork Thu Apr 4 19:44:43 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: 10886163 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 9CB1D15AC for ; Thu, 4 Apr 2019 19:45:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A2F6285C7 for ; Thu, 4 Apr 2019 19:45:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E48528684; Thu, 4 Apr 2019 19:45:06 +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 13152285C7 for ; Thu, 4 Apr 2019 19:45:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730403AbfDDTpF (ORCPT ); Thu, 4 Apr 2019 15:45:05 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:37626 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730322AbfDDTpE (ORCPT ); Thu, 4 Apr 2019 15:45:04 -0400 Received: by mail-pl1-f193.google.com with SMTP id w23so1664983ply.4 for ; Thu, 04 Apr 2019 12:45:04 -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=efJTIWL2khdWxY/fnf/OCIGOyWg+GL4Gzx36L0zXyMI=; b=OD4XWpyLHefI7HjszGkXQvSQCqCqBxTYgUozBHu41Ozhatebaw4WAHS8h6F+4VD/CA fszh/gBNTuwN/a1W47UBpXySHRr+Y4jJUOi2jUtkpzRDmQuPhNYPqv5ILjP0dJ0bqTz6 aaswuxrzPG2idqm0/7f03wu/PIpf1n8WyjcSKtLTOtJXe1WUR7iOYlny04EhPiSYiJ2u 4cBK3pgG0rg6LtFwcUgDzCXKcJqo6HXC0Nx47Jw2iiH3Kscv+8ijlbS5MO9miVWnYkWn lIV28HTVd2GN4WtKvUJVEMUxNZ7ndJIhJzvdnZp2swH77jprdHaiV9Tl98OK9+wc79pY nywQ== X-Gm-Message-State: APjAAAVWGsORrZ8g3mQu6lk2LKskkQF/xiypXxGJUn9bzbOrwDWNu2iL bu4xctEMAoF/sGBiXIXz5Ec= X-Google-Smtp-Source: APXvYqxXt9NHgV2aDNreg14t+XNkLUL6PFlInmQ3TMZuR9fSlfnxH2xBHLVOiSwXcCL6RxuNcU1d4w== X-Received: by 2002:a17:902:b28b:: with SMTP id u11mr8171420plr.257.1554407103878; Thu, 04 Apr 2019 12:45:03 -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 g4sm29404285pfo.38.2019.04.04.12.45.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 12:45:02 -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 06/11] qla2xxx: Reduce the number of forward declarations Date: Thu, 4 Apr 2019 12:44:43 -0700 Message-Id: <20190404194448.121489-7-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT In-Reply-To: <20190404194448.121489-1-bvanassche@acm.org> References: <20190404194448.121489-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 Move the SCSI host template definition after the definition of the functions that it references. Remove the forward declarations that became unnecessary by that change. This patch does not change any functionality. Cc: Himanshu Madhani Cc: Giridhar Malavali Signed-off-by: Bart Van Assche Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_os.c | 77 ++++++++++++++--------------------- 1 file changed, 31 insertions(+), 46 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index efb4b91ca768..137c7165d21d 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -306,58 +306,12 @@ MODULE_PARM_DESC(ql2xdifbundlinginternalbuffers, "0 (Default). Based on check.\n" "1 Force using internal buffers\n"); -/* - * SCSI host template entry points - */ -static int qla2xxx_slave_configure(struct scsi_device * device); -static int qla2xxx_slave_alloc(struct scsi_device *); -static int qla2xxx_scan_finished(struct Scsi_Host *, unsigned long time); -static void qla2xxx_scan_start(struct Scsi_Host *); -static void qla2xxx_slave_destroy(struct scsi_device *); -static int qla2xxx_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *cmd); -static int qla2xxx_eh_abort(struct scsi_cmnd *); -static int qla2xxx_eh_device_reset(struct scsi_cmnd *); -static int qla2xxx_eh_target_reset(struct scsi_cmnd *); -static int qla2xxx_eh_bus_reset(struct scsi_cmnd *); -static int qla2xxx_eh_host_reset(struct scsi_cmnd *); - static void qla2x00_clear_drv_active(struct qla_hw_data *); static void qla2x00_free_device(scsi_qla_host_t *); static int qla2xxx_map_queues(struct Scsi_Host *shost); static void qla2x00_destroy_deferred_work(struct qla_hw_data *); -struct scsi_host_template qla2xxx_driver_template = { - .module = THIS_MODULE, - .name = QLA2XXX_DRIVER_NAME, - .queuecommand = qla2xxx_queuecommand, - - .eh_timed_out = fc_eh_timed_out, - .eh_abort_handler = qla2xxx_eh_abort, - .eh_device_reset_handler = qla2xxx_eh_device_reset, - .eh_target_reset_handler = qla2xxx_eh_target_reset, - .eh_bus_reset_handler = qla2xxx_eh_bus_reset, - .eh_host_reset_handler = qla2xxx_eh_host_reset, - - .slave_configure = qla2xxx_slave_configure, - - .slave_alloc = qla2xxx_slave_alloc, - .slave_destroy = qla2xxx_slave_destroy, - .scan_finished = qla2xxx_scan_finished, - .scan_start = qla2xxx_scan_start, - .change_queue_depth = scsi_change_queue_depth, - .map_queues = qla2xxx_map_queues, - .this_id = -1, - .cmd_per_lun = 3, - .sg_tablesize = SG_ALL, - - .max_sectors = 0xFFFF, - .shost_attrs = qla2x00_host_attrs, - - .supported_mode = MODE_INITIATOR, - .track_queue_depth = 1, -}; - static struct scsi_transport_template *qla2xxx_transport_template = NULL; struct scsi_transport_template *qla2xxx_transport_vport_template = NULL; @@ -7266,6 +7220,37 @@ static int qla2xxx_map_queues(struct Scsi_Host *shost) return rc; } +struct scsi_host_template qla2xxx_driver_template = { + .module = THIS_MODULE, + .name = QLA2XXX_DRIVER_NAME, + .queuecommand = qla2xxx_queuecommand, + + .eh_timed_out = fc_eh_timed_out, + .eh_abort_handler = qla2xxx_eh_abort, + .eh_device_reset_handler = qla2xxx_eh_device_reset, + .eh_target_reset_handler = qla2xxx_eh_target_reset, + .eh_bus_reset_handler = qla2xxx_eh_bus_reset, + .eh_host_reset_handler = qla2xxx_eh_host_reset, + + .slave_configure = qla2xxx_slave_configure, + + .slave_alloc = qla2xxx_slave_alloc, + .slave_destroy = qla2xxx_slave_destroy, + .scan_finished = qla2xxx_scan_finished, + .scan_start = qla2xxx_scan_start, + .change_queue_depth = scsi_change_queue_depth, + .map_queues = qla2xxx_map_queues, + .this_id = -1, + .cmd_per_lun = 3, + .sg_tablesize = SG_ALL, + + .max_sectors = 0xFFFF, + .shost_attrs = qla2x00_host_attrs, + + .supported_mode = MODE_INITIATOR, + .track_queue_depth = 1, +}; + static const struct pci_error_handlers qla2xxx_err_handler = { .error_detected = qla2xxx_pci_error_detected, .mmio_enabled = qla2xxx_pci_mmio_enabled, From patchwork Thu Apr 4 19:44:44 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: 10886165 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 308B41800 for ; Thu, 4 Apr 2019 19:45:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E488285C7 for ; Thu, 4 Apr 2019 19:45:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 125E5285E1; Thu, 4 Apr 2019 19:45:07 +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 9C88C28774 for ; Thu, 4 Apr 2019 19:45:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730370AbfDDTpG (ORCPT ); Thu, 4 Apr 2019 15:45:06 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:44130 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730400AbfDDTpF (ORCPT ); Thu, 4 Apr 2019 15:45:05 -0400 Received: by mail-pl1-f195.google.com with SMTP id g12so1651255pll.11 for ; Thu, 04 Apr 2019 12:45:05 -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=TfFPMI0m8tVeFTcDDb2B27qTBcwWI3pdwXU6miStyBw=; b=kLs/+rjqt2eSb4vTeHVv0ZlbqkDSaXEklnbm58rdFw7T3wy0Byn0R3DVc44bQ02rHK 7RTGFY19Bo3uhEPTQk9i4kLObRvT2/E1stYnvUznY/gPn96zdMEQFSZFOOxV8sD9rQn/ o4YeULcWkKCZSz1R3vH1BFAr3EuLOuDQdN2aW0yyOBDNHd4kZJszYHmKS+GrdLhketkv m7LHyUBNpHl6kGQjwqLVqq3swDLf1GNpuR4zSbYYuPhnYOJ0Hbyz6Vr+A7V5KyZbtdf+ Kl3X0IzFBCthz0gTLeyWCBtyyjuj8CSKmFF2YVrjxVi2pVIStMNONofaVgKTKnDyQBTO pSGw== X-Gm-Message-State: APjAAAUh4rTFRP74WJEgJgx9Z+4BMsY+5gEEfhWFDJBXxuNMMuRVPNLg LS0gnYpU4W1p/mnDddRk0VI= X-Google-Smtp-Source: APXvYqwY+kXzksDeyWng1D61C3z4IFwBxtLmstv+t9ogPjLQMPlRJyYebEZIVFLKlGbVFBKQ8vdygg== X-Received: by 2002:a17:902:bb05:: with SMTP id l5mr8468384pls.311.1554407105011; Thu, 04 Apr 2019 12:45:05 -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 g4sm29404285pfo.38.2019.04.04.12.45.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 12:45:04 -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 07/11] qla2xxx: Make qla2x00_process_response_queue() easier to read Date: Thu, 4 Apr 2019 12:44:44 -0700 Message-Id: <20190404194448.121489-8-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT In-Reply-To: <20190404194448.121489-1-bvanassche@acm.org> References: <20190404194448.121489-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 Make qla2x00_process_response_queue() easier to read by splitting this function. This patch does not change any functionality. Cc: Himanshu Madhani Cc: Giridhar Malavali Signed-off-by: Bart Van Assche Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_isr.c | 85 +++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 38 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index 055d313a0461..aed1fc352efd 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -1972,6 +1972,52 @@ static void qla_ctrlvp_completed(scsi_qla_host_t *vha, struct req_que *req, sp->done(sp, rval); } +/* Process a single response queue entry. */ +static void qla2x00_process_response_entry(struct scsi_qla_host *vha, + struct rsp_que *rsp, + sts_entry_t *pkt) +{ + sts21_entry_t *sts21_entry; + sts22_entry_t *sts22_entry; + uint16_t handle_cnt; + uint16_t cnt; + + switch (pkt->entry_type) { + case STATUS_TYPE: + qla2x00_status_entry(vha, rsp, pkt); + break; + case STATUS_TYPE_21: + sts21_entry = (sts21_entry_t *)pkt; + handle_cnt = sts21_entry->handle_count; + for (cnt = 0; cnt < handle_cnt; cnt++) + qla2x00_process_completed_request(vha, rsp->req, + sts21_entry->handle[cnt]); + break; + case STATUS_TYPE_22: + sts22_entry = (sts22_entry_t *)pkt; + handle_cnt = sts22_entry->handle_count; + for (cnt = 0; cnt < handle_cnt; cnt++) + qla2x00_process_completed_request(vha, rsp->req, + sts22_entry->handle[cnt]); + break; + case STATUS_CONT_TYPE: + qla2x00_status_cont_entry(rsp, (sts_cont_entry_t *)pkt); + break; + case MBX_IOCB_TYPE: + qla2x00_mbx_iocb_entry(vha, rsp->req, (struct mbx_entry *)pkt); + break; + case CT_IOCB_TYPE: + qla2x00_ct_entry(vha, rsp->req, pkt, CT_IOCB_TYPE); + break; + default: + /* Type Not Supported. */ + ql_log(ql_log_warn, vha, 0x504a, + "Received unknown response pkt type %x entry status=%x.\n", + pkt->entry_type, pkt->entry_status); + break; + } +} + /** * qla2x00_process_response_queue() - Process response queue entries. * @rsp: response queue @@ -1983,8 +2029,6 @@ qla2x00_process_response_queue(struct rsp_que *rsp) struct qla_hw_data *ha = rsp->hw; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; sts_entry_t *pkt; - uint16_t handle_cnt; - uint16_t cnt; vha = pci_get_drvdata(ha->pdev); @@ -2009,42 +2053,7 @@ qla2x00_process_response_queue(struct rsp_que *rsp) continue; } - switch (pkt->entry_type) { - case STATUS_TYPE: - qla2x00_status_entry(vha, rsp, pkt); - break; - case STATUS_TYPE_21: - handle_cnt = ((sts21_entry_t *)pkt)->handle_count; - for (cnt = 0; cnt < handle_cnt; cnt++) { - qla2x00_process_completed_request(vha, rsp->req, - ((sts21_entry_t *)pkt)->handle[cnt]); - } - break; - case STATUS_TYPE_22: - handle_cnt = ((sts22_entry_t *)pkt)->handle_count; - for (cnt = 0; cnt < handle_cnt; cnt++) { - qla2x00_process_completed_request(vha, rsp->req, - ((sts22_entry_t *)pkt)->handle[cnt]); - } - break; - case STATUS_CONT_TYPE: - qla2x00_status_cont_entry(rsp, (sts_cont_entry_t *)pkt); - break; - case MBX_IOCB_TYPE: - qla2x00_mbx_iocb_entry(vha, rsp->req, - (struct mbx_entry *)pkt); - break; - case CT_IOCB_TYPE: - qla2x00_ct_entry(vha, rsp->req, pkt, CT_IOCB_TYPE); - break; - default: - /* Type Not Supported. */ - ql_log(ql_log_warn, vha, 0x504a, - "Received unknown response pkt type %x " - "entry status=%x.\n", - pkt->entry_type, pkt->entry_status); - break; - } + qla2x00_process_response_entry(vha, rsp, pkt); ((response_t *)pkt)->signature = RESPONSE_PROCESSED; wmb(); } From patchwork Thu Apr 4 19:44:45 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: 10886167 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 A54CE17E1 for ; Thu, 4 Apr 2019 19:45:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93EED285C7 for ; Thu, 4 Apr 2019 19:45:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8820D28684; Thu, 4 Apr 2019 19:45:08 +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 0F3CA285C7 for ; Thu, 4 Apr 2019 19:45:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730405AbfDDTpH (ORCPT ); Thu, 4 Apr 2019 15:45:07 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:40952 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730400AbfDDTpH (ORCPT ); Thu, 4 Apr 2019 15:45:07 -0400 Received: by mail-pl1-f196.google.com with SMTP id b3so1655260plr.7 for ; Thu, 04 Apr 2019 12:45:06 -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=tf70nZHhh+Eg9z9E6O00dd4TmIigXqJCOwvLYj6ha/4=; b=KGsN5L+OR3ujcqt5whu7hSaNiupG8eLDYwp9cyWUt+ZRg3goohbjoa3Zool4eVBiTe P5GhA8lMIIJXPq3z8+irdG+wO6lxY36dw4PrWSP42A1Yk6EL8FPTo7SRCGju0XfrVlLX Qg+924mqf2n7quXCrOe8twyre/+/FnDfnWuLNZsM3f6yAMlWK+VwkuMYj4qdtGgdfR7A 2BmjZD5qpWMuOd7EUoevSRn/HXlTX6ZmVapsslcrdYs70V0xgIwLGiiABFajSxqZM+W6 dm4IgwKdFKUVykVOmZEulx2hdquKEqG1hybhxFVFolmf0YLd+RI61hGEWFLkQEJ3NCeM IG8A== X-Gm-Message-State: APjAAAUUnO/PQ/z8eEBd28akLoqn7XRURoRI90hvofP7NZX0F/vqD8vb +CrPmgdEsY5Zndp0a4jdEG0= X-Google-Smtp-Source: APXvYqy5Xxp8xtef+rlvipjFlKBSnyMenfRgANUsi4ky4LbVYvupCLwQbQ2hNhgefthQfGJ4EVEo5w== X-Received: by 2002:a17:902:2848:: with SMTP id e66mr8270789plb.181.1554407106230; Thu, 04 Apr 2019 12:45:06 -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 g4sm29404285pfo.38.2019.04.04.12.45.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 12:45:05 -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 08/11] qla2xxx: Use get/put_unaligned where appropriate Date: Thu, 4 Apr 2019 12:44:45 -0700 Message-Id: <20190404194448.121489-9-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT In-Reply-To: <20190404194448.121489-1-bvanassche@acm.org> References: <20190404194448.121489-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 This patch makes the code easier to read but does not change any functionality. Cc: Himanshu Madhani Cc: Giridhar Malavali Signed-off-by: Bart Van Assche --- drivers/scsi/qla2xxx/qla_bsg.c | 2 +- drivers/scsi/qla2xxx/qla_iocb.c | 21 +++++++++------------ drivers/scsi/qla2xxx/qla_nvme.c | 4 ++-- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c index d1456a03661b..471d04a49a15 100644 --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c @@ -1043,7 +1043,7 @@ qla84xx_updatefw(struct bsg_job *bsg_job) } flag = bsg_request->rqst_data.h_vendor.vendor_cmd[1]; - fw_ver = le32_to_cpu(*((uint32_t *)((uint32_t *)fw_buf + 2))); + fw_ver = get_unaligned_le32((uint32_t *)fw_buf + 2); mn->entry_type = VERIFY_CHIP_IOCB_TYPE; mn->entry_count = 1; diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 8d139f1d53e5..56278da41331 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -107,7 +107,7 @@ qla2x00_prep_cont_type0_iocb(struct scsi_qla_host *vha) cont_pkt = (cont_entry_t *)req->ring_ptr; /* Load packet defaults. */ - *((uint32_t *)(&cont_pkt->entry_type)) = cpu_to_le32(CONTINUE_TYPE); + put_unaligned_le32(CONTINUE_TYPE, &cont_pkt->entry_type); return (cont_pkt); } @@ -136,9 +136,8 @@ qla2x00_prep_cont_type1_iocb(scsi_qla_host_t *vha, struct req_que *req) cont_pkt = (cont_a64_entry_t *)req->ring_ptr; /* Load packet defaults. */ - *((uint32_t *)(&cont_pkt->entry_type)) = IS_QLAFX00(vha->hw) ? - cpu_to_le32(CONTINUE_A64_TYPE_FX00) : - cpu_to_le32(CONTINUE_A64_TYPE); + put_unaligned_le32(IS_QLAFX00(vha->hw) ? CONTINUE_A64_TYPE_FX00 : + CONTINUE_A64_TYPE, &cont_pkt->entry_type); return (cont_pkt); } @@ -202,8 +201,7 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt, cmd = GET_CMD_SP(sp); /* Update entry type to indicate Command Type 2 IOCB */ - *((uint32_t *)(&cmd_pkt->entry_type)) = - cpu_to_le32(COMMAND_TYPE); + put_unaligned_le32(COMMAND_TYPE, &cmd_pkt->entry_type); /* No data transfer */ if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) { @@ -260,7 +258,7 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt, cmd = GET_CMD_SP(sp); /* Update entry type to indicate Command Type 3 IOCB */ - *((uint32_t *)(&cmd_pkt->entry_type)) = cpu_to_le32(COMMAND_A64_TYPE); + put_unaligned_le32(COMMAND_A64_TYPE, &cmd_pkt->entry_type); /* No data transfer */ if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) { @@ -596,7 +594,7 @@ qla24xx_build_scsi_type_6_iocbs(srb_t *sp, struct cmd_type_6 *cmd_pkt, cmd = GET_CMD_SP(sp); /* Update entry type to indicate Command Type 3 IOCB */ - *((uint32_t *)(&cmd_pkt->entry_type)) = cpu_to_le32(COMMAND_TYPE_6); + put_unaligned_le32(COMMAND_TYPE_6, &cmd_pkt->entry_type); /* No data transfer */ if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) { @@ -711,7 +709,7 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt, cmd = GET_CMD_SP(sp); /* Update entry type to indicate Command Type 3 IOCB */ - *((uint32_t *)(&cmd_pkt->entry_type)) = cpu_to_le32(COMMAND_TYPE_7); + put_unaligned_le32(COMMAND_TYPE_7, &cmd_pkt->entry_type); /* No data transfer */ if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) { @@ -1427,7 +1425,7 @@ qla24xx_build_scsi_crc_2_iocbs(srb_t *sp, struct cmd_type_crc_2 *cmd_pkt, cmd = GET_CMD_SP(sp); /* Update entry type to indicate Command Type CRC_2 IOCB */ - *((uint32_t *)(&cmd_pkt->entry_type)) = cpu_to_le32(COMMAND_TYPE_CRC_2); + put_unaligned_le32(COMMAND_TYPE_CRC_2, &cmd_pkt->entry_type); vha = sp->vha; ha = vha->hw; @@ -3747,8 +3745,7 @@ qla25xx_build_bidir_iocb(srb_t *sp, struct scsi_qla_host *vha, struct bsg_job *bsg_job = sp->u.bsg_job; /*Update entry type to indicate bidir command */ - *((uint32_t *)(&cmd_pkt->entry_type)) = - cpu_to_le32(COMMAND_BIDIRECTIONAL); + put_unaligned_le32(COMMAND_BIDIRECTIONAL, &cmd_pkt->entry_type); /* Set the transfer direction, in this set both flags * Also set the BD_WRAP_BACK flag, firmware will take care diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c index 1ca63e80a7fe..f20fc7b89ff5 100644 --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -449,8 +449,8 @@ static inline int qla2x00_start_nvme_mq(srb_t *sp) req->ring_ptr++; } cont_pkt = (cont_a64_entry_t *)req->ring_ptr; - *((uint32_t *)(&cont_pkt->entry_type)) = - cpu_to_le32(CONTINUE_A64_TYPE); + put_unaligned_le32(CONTINUE_A64_TYPE, + &cont_pkt->entry_type); cur_dsd = (uint32_t *)cont_pkt->dseg_0_address; avail_dsds = 5; From patchwork Thu Apr 4 19:44:46 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: 10886169 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 D8CF517E1 for ; Thu, 4 Apr 2019 19:45:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7776285C7 for ; Thu, 4 Apr 2019 19:45:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBCFC28684; Thu, 4 Apr 2019 19:45:09 +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 59C6A285C7 for ; Thu, 4 Apr 2019 19:45:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730424AbfDDTpI (ORCPT ); Thu, 4 Apr 2019 15:45:08 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:45226 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730400AbfDDTpI (ORCPT ); Thu, 4 Apr 2019 15:45:08 -0400 Received: by mail-pg1-f195.google.com with SMTP id y3so1715737pgk.12 for ; Thu, 04 Apr 2019 12:45:08 -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=75iJS68PhfHL0XJd2o163sb7sftPFOMYuwqhSFD4YD8=; b=tBMm2Th9fG0I8HkXJSDu1htmu8UwCByNHgUpCtF9Sd9h7h+ZYidNFdTHeEN7JW30Yi 9lEiDYweR2QpG737R3rfMHdKkrvXls3fK0VojZivl3GbEysWEO0112vXu1vwiljLpP4y 3nupWJnCHoYXGKpEPZ2pEkbX1Ae2qDbzp7SgOPHlyQe8wPRTpYliiZE1HAAEFJ5coxP+ sA5sUFw+RmP5y0FSwUlZQvl8ksebIezj32bbkAzP8sB6JUzQmXVORGAwq6kUeRfV7/oU 5LilCwxHJzLCXP7kcXLTv4A2XmyMXqbXmgOiD+QMa7RVffQPrcYuO2kl9mM5g98VCX98 +FiQ== X-Gm-Message-State: APjAAAXAEqkjKffQWYe5bCHGga1V6bKZZbt8OobfjhJQscTNUk/c7S+O 0CJW6HEwCpZ7aP/lS2Y7fqY= X-Google-Smtp-Source: APXvYqy5rQTaf92DK/GLo1UoeEvJVsA+oe2qtIwfLPU8CKzOIzaKTlff53NKmzZmujP0cWGKE+bBXg== X-Received: by 2002:a62:1385:: with SMTP id 5mr7868384pft.221.1554407107578; Thu, 04 Apr 2019 12:45:07 -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 g4sm29404285pfo.38.2019.04.04.12.45.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 12:45:06 -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 09/11] qla2xxx: Unregister chrdev if module initialization fails Date: Thu, 4 Apr 2019 12:44:46 -0700 Message-Id: <20190404194448.121489-10-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT In-Reply-To: <20190404194448.121489-1-bvanassche@acm.org> References: <20190404194448.121489-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 If module initialization fails after the character device has been registered, unregister the character device. Additionally, avoid duplicating error path code. Cc: Himanshu Madhani Cc: Giridhar Malavali Fixes: 6a03b4cd78f3 ("[SCSI] qla2xxx: Add char device to increase driver use count") # v2.6.35. Signed-off-by: Bart Van Assche --- drivers/scsi/qla2xxx/qla_os.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 137c7165d21d..ea0b666c3c90 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -7329,8 +7329,7 @@ qla2x00_module_init(void) /* Initialize target kmem_cache and mem_pools */ ret = qlt_init(); if (ret < 0) { - kmem_cache_destroy(srb_cachep); - return ret; + goto destroy_cache; } else if (ret > 0) { /* * If initiator mode is explictly disabled by qlt_init(), @@ -7354,11 +7353,10 @@ qla2x00_module_init(void) qla2xxx_transport_template = fc_attach_transport(&qla2xxx_transport_functions); if (!qla2xxx_transport_template) { - kmem_cache_destroy(srb_cachep); ql_log(ql_log_fatal, NULL, 0x0002, "fc_attach_transport failed...Failing load!.\n"); - qlt_exit(); - return -ENODEV; + ret = -ENODEV; + goto qlt_exit; } apidev_major = register_chrdev(0, QLA2XXX_APIDEV, &apidev_fops); @@ -7370,27 +7368,37 @@ qla2x00_module_init(void) qla2xxx_transport_vport_template = fc_attach_transport(&qla2xxx_transport_vport_functions); if (!qla2xxx_transport_vport_template) { - kmem_cache_destroy(srb_cachep); - qlt_exit(); - fc_release_transport(qla2xxx_transport_template); ql_log(ql_log_fatal, NULL, 0x0004, "fc_attach_transport vport failed...Failing load!.\n"); - return -ENODEV; + ret = -ENODEV; + goto unreg_chrdev; } ql_log(ql_log_info, NULL, 0x0005, "QLogic Fibre Channel HBA Driver: %s.\n", qla2x00_version_str); ret = pci_register_driver(&qla2xxx_pci_driver); if (ret) { - kmem_cache_destroy(srb_cachep); - qlt_exit(); - fc_release_transport(qla2xxx_transport_template); - fc_release_transport(qla2xxx_transport_vport_template); ql_log(ql_log_fatal, NULL, 0x0006, "pci_register_driver failed...ret=%d Failing load!.\n", ret); + goto release_vport_transport; } return ret; + +release_vport_transport: + fc_release_transport(qla2xxx_transport_vport_template); + +unreg_chrdev: + if (apidev_major >= 0) + unregister_chrdev(apidev_major, QLA2XXX_APIDEV); + fc_release_transport(qla2xxx_transport_template); + +qlt_exit: + qlt_exit(); + +destroy_cache: + kmem_cache_destroy(srb_cachep); + return ret; } /** From patchwork Thu Apr 4 19:44:47 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: 10886171 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 B16C615AC for ; Thu, 4 Apr 2019 19:45:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1241285C7 for ; Thu, 4 Apr 2019 19:45:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95CA628684; Thu, 4 Apr 2019 19:45:10 +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 451FA285C7 for ; Thu, 4 Apr 2019 19:45:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730426AbfDDTpK (ORCPT ); Thu, 4 Apr 2019 15:45:10 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:36217 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730400AbfDDTpJ (ORCPT ); Thu, 4 Apr 2019 15:45:09 -0400 Received: by mail-pl1-f194.google.com with SMTP id ck15so1670083plb.3 for ; Thu, 04 Apr 2019 12:45:09 -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=5mK1KQg1XwCRfHUHyNaNySkNw3x+EchNFV63yeMLv+g=; b=JUD7Bmh02iBxQZxK3OITno+zyweqEbZr9vEZuB7ynP1VJAkSsIPW4c4UkVHwmfuc90 v2cLDvNxPP/Y5Gl0ULn0wFMEXCxSGRepr6fzPuZAtYhvczx2/SuDgAZmrt890JCayo89 XErNJ9SBuIs+aSfxQlzqiHPuOoiDs2LLFMW1PibPGEJA9xxHdksRcIekSs8SRnt2MXyS QAqdUt4hy8EKGDrqNnNa/UiMnWLSaylEYk/tb3pA5m7pry8fX9HZN+L/dLTVOH0+MroO I92MV3MWEd5bjrNPOnw/IZihstWsu2CbB0H+4ssQ41ChZQb4nFZVncqC+r86v62sEeDL 0eYQ== X-Gm-Message-State: APjAAAW7ewZHBaDpR52R/joe67mXoRhI9tPgec21KE6a0Lf4alQ/6o6G ejXvBOS/h8aYgCcsfukwZbI= X-Google-Smtp-Source: APXvYqzVJXvud1giwg81pcf9nU6Kkczx3F4HgxE3LfScLz12X4K+d7CEgQHlPhhYkyUe6FDo/erK+A== X-Received: by 2002:a17:902:781:: with SMTP id 1mr8221800plj.300.1554407108902; Thu, 04 Apr 2019 12:45:08 -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 g4sm29404285pfo.38.2019.04.04.12.45.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 12:45:08 -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 10/11] qla2xxx: Unregister resources in the opposite order of the registration order Date: Thu, 4 Apr 2019 12:44:47 -0700 Message-Id: <20190404194448.121489-11-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT In-Reply-To: <20190404194448.121489-1-bvanassche@acm.org> References: <20190404194448.121489-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 Make sure that resources are only unregistered after the users of these resources have been unregistered. Only unregister the character device if registration of it succeeded. Cc: Himanshu Madhani Cc: Giridhar Malavali Signed-off-by: Bart Van Assche --- drivers/scsi/qla2xxx/qla_os.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index ea0b666c3c90..b0e5484bf026 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -7407,14 +7407,15 @@ qla2x00_module_init(void) static void __exit qla2x00_module_exit(void) { - unregister_chrdev(apidev_major, QLA2XXX_APIDEV); pci_unregister_driver(&qla2xxx_pci_driver); qla2x00_release_firmware(); - kmem_cache_destroy(srb_cachep); - qlt_exit(); kmem_cache_destroy(ctx_cachep); - fc_release_transport(qla2xxx_transport_template); fc_release_transport(qla2xxx_transport_vport_template); + if (apidev_major >= 0) + unregister_chrdev(apidev_major, QLA2XXX_APIDEV); + fc_release_transport(qla2xxx_transport_template); + qlt_exit(); + kmem_cache_destroy(srb_cachep); } module_init(qla2x00_module_init); From patchwork Thu Apr 4 19:44:48 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: 10886173 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 EBA521800 for ; Thu, 4 Apr 2019 19:45:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA6C028684 for ; Thu, 4 Apr 2019 19:45:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CEA7228AB6; Thu, 4 Apr 2019 19:45:17 +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 70DB128684 for ; Thu, 4 Apr 2019 19:45:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730416AbfDDTpQ (ORCPT ); Thu, 4 Apr 2019 15:45:16 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:42224 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730433AbfDDTpK (ORCPT ); Thu, 4 Apr 2019 15:45:10 -0400 Received: by mail-pl1-f194.google.com with SMTP id cv12so1656033plb.9 for ; Thu, 04 Apr 2019 12:45:10 -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=P587d5uLxDQh1j78V8DoHPHM/rkiw6Z2s4MrzllShfk=; b=oh50OVhMNJsATQOQ9d0fsnG8hdMjGWvl6CQF2mQonm2N/KoZpMSgUKWL4ZNLf2SSpF bsaI0iMtoVhPvLyKGSUcDxU99A1Ii12fgVdJWXnHxGzRKNT2+Uhx5TxThpcGoMoIwNKb mWfdkXnKz+nSH1fkbfERmjMi3AimALvmQW8EBieNCeJnH7zqqUTtspDWwUQxOGATSu/7 ylhTrJ0b+2Y4wcaHp5CV516klG5WDFd/KQvzD5rO1aiJU1w7SEjEIDpgtPZGNjRFPPch FNDHCYzAC4Z1q1WxIAlNKxzODN7cqWactEZb1ELWXM604jstBZ+7jFprbWT1zq6jwkmX WeHw== X-Gm-Message-State: APjAAAVOALwvFGwTax8q30dBdI/uFJdu4KJyof1fyPTBDu1NyAcJpHkp 6W1iqKL+Y55tt1swF18Yzn8= X-Google-Smtp-Source: APXvYqzoSl900GmGcPGeRsv+MMiSu84z39q9OqAJcCiNRdLkzVIM6StOhZHsV+aO6301pTYkO8Q99A== X-Received: by 2002:a17:902:31c3:: with SMTP id x61mr8026780plb.143.1554407110054; Thu, 04 Apr 2019 12:45:10 -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 g4sm29404285pfo.38.2019.04.04.12.45.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Apr 2019 12:45:09 -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 11/11] tcm_qla2xxx: Minimize #include directives Date: Thu, 4 Apr 2019 12:44:48 -0700 Message-Id: <20190404194448.121489-12-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT In-Reply-To: <20190404194448.121489-1-bvanassche@acm.org> References: <20190404194448.121489-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 Only include those header files that are needed by the code in this source file. Cc: Himanshu Madhani Cc: Giridhar Malavali Signed-off-by: Bart Van Assche Acked-by: Himanshu Madhani --- drivers/scsi/qla2xxx/tcm_qla2xxx.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 8a3075d17c63..013f94abe477 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c @@ -24,22 +24,15 @@ #include -#include #include -#include -#include #include #include -#include #include #include #include #include #include -#include #include -#include -#include #include #include