Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1245834ybl; Fri, 23 Aug 2019 16:06:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpL9OaAV6kLhRMa8YeMBY4FRmCzTulqaGKiWmEuEmVHVnoSveZm+kCs/CP7iij56B5b5fO X-Received: by 2002:a17:90a:8914:: with SMTP id u20mr3290883pjn.111.1566601594750; Fri, 23 Aug 2019 16:06:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566601594; cv=none; d=google.com; s=arc-20160816; b=d8TB3Je5k4HEidydQo5p2KvkXnByK8NnHmRLRoINXhWZveUCIU827ojfWWMuY0vx9E VWVzyRd0DEayXWfFWVHPh1tavxafVXiwJzw4q9MJpUSxZAeIwZHZlDZsN0u0e3NQeS3K R14+yxVzDHZ8AQUB42F6At0TX2n9uw0T4GSDyp7Ej9WgB9EHG5lDVLvnKBX1Zi1vZe/Q PoEIz6ZYFCJHNEDCyN8fyRY3v1qW+pWsIsE7Ckkn+0F185ZPTIi5EKZdU9D6DuqsLc9r QvbDV8OMUcmTRbMgCPZm3+e+7ntZOgVPP2TEiJ7qKg1vLcTGppKdSEnwx4YkmX2EFppK YV+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature; bh=81XkYAt1dlSIAEhjcYLBf1Q8HHzaz4ERhe2Y36L5NpU=; b=b6XwUbs80muOKz8/bq2KL1QGas0377PVd0Hqwtx5wsFgnzrHkc2DBxphitJKddwS3P UZfonaCSET6gL3SjssUvewgvOZp3LyM2rE6u7YsrFKjyu5mse2uoZ4oh1fy9gNOZ/XGn wVU7gfT+U4UrSWObz83nMeP4eN8GKVpRBd7rbph+sUOs18DK7gmwFP6quGBRviorwGJp qnHQmfOJQh7it+v7hJ/mc4eLoP61tmw0A1KJBVvN/duZAUzzgtHDbbTE74l+a7Guj3nH ZoaRi3N+TuTNo649wNaWheANu6gjc8YWq7SgTPbAuS9D+nkf/NuS/OzxKpr14hhP/gMK U1zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=HA+ZvtLm; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u190si3987775pfb.189.2019.08.23.16.06.19; Fri, 23 Aug 2019 16:06:34 -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; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=HA+ZvtLm; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404967AbfHWLCs (ORCPT + 99 others); Fri, 23 Aug 2019 07:02:48 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:56462 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403857AbfHWLCa (ORCPT ); Fri, 23 Aug 2019 07:02:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=81XkYAt1dlSIAEhjcYLBf1Q8HHzaz4ERhe2Y36L5NpU=; b=HA+ZvtLmbC5b 2CMe30cWTu+37mZVf6jhdYOzE/2v5+oiRnQoFhWodGW8rGsjKQM9A/8S92CVLkHc1ha893mE5y4UP 5oeHZngsl8rpdmKOH1pqStlzux82HGoKqS27JxA9eygefyRGX84QfBQAFaRUaKY8ZY8uapEp3UjxI SN0fg=; Received: from [92.54.175.117] (helo=fitzroy.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1i17Kt-0002wH-IE; Fri, 23 Aug 2019 11:02:27 +0000 Received: by fitzroy.sirena.org.uk (Postfix, from userid 1000) id 4885AD02CD3; Fri, 23 Aug 2019 12:02:27 +0100 (BST) From: Mark Brown To: Vladimir Oltean Cc: broonie@kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, Mark Brown , netdev@vger.kernel.org Subject: Applied "spi: spi-fsl-dspi: Reduce indentation level in dspi_interrupt" to the spi tree In-Reply-To: <20190822211514.19288-2-olteanv@gmail.com> X-Patchwork-Hint: ignore Message-Id: <20190823110227.4885AD02CD3@fitzroy.sirena.org.uk> Date: Fri, 23 Aug 2019 12:02:27 +0100 (BST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch spi: spi-fsl-dspi: Reduce indentation level in dspi_interrupt has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.4 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 12fb61a973935c63f2580b3b053017cc14b51f42 Mon Sep 17 00:00:00 2001 From: Vladimir Oltean Date: Fri, 23 Aug 2019 00:15:10 +0300 Subject: [PATCH] spi: spi-fsl-dspi: Reduce indentation level in dspi_interrupt If the entire function depends on the SPI status register having the interrupt bits asserted, then just check it and exit early if those bits aren't set (such as in the case of the shared IRQ being triggered for the other peripheral). Cosmetic patch. Signed-off-by: Vladimir Oltean Link: https://lore.kernel.org/r/20190822211514.19288-2-olteanv@gmail.com Signed-off-by: Mark Brown --- drivers/spi/spi-fsl-dspi.c | 79 +++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 790cb02fc181..c90db7db4121 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -658,47 +658,48 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id) regmap_read(dspi->regmap, SPI_SR, &spi_sr); regmap_write(dspi->regmap, SPI_SR, spi_sr); + if (!(spi_sr & (SPI_SR_EOQF | SPI_SR_TCFQF))) + return IRQ_HANDLED; + + /* Get transfer counter (in number of SPI transfers). It was + * reset to 0 when transfer(s) were started. + */ + regmap_read(dspi->regmap, SPI_TCR, &spi_tcr); + spi_tcnt = SPI_TCR_GET_TCNT(spi_tcr); + /* Update total number of bytes that were transferred */ + msg->actual_length += spi_tcnt * dspi->bytes_per_word; + + trans_mode = dspi->devtype_data->trans_mode; + switch (trans_mode) { + case DSPI_EOQ_MODE: + dspi_eoq_read(dspi); + break; + case DSPI_TCFQ_MODE: + dspi_tcfq_read(dspi); + break; + default: + dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n", + trans_mode); + return IRQ_HANDLED; + } - if (spi_sr & (SPI_SR_EOQF | SPI_SR_TCFQF)) { - /* Get transfer counter (in number of SPI transfers). It was - * reset to 0 when transfer(s) were started. - */ - regmap_read(dspi->regmap, SPI_TCR, &spi_tcr); - spi_tcnt = SPI_TCR_GET_TCNT(spi_tcr); - /* Update total number of bytes that were transferred */ - msg->actual_length += spi_tcnt * dspi->bytes_per_word; - - trans_mode = dspi->devtype_data->trans_mode; - switch (trans_mode) { - case DSPI_EOQ_MODE: - dspi_eoq_read(dspi); - break; - case DSPI_TCFQ_MODE: - dspi_tcfq_read(dspi); - break; - default: - dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n", - trans_mode); - return IRQ_HANDLED; - } + if (!dspi->len) { + dspi->waitflags = 1; + wake_up_interruptible(&dspi->waitq); + return IRQ_HANDLED; + } - if (!dspi->len) { - dspi->waitflags = 1; - wake_up_interruptible(&dspi->waitq); - } else { - switch (trans_mode) { - case DSPI_EOQ_MODE: - dspi_eoq_write(dspi); - break; - case DSPI_TCFQ_MODE: - dspi_tcfq_write(dspi); - break; - default: - dev_err(&dspi->pdev->dev, - "unsupported trans_mode %u\n", - trans_mode); - } - } + switch (trans_mode) { + case DSPI_EOQ_MODE: + dspi_eoq_write(dspi); + break; + case DSPI_TCFQ_MODE: + dspi_tcfq_write(dspi); + break; + default: + dev_err(&dspi->pdev->dev, + "unsupported trans_mode %u\n", + trans_mode); } return IRQ_HANDLED; -- 2.20.1