Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp431320pxa; Tue, 11 Aug 2020 06:43:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgJRMux4COJ59wa0Oah6RlM1LG7oB9744Qbw3Xckp4MUjFM7Yjl6bGLnjQlCxVnoxKUNQf X-Received: by 2002:aa7:d85a:: with SMTP id f26mr26262190eds.363.1597153419509; Tue, 11 Aug 2020 06:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597153419; cv=none; d=google.com; s=arc-20160816; b=UfgcplMtt1URPJLXAvHgLEBPdGn03O67gJyZzHrH7LwKS1ZhufLumhuRwkE2eCl9Eh nOpGar38GXTHRC16OW/yX853s6fRt3NrJuM9cDAjr7w9/e2tJhRkhwmdrYXbqCoQ53c/ 2y95Fneuijgus8utrPaYD9X0udv24V+b0aWrdqSTQgGAFKKEgH7VsXT+L2wQXcZcTMW7 iqnfKLRsJjMVcW0vZgc94FGEIaIzdPoPDzUPzjcFCl1tMm1zmuMEzdlZz2yfwIWPlaIW WbJzP2Fykq3RahXNPKkP2bADEPbKJLtLXeWcYY4kcAkRjpEShi6zsgGxLoQGABzgwdZx hgfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:references:in-reply-to :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=y/CBQAM6l76DmbpNp2KwONcx8fbyqymWwXJX5To34gw=; b=HlF9Pp4PgYft31KnEsOHIGY4YmNboCOofARC8qoKtwdDVE3Gly8nRN7FoqCiBBZsWM uo02G1oKUQow1W9tzOeHJjSp6BbYLxZaUzTaNdEr8CGfewY785RrbztYx/kMlw1lEk8m Hb3pBNqu6QTSesVYYFB7DI78+Slgq/3kTKiyi0zeIyynjlnQ3qe+AJIyjTVcgT6WFu3q qwPtfaBjXjq6O7fS8mKFeXjJKnYp7CS751KLXqiAjpwv8tBd2TqXMiIlV6NmEu6Pd98c fRllZuBoL7xofcDwME4spJmlV4MlLrq5Xqjg26FioOf4KW/kuHyUtUKpnTjgFRYEO7lq iTiw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w1si12191771eds.83.2020.08.11.06.43.13; Tue, 11 Aug 2020 06:43:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728721AbgHKNkL (ORCPT + 99 others); Tue, 11 Aug 2020 09:40:11 -0400 Received: from mga06.intel.com ([134.134.136.31]:31275 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728711AbgHKNkJ (ORCPT ); Tue, 11 Aug 2020 09:40:09 -0400 IronPort-SDR: Z2rpHaFsmBDBoeYACsj9zQxIEhYyCJTKnjYryehezXl9d3daOl2NjYB6VGGxxzrGHimwkaK3af 6x2bU1t+l5vg== X-IronPort-AV: E=McAfee;i="6000,8403,9709"; a="215248839" X-IronPort-AV: E=Sophos;i="5.75,461,1589266800"; d="scan'208";a="215248839" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2020 06:40:08 -0700 IronPort-SDR: yfqtbKQ6JwmZuDuGCtEaD1bqDMOZXASaxrLsE/mZCTfHivpULO2XmN905o74ood1AQr5nbDpS+ 3yix4T5mwemA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,461,1589266800"; d="scan'208";a="334576499" Received: from ahunter-desktop.fi.intel.com ([10.237.72.73]) by orsmga007.jf.intel.com with ESMTP; 11 Aug 2020 06:40:06 -0700 From: Adrian Hunter To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Alim Akhtar , Avri Altman , Venkat Gopalakrishnan , Can Guo Subject: [PATCH V2 2/2] scsi: ufs: Improve interrupt handling for shared interrupts Date: Tue, 11 Aug 2020 16:39:36 +0300 Message-Id: <20200811133936.19171-2-adrian.hunter@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200811133936.19171-1-adrian.hunter@intel.com> References: <20200811133936.19171-1-adrian.hunter@intel.com> Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For shared interrupts, the interrupt status might be zero, so check that first. Signed-off-by: Adrian Hunter --- drivers/scsi/ufs/ufshcd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index bb2543010af9..c315420e69e8 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -5969,7 +5969,7 @@ static irqreturn_t ufshcd_sl_intr(struct ufs_hba *hba, u32 intr_status) */ static irqreturn_t ufshcd_intr(int irq, void *__hba) { - u32 intr_status, enabled_intr_status; + u32 intr_status, enabled_intr_status = 0; irqreturn_t retval = IRQ_NONE; struct ufs_hba *hba = __hba; int retries = hba->nutrs; @@ -5983,7 +5983,7 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba) * read, make sure we handle them by checking the interrupt status * again in a loop until we process all of the reqs before returning. */ - do { + while (intr_status && retries--) { enabled_intr_status = intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE); if (intr_status) @@ -5992,7 +5992,7 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba) retval |= ufshcd_sl_intr(hba, enabled_intr_status); intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); - } while (intr_status && --retries); + } if (enabled_intr_status && retval == IRQ_NONE) { dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x\n", -- 2.17.1