From patchwork Mon Dec 21 11:52:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sperl X-Patchwork-Id: 7895471 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 17613BEEE5 for ; Mon, 21 Dec 2015 11:53:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 846EF20457 for ; Mon, 21 Dec 2015 11:53:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 951F32045B for ; Mon, 21 Dec 2015 11:53:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751874AbbLULxB (ORCPT ); Mon, 21 Dec 2015 06:53:01 -0500 Received: from 212-186-180-163.dynamic.surfer.at ([212.186.180.163]:40071 "EHLO cgate.sperl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752126AbbLULxA (ORCPT ); Mon, 21 Dec 2015 06:53:00 -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 6390322; Mon, 21 Dec 2015 11:52:57 +0000 From: kernel@martin.sperl.org To: Mark Brown , linux-spi@vger.kernel.org Cc: Martin Sperl Subject: [PATCH v2 2/8] spi: loopback-test: write rx pattern also when running without tx_buf Date: Mon, 21 Dec 2015 11:52:44 +0000 Message-Id: <1450698772-2379-2-git-send-email-kernel@martin.sperl.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1450698772-2379-1-git-send-email-kernel@martin.sperl.org> References: <1450698772-2379-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 Currently the rx_buf does not get set with the SPI_TEST_PATTERN_UNWRITTEN when tx_buf == NULL in the transfer. Reorder code so that it gets done also under this specific condition. Signed-off-by: Martin Sperl --- drivers/spi/spi-loopback-test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c index 7f497ac..8af2e40 100644 --- a/drivers/spi/spi-loopback-test.c +++ b/drivers/spi/spi-loopback-test.c @@ -591,6 +591,10 @@ static int spi_test_fill_tx(struct spi_device *spi, struct spi_test *test) /* fill all transfers with the pattern requested */ for (i = 0; i < test->transfer_count; i++) { + /* fill rx_buf with SPI_TEST_PATTERN_UNWRITTEN */ + if (xfers[i].rx_buf) + memset(xfers[i].rx_buf, SPI_TEST_PATTERN_UNWRITTEN, + xfers[i].len); /* if tx_buf is NULL then skip */ tx_buf = (u8 *)xfers[i].tx_buf; if (!tx_buf) @@ -648,10 +652,6 @@ static int spi_test_fill_tx(struct spi_device *spi, struct spi_test *test) return -EINVAL; } } - /* fill rx_buf with SPI_TEST_PATTERN_UNWRITTEN */ - if (xfers[i].rx_buf) - memset(xfers[i].rx_buf, SPI_TEST_PATTERN_UNWRITTEN, - xfers[i].len); } return 0;