aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Sperl <kernel@martin.sperl.org>2015-12-22 13:03:25 -0500
committerMark Brown <broonie@kernel.org>2016-01-05 14:12:47 -0500
commit1e8db97f0e5205c0f6fd20c9a4f38cd871bc467f (patch)
treeef874780b11d5bf3816338791a3566b9db2bdfd7
parent339ec3ce54e5c7137287dc807555ae69934b2d2a (diff)
spi: loopback-test: spi_check_rx_ranges can get always done
The spi_check_rx_ranges can always get executed independent of if we have a real loopback situation. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-loopback-test.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c
index 81fa9068df43..7f79a77c4b68 100644
--- a/drivers/spi/spi-loopback-test.c
+++ b/drivers/spi/spi-loopback-test.c
@@ -489,7 +489,18 @@ static int spi_test_check_loopback_result(struct spi_device *spi,
489 struct spi_transfer *xfer; 489 struct spi_transfer *xfer;
490 u8 rxb, txb; 490 u8 rxb, txb;
491 size_t i; 491 size_t i;
492 int ret;
493
494 /* checks rx_buffer pattern are valid with loopback or without */
495 ret = spi_check_rx_ranges(spi, msg, rx);
496 if (ret)
497 return ret;
492 498
499 /* if we run without loopback, then return now */
500 if (!loopback)
501 return 0;
502
503 /* if applicable to transfer check that rx_buf is equal to tx_buf */
493 list_for_each_entry(xfer, &msg->transfers, transfer_list) { 504 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
494 /* if there is no rx, then no check is needed */ 505 /* if there is no rx, then no check is needed */
495 if (!xfer->rx_buf) 506 if (!xfer->rx_buf)
@@ -521,7 +532,7 @@ static int spi_test_check_loopback_result(struct spi_device *spi,
521 } 532 }
522 } 533 }
523 534
524 return spi_check_rx_ranges(spi, msg, rx); 535 return 0;
525 536
526mismatch_error: 537mismatch_error:
527 dev_err(&spi->dev, 538 dev_err(&spi->dev,
@@ -847,10 +858,8 @@ int spi_test_execute_msg(struct spi_device *spi, struct spi_test *test,
847 goto exit; 858 goto exit;
848 } 859 }
849 860
850 /* run rx-tests when in loopback mode */ 861 /* run rx-buffer tests */
851 if (loopback) 862 ret = spi_test_check_loopback_result(spi, msg, tx, rx);
852 ret = spi_test_check_loopback_result(spi, msg,
853 tx, rx);
854 } 863 }
855 864
856 /* if requested or on error dump message (including data) */ 865 /* if requested or on error dump message (including data) */