Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp295501imm; Thu, 2 Aug 2018 19:25:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfbUu1mJyIDcIADrf2lkZAHtb1yWvgTXe1huyRJvAIJWMfw4q0QSMU5g7+WaCk9RwSEx1GJ X-Received: by 2002:a62:229a:: with SMTP id p26-v6mr2178296pfj.53.1533263138074; Thu, 02 Aug 2018 19:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533263138; cv=none; d=google.com; s=arc-20160816; b=AvOgpCAHxta5oXGpeHx0edWo54f/qh4ISqqsnaLgo5XkfrD5ZUFANayh8Vbb8rbBf1 VvbH3Vo2ktktpNYUiPkB3LNTgHB+jhsc7jNui4uc1wHe5lh7z7NieLXVcfZdomJGW/As tfwqQbDL+070jRqffBfIJlGsRVxVyjk+z19vSiluYHNMB2QD6+ZhZSbpouBKA890s5Lh o2XWjVydHyFFj2/PvwRpJem7LNlAg6IjzIi90isNm6QFL+yI6lRyH0RacZIsgmiDVKB4 kDprOxpaVW0w3rWGk5qYxoS4j4lXJSchl/Qe1iOiXq2GfhkaKu6e5xhJHHoS3hJY1xid Ku2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date:arc-authentication-results; bh=Z0LcTejlCy/NeQiLEhuwwXV/pGkJuyNlb/fenDKv3+s=; b=09gr9mAJp8XkLs2eKAifYIxDjgTheuXMVn/Fa9zZVAhqN2S8Pd1Sp6/OS0tiQ+7Els qyJyzMcNE3LYZZ05uTMf/INwC7s6NF5ex/Mn5yD0UGvAWnqglK7ZEcpCzgiZMJCdu9+f j78ZO+V0L0XQQ6YKY3AEY7efMePEN2bFIBRLdKu/7Uljgq0MruToURz9ABmu4XmlUUwL 5mSPceB4F4lWdzP0CZy8o+U6Xj4BHNh+UUUg11MgYBlAWi+6bndRMuO/x6sZb3l/bFFv dc1NTtyEzbQwUcY8mD3hGmazY6sOQMG+GdfR5NK1I4eiIN4A11ACWfezeRBl5jn693O7 hkIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j17-v6si3825293pgk.517.2018.08.02.19.25.11; Thu, 02 Aug 2018 19:25:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726472AbeHCERj (ORCPT + 99 others); Fri, 3 Aug 2018 00:17:39 -0400 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:57348 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725736AbeHCERj (ORCPT ); Fri, 3 Aug 2018 00:17:39 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id 5728C27D51; Thu, 2 Aug 2018 22:23:38 -0400 (EDT) Date: Fri, 3 Aug 2018 12:24:07 +1000 (AEST) From: Finn Thain To: zhong jiang cc: schmitzmic@gmail.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, andy.shevchenko@gmail.com, john.garry@huawei.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] scsi:NCR5380: remove same check condition in NCR5380_select In-Reply-To: <1533179408-20631-1-git-send-email-zhongjiang@huawei.com> Message-ID: References: <1533179408-20631-1-git-send-email-zhongjiang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2 Aug 2018, zhong jiang wrote: > The same check condition is redundant, so remove one of them. > If you are trying to find redundant code, your coccinelle script is dangerously flawed. You need to realize that NCR5380_read(CURRENT_SCSI_DATA_REG) is not simply a value in a CPU register or a device register, but it is the actual state of the scsi bus data lines, which are subject to change any time, at the whim of the firmwares in all of the SCSI bus devices participating in arbitration at the time, or of a user who might kick a plug etc. From the datasheet: The SCSI data lines are not actually registered, but gated directly onto the CPU bus whenever Address 000 is read by the CPU... Hence, NAK. -- > Signed-off-by: zhong jiang > --- > drivers/scsi/NCR5380.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c > index 90ea0f5..2ecaf3f 100644 > --- a/drivers/scsi/NCR5380.c > +++ b/drivers/scsi/NCR5380.c > @@ -999,8 +999,7 @@ static struct scsi_cmnd *NCR5380_select(struct Scsi_Host *instance, > > /* Check for lost arbitration */ > if ((NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST) || > - (NCR5380_read(CURRENT_SCSI_DATA_REG) & hostdata->id_higher_mask) || > - (NCR5380_read(INITIATOR_COMMAND_REG) & ICR_ARBITRATION_LOST)) { > + (NCR5380_read(CURRENT_SCSI_DATA_REG) & hostdata->id_higher_mask)) { > NCR5380_write(MODE_REG, MR_BASE); > dsprintk(NDEBUG_ARBITRATION, instance, "lost arbitration, deasserting MR_ARBITRATE\n"); > spin_lock_irq(&hostdata->lock); >