From patchwork Wed Oct 7 04:36:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ching Huang X-Patchwork-Id: 11819765 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 85BF713B2 for ; Wed, 7 Oct 2020 04:36:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 55A77214DB for ; Wed, 7 Oct 2020 04:36:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=areca-com-tw.20150623.gappssmtp.com header.i=@areca-com-tw.20150623.gappssmtp.com header.b="n1WW5Ycr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726627AbgJGEgx (ORCPT ); Wed, 7 Oct 2020 00:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726100AbgJGEgw (ORCPT ); Wed, 7 Oct 2020 00:36:52 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B665C061755 for ; Tue, 6 Oct 2020 21:36:51 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id az3so415843pjb.4 for ; Tue, 06 Oct 2020 21:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=areca-com-tw.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:mime-version :content-transfer-encoding; bh=nozvEbVQdKm0fWbmXW8P7leHQ60pH5dp+Q3W9Dcy5V4=; b=n1WW5YcrI53xIITQW3rS0ytcseBT+T/RQHMz3Zqp57IfDZrghK4GL5kgXuXXsYB0LA zSdCBzRFTOQsz43WW+6+V7Hc1AJf0PN8PWnN43z8hyL0BmVX5BCY74vQiIzg2uhaHI+R hQs92hJpSCDmeJ5brsdGX26zRB1Dfnwfq5bHgpWGJrnl4++alCtBe3C/JRIYjAIqVYtu 4JOF9bQMwP1px9XxHgG7U7GObWf6C02N9k+3uA5aEgBDuH0qiZbJLijGL6OIQj3sFSHi BlS4UlCi0G6HMxvPI33SJnrxMjZfCBYVmTKRdyw+Q4/3PD+O/ez+KzFceGdqAyuDN0h8 1JXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:mime-version :content-transfer-encoding; bh=nozvEbVQdKm0fWbmXW8P7leHQ60pH5dp+Q3W9Dcy5V4=; b=OIkXH62YuJZl3P+mKA8hggxyvIDQ6dYSRGRLS7u8E2N2F4SPbi1Molk1kKtuNlxQCq sMmyN+p51wZ/jz212rq3ZJi9i7cSrJURypVkNhN/3XtfoncRDz7+qTRnBZqGBu0548hI LfMtbtUiHXrF55XDSAdplXIRARVMnBa7HMovsNjspKaB2k7MUr4ZbD4ETBgJos9AqWki 7E3E3paJauMhB99lBBByoy3HwG4+nYOfpmAqzwjFIQsqSqh/nkY/DS7pIHpUHTSfOm57 T/KeLVmIn7sROPJnEZypSdJiklSIyf5E4ys1eXr8OCm7/ugFiw6uP3JlyY7X/XtIOX/6 WrYA== X-Gm-Message-State: AOAM531tVjaoGEXRS8yuDTRdqm2xIh1i144h2KGSveM3u2nsITpqCca0 h8ANs+fHRbnj1995AD+zqVbx+A== X-Google-Smtp-Source: ABdhPJxD9yyAyA87nV4FleOY3/vQD8S5Z/YHoXq5MgZ1A7+P7KjsluKA5L+jUdSNE3BKauTwlUSlDw== X-Received: by 2002:a17:90b:1a89:: with SMTP id ng9mr825551pjb.24.1602045410632; Tue, 06 Oct 2020 21:36:50 -0700 (PDT) Received: from centos78 (60-248-88-209.HINET-IP.hinet.net. [60.248.88.209]) by smtp.gmail.com with ESMTPSA id g9sm901513pgm.79.2020.10.06.21.36.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Oct 2020 21:36:50 -0700 (PDT) Message-ID: Subject: [PATCH v2 1/2] scsi: arcmsr: fix warning: right shift count >= width of type From: ching Huang To: martin.petersen@oracle.com, James.Bottomley@HansenPartnership.com, linux-scsi@vger.kernel.org, Linux Kernel Mailing List Cc: kbuild test robot Date: Wed, 07 Oct 2020 12:36:49 +0800 X-Mailer: Evolution 3.28.5 (3.28.5-8.el7) Mime-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: ching Huang Fix warning: right shift count >= width of type. Reported-by: kernel test robot Signed-off-by: ching Huang diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index be6fb72..55d85c9 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c @@ -653,9 +653,9 @@ static void arcmsr_hbaF_assign_regAddr(struct AdapterControlBlock *acb) 3) >> 2) << 2; pmuF = acb->pmuF; /* host buffer low address, bit0:1 all buffer active */ - writel((uint32_t)(host_buffer_dma | 1), &pmuF->inbound_msgaddr0); + writel(lower_32_bits(host_buffer_dma | 1), &pmuF->inbound_msgaddr0); /* host buffer high address */ - writel((uint32_t)(host_buffer_dma >> 32), &pmuF->inbound_msgaddr1); + writel(upper_32_bits(host_buffer_dma), &pmuF->inbound_msgaddr1); /* set host buffer physical address */ writel(ARCMSR_HBFMU_DOORBELL_SYNC1, &pmuF->iobound_doorbell); } @@ -4057,11 +4057,8 @@ static int arcmsr_iop_confirm(struct AdapterControlBlock *acb) writel(cdb_phyaddr, ®->msgcode_rwbuffer[2]); writel(cdb_phyaddr_hi32, ®->msgcode_rwbuffer[3]); writel(acb->ccbsize, ®->msgcode_rwbuffer[4]); - dma_coherent_handle = acb->dma_coherent_handle2; - cdb_phyaddr = (uint32_t)(dma_coherent_handle & 0xffffffff); - cdb_phyaddr_hi32 = (uint32_t)((dma_coherent_handle >> 16) >> 16); - writel(cdb_phyaddr, ®->msgcode_rwbuffer[5]); - writel(cdb_phyaddr_hi32, ®->msgcode_rwbuffer[6]); + writel(lower_32_bits(acb->dma_coherent_handle2), ®->msgcode_rwbuffer[5]); + writel(upper_32_bits(acb->dma_coherent_handle2), ®->msgcode_rwbuffer[6]); writel(acb->ioqueue_size, ®->msgcode_rwbuffer[7]); writel(ARCMSR_INBOUND_MESG0_SET_CONFIG, ®->inbound_msgaddr0); acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; @@ -4081,11 +4078,8 @@ static int arcmsr_iop_confirm(struct AdapterControlBlock *acb) acb->msgcode_rwbuffer[2] = cdb_phyaddr; acb->msgcode_rwbuffer[3] = cdb_phyaddr_hi32; acb->msgcode_rwbuffer[4] = acb->ccbsize; - dma_coherent_handle = acb->dma_coherent_handle2; - cdb_phyaddr = (uint32_t)dma_coherent_handle; - cdb_phyaddr_hi32 = (uint32_t)(dma_coherent_handle >> 32); - acb->msgcode_rwbuffer[5] = cdb_phyaddr; - acb->msgcode_rwbuffer[6] = cdb_phyaddr_hi32; + acb->msgcode_rwbuffer[5] = lower_32_bits(acb->dma_coherent_handle2); + acb->msgcode_rwbuffer[6] = upper_32_bits(acb->dma_coherent_handle2); acb->msgcode_rwbuffer[7] = acb->completeQ_size; writel(ARCMSR_INBOUND_MESG0_SET_CONFIG, ®->inbound_msgaddr0); acb->out_doorbell ^= ARCMSR_HBEMU_DRV2IOP_MESSAGE_CMD_DONE; From patchwork Wed Oct 7 04:42:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ching Huang X-Patchwork-Id: 11819767 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0182513B2 for ; Wed, 7 Oct 2020 04:42:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D74B0208C7 for ; Wed, 7 Oct 2020 04:42:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=areca-com-tw.20150623.gappssmtp.com header.i=@areca-com-tw.20150623.gappssmtp.com header.b="r9QQJRGq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726385AbgJGEmH (ORCPT ); Wed, 7 Oct 2020 00:42:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbgJGEmH (ORCPT ); Wed, 7 Oct 2020 00:42:07 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED33AC061755 for ; Tue, 6 Oct 2020 21:42:06 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id u3so421039pjr.3 for ; Tue, 06 Oct 2020 21:42:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=areca-com-tw.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:mime-version :content-transfer-encoding; bh=6hV7PJClGfgaN5TCcjKdtC8dZqi0TjTnFZSL7SHtRuk=; b=r9QQJRGq2UX+dSVZL/fR3XmybvGJIgZzq0FLrJJ43YYy9IyqxVh7NDKehe8vsJshLL bVlWcgA9MWs7Ep9oflUaDlzuzyar89lgCjHOH7gICwNEOSfwM2urzubwnhNbTeUa2FJf m7h1/DkQ9rbdZ9vnaSop6DoIl/W/IyBWjsq99cyX8wTeTCioqhMERSAD6y6XLLM5GXcM PvIh+KZUo2ZDb2N2gj71YiTPfWOmCLjDWwo5fBOK0kJN2N2pWoyH56WVN8uWw+7fYNBq NVjz8V55KeB1D4SLLBcxmOD8loAvzHtLQbx3prf9GDJgGtPwpkGhCApoyi4nneCklcJS jWkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:mime-version :content-transfer-encoding; bh=6hV7PJClGfgaN5TCcjKdtC8dZqi0TjTnFZSL7SHtRuk=; b=RRpJWzQz/CibB2r6et23khiGLebhVDLiX9WamFOeNMEUCQcUB9wrCPbam7zgu0+Go2 EERjVIeKgpK6L3po3oERkM7pUNpCW6NaYPrFb6krSvYA21w6fTPEUmIWaqT7PVUaQiNF +kfJwo95nG68VL0esMbydwIlWO76UGDTQZcB0EqSfKbq46HNB1m6AEjhygz4I1kalyT+ AEjn6M2meNGKCkI+LtwlrCsr8hh4oX2sXa2m/yRSxiOLDWhc4J4g6Dzf9a61B92GoZBI eW5ibl54LqWKhx/IlIubUQZsaIdi52vzcGdcb/KXyHzwv4NePqjlVR6Wp06j749R8jh+ LiVw== X-Gm-Message-State: AOAM530vuw/7YhWmZwEAySuXD8ZHUwWvheJBpccoTqMQIFI4A1pXig9a 1iAhBRjR1nROvJmgzp0n7t2MKw== X-Google-Smtp-Source: ABdhPJwaS+EmWu2efvslIkfhHgsUztVkk5DjTz6MyWALnWp0y67KQavW2S159oKbzBZHFo8LLal8QQ== X-Received: by 2002:a17:902:ee01:b029:d1:8c50:aa89 with SMTP id z1-20020a170902ee01b02900d18c50aa89mr1354147plb.6.1602045726343; Tue, 06 Oct 2020 21:42:06 -0700 (PDT) Received: from centos78 (60-248-88-209.HINET-IP.hinet.net. [60.248.88.209]) by smtp.gmail.com with ESMTPSA id gd14sm647305pjb.31.2020.10.06.21.42.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Oct 2020 21:42:05 -0700 (PDT) Message-ID: <9b02f544d1c5d4a90da268ba063f1ffe4ac098ca.camel@areca.com.tw> Subject: [PATCH v2 2/2] scsi: arcmsr: use round_up() instead of logical operation From: ching Huang To: martin.petersen@oracle.com, James.Bottomley@HansenPartnership.com, linux-scsi@vger.kernel.org, Linux Kernel Mailing List Date: Wed, 07 Oct 2020 12:42:05 +0800 X-Mailer: Evolution 3.28.5 (3.28.5-8.el7) Mime-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: ching Huang Use round_up() instead of logical operation. Reported-by: Martin K. Petersen Signed-off-by: ching Huang diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index 55d85c9..1e358d9 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c @@ -644,13 +644,12 @@ static void arcmsr_hbaF_assign_regAddr(struct AdapterControlBlock *acb) struct MessageUnit_F __iomem *pmuF; memset(acb->dma_coherent2, 0xff, acb->completeQ_size); - acb->message_wbuffer = (uint32_t *)((((unsigned long)acb->dma_coherent2 + - acb->completeQ_size + 3) >> 2) << 2); + acb->message_wbuffer = (uint32_t *)round_up((unsigned long)acb->dma_coherent2 + + acb->completeQ_size, 4); acb->message_rbuffer = ((void *)acb->message_wbuffer) + 0x100; acb->msgcode_rwbuffer = ((void *)acb->message_wbuffer) + 0x200; memset((void *)acb->message_wbuffer, 0, MESG_RW_BUFFER_SIZE); - host_buffer_dma = ((acb->dma_coherent_handle2 + acb->completeQ_size + - 3) >> 2) << 2; + host_buffer_dma = round_up(acb->dma_coherent_handle2 + acb->completeQ_size, 4); pmuF = acb->pmuF; /* host buffer low address, bit0:1 all buffer active */ writel(lower_32_bits(host_buffer_dma | 1), &pmuF->inbound_msgaddr0);