diff options
author | Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com> | 2022-02-07 07:45:12 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-02-08 12:45:42 +0300 |
commit | a2882e5ea3497b7cb6318ddeaf539b6a2da8d61e (patch) | |
tree | a9a1d1c3eadec94eb75b5cfc23d19bac164cc5bf /drivers/staging/pi433 | |
parent | 1b6a6147374eb37f652cd0a4e5b121ef8077c4d3 (diff) | |
download | linux-a2882e5ea3497b7cb6318ddeaf539b6a2da8d61e.tar.xz |
staging: pi433: remove need to recompile code to debug fifo content
Debugging content present in the FIFO register is tricky as when we read
the FIFO register that changes the content of fifo struct which reduces
number of possible ways of debugging it. Rf69 uC has the possibility of
triggering certain IRQs depending on how many items are in the FIFO
queue, so being able to know what's in there is an important way to
troubleshoot certain problems.
This patch removes the requirement of having to compile pi433 driver
with DEBUG_FIFO_ACCESS set and let that be driven by printk verbositity
level and/or dynamic debug config instead.
Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
Link: https://lore.kernel.org/r/YgCj2P59AbFFmnbA@mail.google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/pi433')
-rw-r--r-- | drivers/staging/pi433/rf69.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c index a8def70808d6..901f8db3e3ce 100644 --- a/drivers/staging/pi433/rf69.c +++ b/drivers/staging/pi433/rf69.c @@ -6,11 +6,6 @@ * Marcus Wolf <linux@wolf-entwicklungen.de> */ -/* enable prosa debug info */ -#undef DEBUG -/* enable print of values on fifo access */ -#undef DEBUG_FIFO_ACCESS - #include <linux/types.h> #include <linux/spi/spi.h> @@ -829,9 +824,7 @@ int rf69_set_dagc(struct spi_device *spi, enum dagc dagc) int rf69_read_fifo(struct spi_device *spi, u8 *buffer, unsigned int size) { -#ifdef DEBUG_FIFO_ACCESS int i; -#endif struct spi_transfer transfer; u8 local_buffer[FIFO_SIZE + 1]; int retval; @@ -851,10 +844,9 @@ int rf69_read_fifo(struct spi_device *spi, u8 *buffer, unsigned int size) retval = spi_sync_transfer(spi, &transfer, 1); -#ifdef DEBUG_FIFO_ACCESS + /* print content read from fifo for debugging purposes */ for (i = 0; i < size; i++) dev_dbg(&spi->dev, "%d - 0x%x\n", i, local_buffer[i + 1]); -#endif memcpy(buffer, &local_buffer[1], size); @@ -863,9 +855,7 @@ int rf69_read_fifo(struct spi_device *spi, u8 *buffer, unsigned int size) int rf69_write_fifo(struct spi_device *spi, u8 *buffer, unsigned int size) { -#ifdef DEBUG_FIFO_ACCESS int i; -#endif u8 local_buffer[FIFO_SIZE + 1]; if (size > FIFO_SIZE) { @@ -877,10 +867,9 @@ int rf69_write_fifo(struct spi_device *spi, u8 *buffer, unsigned int size) local_buffer[0] = REG_FIFO | WRITE_BIT; memcpy(&local_buffer[1], buffer, size); -#ifdef DEBUG_FIFO_ACCESS + /* print content written from fifo for debugging purposes */ for (i = 0; i < size; i++) dev_dbg(&spi->dev, "0x%x\n", buffer[i]); -#endif return spi_write(spi, local_buffer, size + 1); } |