lkml.org 
[lkml]   [2020]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/5] spi: bcm-qspi: Improve debug reading SPI data
Date
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
\
 
 \ /
  Last update: 2020-06-15 06:06    [W:0.120 / U:0.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site