linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
To: broonie@kernel.org, kdasu.kdev@gmail.com
Cc: linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
	Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
Subject: [PATCH 2/5] spi: bcm-qspi: Improve debug reading SPI data
Date: Mon, 15 Jun 2020 16:05:54 +1200	[thread overview]
Message-ID: <20200615040557.2011-3-mark.tomlinson@alliedtelesis.co.nz> (raw)
In-Reply-To: <20200615040557.2011-1-mark.tomlinson@alliedtelesis.co.nz>

This patch prevents device debug when data is not read from hardware
(i.e. when there is no receive buffer).

Reviewed-by: Callum Sinclair <callum.sinclair@alliedtelesis.co.nz>
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
---
 drivers/spi/spi-bcm-qspi.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/spi/spi-bcm-qspi.c b/drivers/spi/spi-bcm-qspi.c
index 8fc5b9b3757b..92e04d24359f 100644
--- a/drivers/spi/spi-bcm-qspi.c
+++ b/drivers/spi/spi-bcm-qspi.c
@@ -749,21 +749,22 @@ static void read_from_hw(struct bcm_qspi *qspi, int slots)
 	tp = qspi->trans_pos;
 
 	for (slot = 0; slot < slots; slot++) {
-		if (tp.trans->bits_per_word <= 8) {
-			u8 *buf = tp.trans->rx_buf;
-
-			if (buf)
-				buf[tp.byte] = read_rxram_slot_u8(qspi, slot);
-			dev_dbg(&qspi->pdev->dev, "RD %02x\n",
-				buf ? buf[tp.byte] : 0x0);
-		} else {
-			u16 *buf = tp.trans->rx_buf;
-
-			if (buf)
-				buf[tp.byte / 2] = read_rxram_slot_u16(qspi,
-								      slot);
-			dev_dbg(&qspi->pdev->dev, "RD %04x\n",
-				buf ? buf[tp.byte / 2] : 0x0);
+		if (tp.trans->rx_buf) {
+			if (tp.trans->bits_per_word <= 8) {
+				u8 *buf = tp.trans->rx_buf;
+
+				buf[tp.byte] =
+					read_rxram_slot_u8(qspi, slot);
+				dev_dbg(&qspi->pdev->dev, "RD %02x\n",
+					buf[tp.byte]);
+			} else {
+				u16 *buf = tp.trans->rx_buf;
+
+				buf[tp.byte / 2] =
+					read_rxram_slot_u16(qspi, slot);
+				dev_dbg(&qspi->pdev->dev, "RD %04x\n",
+					buf[tp.byte / 2]);
+			}
 		}
 
 		update_qspi_trans_byte_count(qspi, &tp,
-- 
2.27.0


  parent reply	other threads:[~2020-06-15  4:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15  4:05 [PATCH 0/5] Improvements to spi-bcm-qspi Mark Tomlinson
2020-06-15  4:05 ` [PATCH 1/5] spi: bcm-qspi: Add support for setting BSPI clock Mark Tomlinson
2020-06-15  4:05 ` Mark Tomlinson [this message]
2020-06-15  4:05 ` [PATCH 3/5] spi: bcm-qspi: Do not split transfers into small chunks Mark Tomlinson
2020-06-15 13:31   ` Mark Brown
2020-06-15  4:05 ` [PATCH 4/5] spi: bcm-qspi: Make multiple data blocks interrupt-driven Mark Tomlinson
2020-06-15 14:32   ` Mark Brown
2020-06-16  3:07     ` Mark Tomlinson
2020-06-16  8:26       ` Mark Brown
2020-06-15  4:05 ` [PATCH 5/5] spi: bcm-qspi: Improve interrupt handling Mark Tomlinson
2020-06-15 19:05 ` [PATCH 0/5] Improvements to spi-bcm-qspi Kamal Dasu

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=20200615040557.2011-3-mark.tomlinson@alliedtelesis.co.nz \
    --to=mark.tomlinson@alliedtelesis.co.nz \
    --cc=broonie@kernel.org \
    --cc=kdasu.kdev@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).