Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Finn Thain <fthain@telegraphics.com.au>
To: zhong jiang <zhongjiang@huawei.com>
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
Date: Fri, 3 Aug 2018 12:24:07 +1000 (AEST)	[thread overview]
Message-ID: <alpine.LNX.2.21.1808031156350.16@nippy.intranet> (raw)
In-Reply-To: <1533179408-20631-1-git-send-email-zhongjiang@huawei.com>

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 <zhongjiang@huawei.com>
> ---
>  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);
> 

  parent reply	other threads:[~2018-08-03  2:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-02  3:10 [PATCH] scsi:NCR5380: remove same check condition in NCR5380_select zhong jiang
2018-08-02  3:26 ` Bart Van Assche
2018-08-02  3:45   ` zhong jiang
2018-08-02  7:32     ` Michael Schmitz
2018-08-03  2:56       ` Finn Thain
2018-08-03  4:19         ` Michael Schmitz
2018-08-03  6:04           ` Finn Thain
2018-08-03  2:24 ` Finn Thain [this message]
2018-08-03  9:10   ` Andy Shevchenko
2018-08-03  9:52     ` Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LNX.2.21.1808031156350.16@nippy.intranet \
    --to=fthain@telegraphics.com.au \
    --cc=andy.shevchenko@gmail.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=john.garry@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=schmitzmic@gmail.com \
    --cc=zhongjiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox