From patchwork Tue Dec 22 18:03:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sperl X-Patchwork-Id: 7906221 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 166E7BEEE5 for ; Tue, 22 Dec 2015 18:03:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5149B2054A for ; Tue, 22 Dec 2015 18:03:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7050320561 for ; Tue, 22 Dec 2015 18:03:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755034AbbLVSDn (ORCPT ); Tue, 22 Dec 2015 13:03:43 -0500 Received: from 212-186-180-163.dynamic.surfer.at ([212.186.180.163]:40208 "EHLO cgate.sperl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754622AbbLVSDm (ORCPT ); Tue, 22 Dec 2015 13:03:42 -0500 Received: from raspcm.intern.sperl.org (account martin@sperl.org [10.10.10.41] verified) by sperl.org (CommuniGate Pro SMTP 6.1.2) with ESMTPSA id 6390438; Tue, 22 Dec 2015 18:03:34 +0000 From: kernel@martin.sperl.org To: Mark Brown , linux-spi@vger.kernel.org Cc: Martin Sperl Subject: [PATCH v3 5/8] spi: loopback-test: spi_check_rx_ranges can get always done Date: Tue, 22 Dec 2015 18:03:25 +0000 Message-Id: <1450807408-2422-6-git-send-email-kernel@martin.sperl.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1450807408-2422-1-git-send-email-kernel@martin.sperl.org> References: <1450807408-2422-1-git-send-email-kernel@martin.sperl.org> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Martin Sperl The spi_check_rx_ranges can always get executed independent of if we have a real loopback situation. Signed-off-by: Martin Sperl --- drivers/spi/spi-loopback-test.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c index 75cea07..c26ffa1 100644 --- a/drivers/spi/spi-loopback-test.c +++ b/drivers/spi/spi-loopback-test.c @@ -441,7 +441,18 @@ static int spi_test_check_loopback_result(struct spi_device *spi, struct spi_transfer *xfer; u8 rxb, txb; size_t i; + int ret; + + /* checks rx_buffer pattern are valid with loopback or without */ + ret = spi_check_rx_ranges(spi, msg, rx); + if (ret) + return ret; + /* if we run without loopback, then return now */ + if (!loopback) + return 0; + + /* if applicable to transfer check that rx_buf is equal to tx_buf */ list_for_each_entry(xfer, &msg->transfers, transfer_list) { /* if there is no rx, then no check is needed */ if (!xfer->rx_buf) @@ -473,7 +484,7 @@ static int spi_test_check_loopback_result(struct spi_device *spi, } } - return spi_check_rx_ranges(spi, msg, rx); + return 0; mismatch_error: dev_err(&spi->dev, @@ -806,10 +817,8 @@ int spi_test_execute_msg(struct spi_device *spi, struct spi_test *test, goto exit; } - /* run rx-tests when in loopback mode */ - if (loopback) - ret = spi_test_check_loopback_result(spi, msg, - tx, rx); + /* run rx-buffer tests */ + ret = spi_test_check_loopback_result(spi, msg, tx, rx); } /* if requested or on error dump message (including data) */