Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp67663imm; Thu, 2 Aug 2018 23:05:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcw1MVkXUX92Bc+Bi7K+5Iz/OAzRlePUeW/+WY3XryGBV1uJDes96/GzWaWaoIqnktb72om X-Received: by 2002:a63:ad07:: with SMTP id g7-v6mr2289049pgf.19.1533276316641; Thu, 02 Aug 2018 23:05:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533276316; cv=none; d=google.com; s=arc-20160816; b=zZALIi1y+dUcAzMY3nkXEpEI+mSsMsZRC2pXLsStV5f5OmhRyjD4mgBRUvXOZwvpuD 7Glt3JfPDYUIwh43FpGU3nFqSBEkxlTOkvI+Y1goO/f3eKW+GYXbTM9pmYal3brojCKA NNi97JTzEFZDPiwSHFU9azdXnENbsKthjYBrZQeJFwCaYQp4nCRRinTftukDxXf+PO/J DjzW2/vZ1B/XbX8wdfOHby4rBk7HMIsbIwEpRNXZyRqOKDVAMRV/mFg4ZALaiwi/QNCY nXbBuLZcuCAkIPX4S+kXwQ7zi/cpCgtgnJDiB8fLeyxuGe/YHGdj7fB9g1opIysbYIqD gnOg== 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=85Jkqxxt6jEc9SDu8/tbW6vLzRLys3KsgpMjYhX8Q3Y=; b=qWOfJfsWhLAn8On4IF3YbVJ+b8EReTL7pj36YcLRpLzEp3Js/edabUDFTKD4pwch/k 2pJ82O51imsmyGEsCp0xL1Q9UbCpN6dNALfRM7XPUCYq+29Iio8AdMQreY7fLBuVkNdy Y1zTOR2/4vH75cqs95i00vxKfqV51D7waR4Gw8KgpP1JkEtx3g/jKN76XuU8YNU+GEDI 8prtdNcEBpOYKLGF07PG3Kb+N0sCLHYfkjPGFpN7gM33G6uy4b+P9/l4UPPepnSMa41m Ei9A8rADH+7SFtVxxmiOEtUi7p6o9p0ttsoNVABHq25bV+DDIdzUrBxVlNp35EDV/Nxr BDGA== 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 y2-v6si4546875pff.117.2018.08.02.23.04.59; Thu, 02 Aug 2018 23:05:16 -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 S1727532AbeHCH6t (ORCPT + 99 others); Fri, 3 Aug 2018 03:58:49 -0400 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:44862 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726792AbeHCH6s (ORCPT ); Fri, 3 Aug 2018 03:58:48 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id 22AA923B10; Fri, 3 Aug 2018 02:04:04 -0400 (EDT) Date: Fri, 3 Aug 2018 16:04:33 +1000 (AEST) From: Finn Thain To: Michael Schmitz cc: zhong jiang , Bart Van Assche , "jejb@linux.vnet.ibm.com" , "martin.petersen@oracle.com" , "andy.shevchenko@gmail.com" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "john.garry@huawei.com" Subject: Re: [PATCH] scsi:NCR5380: remove same check condition in NCR5380_select In-Reply-To: <6e28be9a-b601-17e2-4a04-9635925e5958@gmail.com> Message-ID: References: <1533179408-20631-1-git-send-email-zhongjiang@huawei.com> <5B627E71.5020600@huawei.com> <928ae07a-8c4a-05fc-16af-48fb6e9c341d@gmail.com> <6e28be9a-b601-17e2-4a04-9635925e5958@gmail.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 Fri, 3 Aug 2018, Michael Schmitz wrote: > > > Finn - does the ICR_ARBITRATION_LOST bit have to be cleared by a > > > write to the mode register? > > > > > > > Something like that: the write to the mode register does clear the > > ICR_ARBITRATION_LOST bit, because it clears the MR_ARBITRATE bit. > > Yes, but is that the only way the bit can get cleared? [...] Short of a reset, yes. > > > > In that case, the first load would have been redundant and can be > > > omitted without changing driver behaviour? > > > > This code is a faithful rendition of the arbitration flow chart in the > > datasheet, so even if you are right, I wouldn't want to change the > > code. > > I think that's a pretty clear hint that the 'arbitration lost' condition > isn't latched. [...] It's not a hint. It's just an algorithm with fewer assumptions than the one you proposed. As for latching, the datasheet is pretty clear on that. Writing MR_BASE to the mode register clears the ICR_ARBITRATION_LOST bit. As in, 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_write(MODE_REG, MR_BASE); --