From patchwork Thu Feb 24 23:30:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 12759426 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D0E5C433EF for ; Thu, 24 Feb 2022 23:31:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233982AbiBXXbd (ORCPT ); Thu, 24 Feb 2022 18:31:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233258AbiBXXbc (ORCPT ); Thu, 24 Feb 2022 18:31:32 -0500 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81D66186B82 for ; Thu, 24 Feb 2022 15:31:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1645745461; x=1677281461; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=zdVLbzhYla2YZaTACujeWEbgVYGpiiXXLA0O0Pmn0YY=; b=gQkuQrCKb4/9iKIaWjamb25MPiKzx2NvZcMhdsG0KFtt0ZLS4zVrV+eV nrMNKP2FxL+DY9VkZGSCfDI4119lUA7d1148yv4gCZYxWuDx03QzRbpXL MH7uhI0hlKDPeDu4vUNLEubbS3GNbZh4JrFQKLlN9UZCQ+Vt/UDcl02tT Z1R09iWB0fyKpxZR3TCaI18fiwOS/x1e0CuBdVB7+su3JNMulLyIcCirS +rUJxd81UyTr19eVlCcf5G47cR1lr7IFjiWK4d9RYCQr+0VsLzTHjrmZn H/nD5rZW6FYLXpXR06gkNh0yifkZEOfv/nyJGwzBgLGllWgAy7A2Duvpg Q==; X-IronPort-AV: E=Sophos;i="5.90,134,1643644800"; d="scan'208";a="192821970" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2022 07:31:00 +0800 IronPort-SDR: zwYaq4yHahh8RhZE0uqojBBIPfxlPNw2ugZP0xI9eRfg282LtbBd9h3bpbfZaOFFig+jVHDjA6 AZNYH4rNeEUiKQZdvAMjajY2xSF2bnhCvXfEwxU/yJIV7di2F0BFns+qzxffrVHt8wj/AwVPF+ zTMzdAhoWpLE2WgsIFVLv6TZj6pI3g6LgCQ9Lkx9zwZd9UarnzdZube7b3NaQVL9o0f4IbfVat nF67NYoXCqKpxw+leDKyKPP14OzuMzTLX9R3YmE1pv0MFzk3mys/hW8e2g0tXLVV05eJeERdOf PJwX4FwuX9ZK8dwTp+43PFVq Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 15:02:30 -0800 IronPort-SDR: aDVklyWh+BSemyOSO4/jvCJEHTKUs1AQ5MQfgi7wiS3bQJq3bzjuJ+i82bbYf4ssyMZkMcf/v7 3aj9QkRoKwbRNkGPuu/2Fd28RS47puQCTkSzaWeMzgIWbNQawkEBGK54SoA7qPJYC8Jaqge6PT 8H496AodaaYNp76xjIuhJ6R5a1Rfuw02iaqXxTQF0l7OGHafWNjQB5DYEYbqyBMq/zQFD//uMs RPN+u0vrp3zSH6pILebWzkUKH8rShJYCI6uIZmSyX5tA/zD5jsTRuysxgQCeuo4Jq94K89UZpb FIk= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 15:31:01 -0800 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4K4Tg84Swjz1SVp0 for ; Thu, 24 Feb 2022 15:31:00 -0800 (PST) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1645745460; x=1648337461; bh=zdVLbzhYla2YZaTACu jeWEbgVYGpiiXXLA0O0Pmn0YY=; b=m1fgOPbmSxNtS6ipCY6Wax/FbMLCuFCIic YBnSr6XC2y7r5gK5iOuJsFCtTziAIZSUdorFXcMInAaODnZqdlpSf3sFI0yvhRzO Zv67RSYVyxvTbJierN0aVEA7ec214x+vhgPxUcB44r86EsDc4KG6EVJ36DlZFwfu UAjCG08zlj/8VXF97rr/7dLFvXFRKQTS1dN1s0H/eLRtAdTw8LoxH+M+/jnkjd51 bzLSYIxD2rBOL02h7BuJ7McgC8H6g26g7rY+dSowgTlZ1DCS2KDMXwyQnR8Avl1j sjLUM/WGYexkBDwjO2rcwIBIruqVTFMRcdYK2QOA1eup+Dtr1zyA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id X4KEhPwX3qkq for ; Thu, 24 Feb 2022 15:31:00 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4K4Tg718nNz1Rwrw; Thu, 24 Feb 2022 15:30:59 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v2 1/5] scsi: mpt3sas: fix _ctl_set_task_mid() TaskMID check Date: Fri, 25 Feb 2022 08:30:52 +0900 Message-Id: <20220224233056.398054-2-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224233056.398054-1-damien.lemoal@opensource.wdc.com> References: <20220224233056.398054-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The TaskMID field of struct Mpi2SCSITaskManagementRequest_t is a 16-bits little endian value. Fix the search loop in _ctl_set_task_mid() to add a cpu_to_le16() conversion before checking the value of TaskMID to avoid sparse warnings. While at it, simplify the search loop code to remove an unnecessarily complicated if condition. Signed-off-by: Damien Le Moal --- drivers/scsi/mpt3sas/mpt3sas_ctl.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c index d92ca140d298..84c87c2c3e7e 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c +++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c @@ -578,7 +578,7 @@ static int _ctl_set_task_mid(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command *karg, Mpi2SCSITaskManagementRequest_t *tm_request) { - u8 found = 0; + bool found = false; u16 smid; u16 handle; struct scsi_cmnd *scmd; @@ -600,6 +600,7 @@ _ctl_set_task_mid(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command *karg, handle = le16_to_cpu(tm_request->DevHandle); for (smid = ioc->scsiio_depth; smid && !found; smid--) { struct scsiio_tracker *st; + __le16 task_mid; scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid); if (!scmd) @@ -618,10 +619,10 @@ _ctl_set_task_mid(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command *karg, * first outstanding smid will be picked up. Otherwise, * targeted smid will be the one. */ - if (!tm_request->TaskMID || tm_request->TaskMID == st->smid) { - tm_request->TaskMID = cpu_to_le16(st->smid); - found = 1; - } + task_mid = cpu_to_le16(st->smid); + if (!tm_request->TaskMID) + tm_request->TaskMID = task_mid; + found = tm_request->TaskMID == task_mid; } if (!found) { From patchwork Thu Feb 24 23:30:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 12759427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD25AC433F5 for ; Thu, 24 Feb 2022 23:31:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234116AbiBXXbi (ORCPT ); Thu, 24 Feb 2022 18:31:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234009AbiBXXbd (ORCPT ); Thu, 24 Feb 2022 18:31:33 -0500 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1C38186B82 for ; Thu, 24 Feb 2022 15:31:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1645745463; x=1677281463; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=OFmN811CwEBOyhUbY0uvSQICwH7isycEQM+uR5+NIlc=; b=f1YAX6n+iChaNUXDiGyCHzo3hq5+JJBjKpxSYhEPGODl8kXxf09E0yD6 i9aBmBo2pf4MIOljg/IbuuWlfJKV7kaGMH9R/H1wFKXlOQAawmnporiBI +Ws9DwQmEh8MISuezhGNW/F9K8VyrBsdXkK2wpV5OFL1i+PMpdrYp0FHD 4AG4rIVBJU8nOEfiUaWtPZRw2ygIUF2Y15ufymcIcctaOrSiU5UR2b4nD TDevlI+0qaNZmFQmhulhUkn1jL2xzSCDufiVashfSacVIG7D5SaZPRpzQ lEskwjAzQ+umlVXgWusEA6hliYImYpIgODDV89f4Knb7U0WWoesjCkhQD w==; X-IronPort-AV: E=Sophos;i="5.90,134,1643644800"; d="scan'208";a="192821972" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2022 07:31:02 +0800 IronPort-SDR: Hy91g/kCdNWEJhBapU+aGt24SHNr1+HkAdQpu2kcMmFJeXsLBBI2pjR1M0tr4sGC3wjwT9b9tx UcX7wLCMUHgPPduZOEH3Gz10N6vQPZiKVIm5tzSNce2smzXADLZSZks/0g2+ZQavQ/wwm+YWxz 8r5wmz8tauPCa3Q/+3Q97ejaq9NomGA+YEmOjrD1ch8aKFd5WvBOTMhbluGI3+BZcyWapkbLct TIzgFaRKhSE41az+7jf+dKyUheqMLv1wmHqsDJYNGP6FDu/AFz0YgPsgd5tz8SUF/xuNecO9Tc 5dk8YfLEyBmciLS13kTBeZdd Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 15:02:32 -0800 IronPort-SDR: RhGIJIWvx9QfPAJH9vYDb/FVNBinKwsiFTf8ymU3XhRc10SB0cH9qp/8N7A9UdX9YbfW5rYZML ktLsleB+pJamzYcSUsz9+XafFd9oFrNqT+NPCUMn+zFk1/zlNiSZ5oS8rSGXQFgDiXwSUZiCOV 3zmeML3Za+/GgAmcdUTg5WCoiyolIajC0Tnq+zY84RKjYlaf2AVvLw3xRJiWXc/c9Kpg0fW4HF NHcIW6uen0TRRoonVuvhXmdAs9F+PuFI6OiC7stHnaYS4aRS9lWCcGiQty1QD+PaydBAfoIkpW iYs= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 15:31:02 -0800 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4K4Tg973d3z1SVp2 for ; Thu, 24 Feb 2022 15:31:01 -0800 (PST) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1645745461; x=1648337462; bh=OFmN811CwEBOyhUbY0 uvSQICwH7isycEQM+uR5+NIlc=; b=nN2Lfxa/QhvkdQ8lXH8TluHHJ0s8m/8zS9 yMPu1zSgleFzCKx36FjY1ptAUQG1oaErcdoJtFITuzKe09dV2aCcMTd8GHFgQ4dj OzJY4cwcBb7owORkyp3mN0FVz6qAMklK6kINZFvBCz2nYMC6UAQeia7I3PvLPRIO goPuQj2V4loT7gOpKEg53XftDcizKhJnESqSZ3WfLAKK7xEUGmGV/NGmTrpcopC1 gMCcoF+m/1KFBiBoRrFV+WTk0Etyo9t1kt2fYiBya+jf2+GlaY7VUPui3jtMOA34 /9MRAfyYMYypjjD9nBHaZLEnZY2oH9lUyw62Z2ICH8ShkqFrhqNw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id YHFJNaNJCS2B for ; Thu, 24 Feb 2022 15:31:01 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4K4Tg8365zz1Rvlx; Thu, 24 Feb 2022 15:31:00 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v2 2/5] scsi: mpt3sas: Fix writel() use Date: Fri, 25 Feb 2022 08:30:53 +0900 Message-Id: <20220224233056.398054-3-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224233056.398054-1-damien.lemoal@opensource.wdc.com> References: <20220224233056.398054-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org writel() internally execute cpu_to_le32() to convert the vale being wrritten to little endian. The caller should thus not use this conversion function for the value passed to writel(). Remove the cpu_to_le32() calls in _base_put_smid_scsi_io_atomic(), _base_put_smid_fast_path_atomic(), _base_put_smid_hi_priority_atomic() _base_put_smid_default_atomic() amd _base_handshake_req_reply_wait(). Signed-off-by: Damien Le Moal --- drivers/scsi/mpt3sas/mpt3sas_base.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 511726f92d9a..6ebdfedd84f5 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -4323,7 +4323,7 @@ _base_put_smid_scsi_io_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid, descriptor.MSIxIndex = _base_set_and_get_msix_index(ioc, smid); descriptor.SMID = cpu_to_le16(smid); - writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost); + writel(*request, &ioc->chip->AtomicRequestDescriptorPost); } /** @@ -4345,7 +4345,7 @@ _base_put_smid_fast_path_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid, descriptor.MSIxIndex = _base_set_and_get_msix_index(ioc, smid); descriptor.SMID = cpu_to_le16(smid); - writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost); + writel(*request, &ioc->chip->AtomicRequestDescriptorPost); } /** @@ -4368,7 +4368,7 @@ _base_put_smid_hi_priority_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid, descriptor.MSIxIndex = msix_task; descriptor.SMID = cpu_to_le16(smid); - writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost); + writel(*request, &ioc->chip->AtomicRequestDescriptorPost); } /** @@ -4389,7 +4389,7 @@ _base_put_smid_default_atomic(struct MPT3SAS_ADAPTER *ioc, u16 smid) descriptor.MSIxIndex = _base_set_and_get_msix_index(ioc, smid); descriptor.SMID = cpu_to_le16(smid); - writel(cpu_to_le32(*request), &ioc->chip->AtomicRequestDescriptorPost); + writel(*request, &ioc->chip->AtomicRequestDescriptorPost); } /** @@ -6906,7 +6906,7 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, /* send message 32-bits at a time */ for (i = 0, failed = 0; i < request_bytes/4 && !failed; i++) { - writel(cpu_to_le32(request[i]), &ioc->chip->Doorbell); + writel(request[i], &ioc->chip->Doorbell); if ((_base_wait_for_doorbell_ack(ioc, 5))) failed = 1; } From patchwork Thu Feb 24 23:30:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 12759428 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39C4DC433EF for ; Thu, 24 Feb 2022 23:31:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234120AbiBXXbi (ORCPT ); Thu, 24 Feb 2022 18:31:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233258AbiBXXbe (ORCPT ); Thu, 24 Feb 2022 18:31:34 -0500 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7CC22399D2 for ; Thu, 24 Feb 2022 15:31:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1645745464; x=1677281464; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=unaPc+bJDjDEi5zJ5BafAvJLsHIWC/zgKf9goBf7tAQ=; b=QPpRHhX9ryeM46aATz4OFt7wGL6al6d3f96J9+qKeu78R/DHyl84fhI0 SeUoPQNxzNN/M7HuU5O/H7Kju523h0o5IR0IqX1P9eVzjGHDyywm1qIJD gyGZ7Y3eCHR7+m3i4xhWdyc5lyaSAIpZIW48klIHij9tHNHvxe27y182i JDU9mR/w0tI3rVVy6DPVNr3+7d0UFaCzIFQkrjz0izkObsekEB8oz0zZR L8/8otVDEKqliMnTlFUpdSMddX69HohM6KMibqKvI8oKaeFhGU/idpVgE PBK0ppLzaVPQLa/W7ARi6+XCNZFW8ahd0sWRjohlky6bqJugxHYeiTUN4 w==; X-IronPort-AV: E=Sophos;i="5.90,134,1643644800"; d="scan'208";a="192821977" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2022 07:31:03 +0800 IronPort-SDR: CCw7tk+DbMHNXka/ebbc14eQb6W9hY6USDVkQSL+hRcTWI6KHTwBT5MbH61ANOpCtW4nALvpHN wZ2Sr+lKcaPZtwo3gVb6m/ZNSD/htBck8dnfOpLntc7yV8qqt9i5rzqMmB6BRn4dxZhUxyvb6r QEeM3gqITF/xABbg4LlUe+qoBJaLJ57z7BiYhOrGjLIC2NIzpzVnBQZZxL6ux7wd1jl355y0z9 rCkKUZLIJYtqJsR33yCw5F/Jjm4mnRGi8LJ9OcoucdsBkP3V4vsoh5vC5m3Aj8LiwaAgv9g5FX IdOB5fglJ3xpS+ml4y3ODTK5 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 15:02:33 -0800 IronPort-SDR: 4NBi6PNwkGm4iPiQ2HPtgwM82aMTwogy0y8you9XfBEireF2bzGsD7JSY3G0Vu1O8ywsqSycl5 RUtWk0NKAG1Dr+QqvajVTmUGg8/M3PqAcOuzmIwUh7OgLDatsrra+YkakrqSf9wUqSxFX0OGZk TA/tqAXcA3Zg/RuRD5HpLjo1i3gPlTxL0diG5GQNirEJxrldyL/VY29IpioOr43loWvQwXMG0p U1vuGKUMsZTiY++YiCDsyD5pRp/jHNxVMo6K/RVWUJWOHiIi4PHZu2kKVdm3oq59vmRWynQeJm OHw= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 15:31:04 -0800 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4K4TgC0y8Cz1SVp1 for ; Thu, 24 Feb 2022 15:31:03 -0800 (PST) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1645745462; x=1648337463; bh=unaPc+bJDjDEi5zJ5B afAvJLsHIWC/zgKf9goBf7tAQ=; b=eStP50CLmlFL4Xcp6FKFeA1VR3uQk39VRH XfDP3i4UFpx8mHWqfYguz0x2R1hsDehzkRNQorW2RSYx5OndhakNtilG4q17edey NJKrztbnOq/UuucdhHEQUp/NqPWdrg/PAVoDbfrr/b5AFx8Krp+7/H48Hcr9/Fbx BkaMVn1DWEFOVfPkY4DAwFzKzmryWqs3adCoA1y7MXhiK4q2x3mofzNSpBRYb7ox SbKZFSHwxLD3Xyo1wYj5zTd9Xp0BykpP5LqwIlL9aktix6CNxPmNAJHvoLudB4MI j96PWz8qXPEIz1btNGTjzemVCjSIemec6bSxBsAqy+p7OM6cllTQ== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id rRSPNAwp3euX for ; Thu, 24 Feb 2022 15:31:02 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4K4Tg94SqBz1Rwrw; Thu, 24 Feb 2022 15:31:01 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v2 3/5] scsi: mpt3sas: fix ioc->base_readl() use Date: Fri, 25 Feb 2022 08:30:54 +0900 Message-Id: <20220224233056.398054-4-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224233056.398054-1-damien.lemoal@opensource.wdc.com> References: <20220224233056.398054-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The functions _base_readl_aero() and _base_readl() used for an adapter base_readl() method are implemented using a regular readl() call which performs internally a conversion to CPU endianness (le32_to_cpu()) of the values read. The users of the ioc base_readl() method should thus not convert again the values read using le16_to_cpu(). Fixing this removes sparse warnings. Signed-off-by: Damien Le Moal --- drivers/scsi/mpt3sas/mpt3sas_base.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 6ebdfedd84f5..5efe4bd186db 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -6925,16 +6925,16 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, } /* read the first two 16-bits, it gives the total length of the reply */ - reply[0] = le16_to_cpu(ioc->base_readl(&ioc->chip->Doorbell) - & MPI2_DOORBELL_DATA_MASK); + reply[0] = ioc->base_readl(&ioc->chip->Doorbell) + & MPI2_DOORBELL_DATA_MASK; writel(0, &ioc->chip->HostInterruptStatus); if ((_base_wait_for_doorbell_int(ioc, 5))) { ioc_err(ioc, "doorbell handshake int failed (line=%d)\n", __LINE__); return -EFAULT; } - reply[1] = le16_to_cpu(ioc->base_readl(&ioc->chip->Doorbell) - & MPI2_DOORBELL_DATA_MASK); + reply[1] = ioc->base_readl(&ioc->chip->Doorbell) + & MPI2_DOORBELL_DATA_MASK; writel(0, &ioc->chip->HostInterruptStatus); for (i = 2; i < default_reply->MsgLength * 2; i++) { @@ -6946,9 +6946,8 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, if (i >= reply_bytes/2) /* overflow case */ ioc->base_readl(&ioc->chip->Doorbell); else - reply[i] = le16_to_cpu( - ioc->base_readl(&ioc->chip->Doorbell) - & MPI2_DOORBELL_DATA_MASK); + reply[i] = ioc->base_readl(&ioc->chip->Doorbell) + & MPI2_DOORBELL_DATA_MASK; writel(0, &ioc->chip->HostInterruptStatus); } From patchwork Thu Feb 24 23:30:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 12759429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAF9FC433F5 for ; Thu, 24 Feb 2022 23:31:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234173AbiBXXbk (ORCPT ); Thu, 24 Feb 2022 18:31:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234032AbiBXXbf (ORCPT ); Thu, 24 Feb 2022 18:31:35 -0500 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CF2F2763C1 for ; Thu, 24 Feb 2022 15:31:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1645745465; x=1677281465; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=fy482iV7TvYo4Oi9JfCYtzCX6QbrjUioqGVwAf3nVMc=; b=P6ZDBse9gxUYj78NG8pli55+nPBfWHEm19GvKbAbkWModFQLjPuaCsRe Tt2Xm+HsFAz/gSY1xlKYDTWvdaYyp9opk/HE+O5MHwC9YbbKpVn/ms4pH sdryREA96WJ7lLjkulcei9Q6i9lIwaBcOWEh3J23JSZ/f4cXvvF9/okqu 9zBvsjN41F4yioaNGCT9Dd1fiekpQVHerMESk7f6ydRYEsd2ZAQ/xuamm J/qiJkmhvMeHYCTdn2HGtWfNj0esLmG13Udrpxr0+PCwv8+XF2sVRagAw nknh7epBxzMM2K1nWnfMew2CjBtJpnQjYxdiTxi0an9CU3NaFI5DScOtM w==; X-IronPort-AV: E=Sophos;i="5.90,134,1643644800"; d="scan'208";a="192821982" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2022 07:31:04 +0800 IronPort-SDR: lWlVbOoJ7gp6n1Wa17OE0eQb8DHKdkADh8/Sg1T+LobVIquAN/6A44v08n1mJMmcKkC7BO2JNc tRfU7+LwfpeeN0KBg6sEfEV4mVJorhF0Q1aTbszjzDrAJsG2TFb/XTl2Mnbdb3oHGGtl9wyyx3 BV8f8abJE69h/cQlAJiPKXrCy37kqu6xIzdd2yjibe5OqxjwcnD9WJ8MNuS3j7DpIcVGojxXI4 8mLA//8CAbWr3/fBlLCxJCzhgxiCIAsdPW/ULNnu7w0FPvn7qDeWxoJwIpoaLzSr/Xl6dLMgeI U+Rxpnf8qisRQxl02hJloliY Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 15:02:34 -0800 IronPort-SDR: 9FDdxW8UBqikvL+ja/aDj1UELfFLJvDY9NfUq6ueIhdgiE18V9yAa0RWU8PN+abXY8ThUCNk9b VndqLxrBJYrMfH9gV8WJIyNnTkkW109yYBNvlm7HP3rU7OVn9nx39WHkBAI/87fNSvDmCtYkiU UX+L6yiOAwZy02ujGBZT+JFZneTqM7U6wk8CdsEVOPXUd6cxcw95m6SFW7QS1GTNYVmK3FgBdI JIjOkxwltVZ5l0oH6kEn6JSPlRU+TKYGc1F0Wi80MW3LGvRBzPZQ4A7YFeQvDOYlls5izuTyYm Yos= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 15:31:05 -0800 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4K4TgD293jz1SVp1 for ; Thu, 24 Feb 2022 15:31:04 -0800 (PST) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1645745463; x=1648337464; bh=fy482iV7TvYo4Oi9Jf CYtzCX6QbrjUioqGVwAf3nVMc=; b=uVSnCoM5l/T/wxgAsNCkw3SUR4qgOa9Kvk PGd804WTZpaEhoZh7QdZsO0lpg5ANGRnVDqB+j5zcuMFQMsp/bYEq3jhlVGyxdxH drJtetiC2CHZT2BubdSv+spTYvw5EvtE69jhs0QpNKUgfNeeuZxk71+c7R/h6XSJ NvAZA11Ck6zbQ8cbHwIc4mSr///yV6jvogBU78gbLJKFKrqswpncR6z4NtUZXK9f onH2iQqPzp4Eu+r2u90J0mGANQ0B7iPDpJn1jZcnGlKYTmZ6VT6Jzgd9e0KXVxyL 8XWZGuweRvMOMipEfy828qOwCMHfRanwYjFfnP1kwLeESE/6etFA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id IK25Hqebsh85 for ; Thu, 24 Feb 2022 15:31:03 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4K4TgB6MVYz1Rvlx; Thu, 24 Feb 2022 15:31:02 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v2 4/5] scsi: mpt3sas: fix event callback log_code value handling Date: Fri, 25 Feb 2022 08:30:55 +0900 Message-Id: <20220224233056.398054-5-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224233056.398054-1-damien.lemoal@opensource.wdc.com> References: <20220224233056.398054-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In mpt3sas_scsih_event_callback(), fix a sparse warning when testing the event log code value by replacing the use of a pointer to the address storing the event log code with a log code local variable . Doing so, le32_to_cpu() is used when the log code value is assigned, avoiding a sparse warning. Signed-off-by: Damien Le Moal --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 00792767c620..a355bc145577 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -10926,20 +10926,20 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, case MPI2_EVENT_LOG_ENTRY_ADDED: { Mpi2EventDataLogEntryAdded_t *log_entry; - u32 *log_code; + u32 log_code; if (!ioc->is_warpdrive) break; log_entry = (Mpi2EventDataLogEntryAdded_t *) mpi_reply->EventData; - log_code = (u32 *)log_entry->LogData; + log_code = le32_to_cpu(*(__le32 *)log_entry->LogData); if (le16_to_cpu(log_entry->LogEntryQualifier) != MPT2_WARPDRIVE_LOGENTRY) break; - switch (le32_to_cpu(*log_code)) { + switch (log_code) { case MPT2_WARPDRIVE_LC_SSDT: ioc_warn(ioc, "WarpDrive Warning: IO Throttling has occurred in the WarpDrive subsystem. Check WarpDrive documentation for additional details.\n"); break; From patchwork Thu Feb 24 23:30:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 12759430 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9723C433F5 for ; Thu, 24 Feb 2022 23:31:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234201AbiBXXbl (ORCPT ); Thu, 24 Feb 2022 18:31:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234071AbiBXXbh (ORCPT ); Thu, 24 Feb 2022 18:31:37 -0500 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28E942763C8 for ; Thu, 24 Feb 2022 15:31:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1645745466; x=1677281466; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=cEltjDqj/9pJQTo/KSSustfkwvntQF26zL2bd9bpM3I=; b=ThAaqbWyp1ykNmfhBZ0vLPGXLRPHMj/p3gsowazTp/8J5o1Hei8C+ZAu d7O1y6njAVLh7jqqz7mhQ6+D/2inv0JEuKPZBKNJjY791H5ergakzmz7E JoKnf5XJc9aL95sU5Mp0dXyD7a1p6EKjV9sgJfm3lBzX+naknqtLF6GtB 3+424dlQbYIl4sWNru5kO4ASGypc/BQ6++qgePoZ/5U8EC/R2t/aURA9B gj4MSLESCCraDe2I4/6LNRrx66c9Aih5pNUioJx3/lpdNRSZiIOueZbAm 02HV9MjI4wR/rLSRagTSF991Q/2XrUE922w24uTFP1VN/ORYM0Sdkt7i0 g==; X-IronPort-AV: E=Sophos;i="5.90,134,1643644800"; d="scan'208";a="192821990" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 25 Feb 2022 07:31:05 +0800 IronPort-SDR: /QUTrohL+l9Z2wNrVRodujgRF3mS9TRYABRfc2FA9UPE+a+dgmnf37k2mn1LEU2ESGKHR/4OZb aM0UNznCYjCAFVCzPVKiV4t6lu3T0YX9RbB4Y10zeZ0vl6j3pYHeSBlbR7X+yuS/Zth+lCetQs qjopZhfGtOeuhrzILHTVBiACzwY56Y7W4QY3kY/hOEPmB7BD9wrN4BYsv87j62pUCatlizN8pN TmTiBXZ/wl/mi2n+jHemihVs9WEqyDc+lSI4ehwbd2vuCVndfbh0OYvksG4cFY2iHRhRnhLUhr KKckUfWnsaFa8mIPYucRFlAr Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 15:02:35 -0800 IronPort-SDR: 0EHKnhj+XqhtK57rTZ5L7Ue8DOc1q0b5hcGSE+lNe21uCDIDHl00QA4+MqzeRMVmcd7aMD8EDE X+MSliuAo8MVvAMtkJuXTSot+4yMTaSRl7gMyr/FgZob6KlmIkxsZpt+b7T+TDawLU9Ai3kKFZ QOO/ku4hk01OOn4FaCaFKTEWRjRENcRCNi7eZuDCjpey8geTmnzsUDEb5Dss7e0PNRpYivm893 Ww6LOkLifQbgAaqRAPeGDJ7ajsKGBq+leIppBrbtu1Lv0WiR/O334lAZPyDj+4sbxwLnfWUC0z rHg= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2022 15:31:06 -0800 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4K4TgF3Q3fz1SHwl for ; Thu, 24 Feb 2022 15:31:05 -0800 (PST) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:mime-version :references:in-reply-to:x-mailer:message-id:date:subject:to :from; s=dkim; t=1645745465; x=1648337466; bh=cEltjDqj/9pJQTo/KS SustfkwvntQF26zL2bd9bpM3I=; b=fn7w/uRImdG6Jb83+MqiPQzZCmlUGKGBLu aYc3wEe5SKHnmdC/soFI043GWfGJ/XYA2o3WKBc7l0RczLFe7sgvwxAoTvTd2uV4 6/J3u0/Gy6apOvGdZJ3ymb0dm0Wbk3idh+uEr8KpCD0CtIYriIwHH6ZNdAb8mqXW w30jpRaERDMUtHpDsCaj171nFhIl5bk/b4KE4DokZrvTwG75HRRzm+WC9HavUj2P P/B1YlbtRU0v8jNfySFiyAOPbnW7C0iIdRDmR3SXezeCTUuplMBplQTbVfSlAdVg osdf7Jty7PvuzuZu6W6xqCSgadpEkbhkvccVVUbNErkvlxOpD0Zw== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id oBDDzc712Tf1 for ; Thu, 24 Feb 2022 15:31:05 -0800 (PST) Received: from washi.fujisawa.hgst.com (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4K4TgD0rHxz1Rwrw; Thu, 24 Feb 2022 15:31:03 -0800 (PST) From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , MPT-FusionLinux.pdl@broadcom.com Subject: [PATCH v2 5/5] scsi: mpt3sas: fix adapter replyPostRegisterIndex handling Date: Fri, 25 Feb 2022 08:30:56 +0900 Message-Id: <20220224233056.398054-6-damien.lemoal@opensource.wdc.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220224233056.398054-1-damien.lemoal@opensource.wdc.com> References: <20220224233056.398054-1-damien.lemoal@opensource.wdc.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The replyPostRegisterIndex array of struct MPT3SAS_ADAPTER is regular memory allocated from RAM, and not an IO mem resource. writel() should thus not be used to assign values to the array entries. Replace the writel() call modifying the array with direct assignements. This change suppresses sparse warnings. Signed-off-by: Damien Le Moal --- drivers/scsi/mpt3sas/mpt3sas_base.c | 37 ++++++++++++++++++----------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 5efe4bd186db..4caa719b4ef4 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -1771,10 +1771,13 @@ _base_process_reply_queue(struct adapter_reply_queue *reply_q) */ if (completed_cmds >= ioc->thresh_hold) { if (ioc->combined_reply_queue) { - writel(reply_q->reply_post_host_index | - ((msix_index & 7) << - MPI2_RPHI_MSIX_INDEX_SHIFT), - ioc->replyPostRegisterIndex[msix_index/8]); + unsigned long idx = + reply_q->reply_post_host_index | + ((msix_index & 7) << + MPI2_RPHI_MSIX_INDEX_SHIFT); + + ioc->replyPostRegisterIndex[msix_index/8] = + (resource_size_t *) idx; } else { writel(reply_q->reply_post_host_index | (msix_index << @@ -1826,14 +1829,17 @@ _base_process_reply_queue(struct adapter_reply_queue *reply_q) * new reply host index value in ReplyPostIndex Field and msix_index * value in MSIxIndex field. */ - if (ioc->combined_reply_queue) - writel(reply_q->reply_post_host_index | ((msix_index & 7) << - MPI2_RPHI_MSIX_INDEX_SHIFT), - ioc->replyPostRegisterIndex[msix_index/8]); - else + if (ioc->combined_reply_queue) { + unsigned long idx = reply_q->reply_post_host_index | + ((msix_index & 7) << MPI2_RPHI_MSIX_INDEX_SHIFT); + + ioc->replyPostRegisterIndex[msix_index/8] = + (resource_size_t *) idx; + } else { writel(reply_q->reply_post_host_index | (msix_index << MPI2_RPHI_MSIX_INDEX_SHIFT), &ioc->chip->ReplyPostHostIndex); + } atomic_dec(&reply_q->busy); return completed_cmds; } @@ -8095,14 +8101,17 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc) /* initialize reply post host index */ list_for_each_entry(reply_q, &ioc->reply_queue_list, list) { - if (ioc->combined_reply_queue) - writel((reply_q->msix_index & 7)<< - MPI2_RPHI_MSIX_INDEX_SHIFT, - ioc->replyPostRegisterIndex[reply_q->msix_index/8]); - else + if (ioc->combined_reply_queue) { + unsigned long idx =(reply_q->msix_index & 7) << + MPI2_RPHI_MSIX_INDEX_SHIFT; + + ioc->replyPostRegisterIndex[reply_q->msix_index/8] = + (resource_size_t *) idx; + } else { writel(reply_q->msix_index << MPI2_RPHI_MSIX_INDEX_SHIFT, &ioc->chip->ReplyPostHostIndex); + } if (!_base_is_controller_msix_enabled(ioc)) goto skip_init_reply_post_host_index;