Re: [PATCH] scsi:NCR5380: remove same check condition in NCR5380_select

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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);
> 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux