From patchwork Fri Sep 2 21:22:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9311683 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E406960772 for ; Fri, 2 Sep 2016 21:22:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3CF72983D for ; Fri, 2 Sep 2016 21:22:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C89BB29848; Fri, 2 Sep 2016 21:22:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7773C2983D for ; Fri, 2 Sep 2016 21:22:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751615AbcIBVW7 (ORCPT ); Fri, 2 Sep 2016 17:22:59 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35408 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751190AbcIBVW6 (ORCPT ); Fri, 2 Sep 2016 17:22:58 -0400 Received: by mail-wm0-f67.google.com with SMTP id c133so4382983wmd.2 for ; Fri, 02 Sep 2016 14:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=w0tHYNmKhCLv7hdXSsUYe7h1/q2iKKbvhciUXzrTHf8=; b=AxoXSwFCofZpzqp4MkNMj9cceqa8vFVVuCyJpnMIDE07GpxLplZOqgJ3cAEQrsIUWK cngs1uQD6VOhgAhnYjeu2qWBOM5oC57pgRe8ciQ1qMC4qJIYRwD0u++42AudCvV0+2+C lmCdzlAMqoMxSmg4dFP6KwLOlufkaxeuyzeiYoqth+kvFSjpNGf6Pij9E+aBjhCYN3YW 4zImvtLURi7V0Zs/FfgFIpIoKjHbi3x2rKA32pH/ZnNsu+I5JfjVfqv2pHT9bPZUY3pZ 9XYFwUIrCtTNRheR7lDUmXcMBswvpqbnpW152BjrwKl8B/smEVQTaIAQp+YJEwSZ5++K gsKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=w0tHYNmKhCLv7hdXSsUYe7h1/q2iKKbvhciUXzrTHf8=; b=WMRCWgGtUelVIIyKsSDx1QK52giiwFX/gkBTxoDtzkn2VzfsXrvY2N8TUqUuxIGt21 HcWvp5SwOe+Nd6Mu6qYd5CDtvkoaCfeeWhbSumh4OAWeVtqI8t9Qprn3ZOY9CqKYX86v 2Miz7pCredbH5FqYbQrTvFSB1gAi+rCMPOjIpBsBgNWZ7sPDyK3XrTCgEa5w1xaJW6a3 8SciQSaN7ersRMAx9wl6r83TnTQZdfJFwOXYudZGdMhGxF3OE2CTP0I16YzRkVbVm2bu sE8QT2K4m+yGljxhXAxKBOTmMjEaYXovM78tV31wkmfC1/3GOP26ufjEHMT1dDfYbL4A Irhg== X-Gm-Message-State: AE9vXwMuOBY8ePR1OLfqLFZ8sfiK9F/gGvL7q1elzhnHABMbyGjkIMuMJAJ5ni92FST6Mw== X-Received: by 10.28.226.67 with SMTP id z64mr5251912wmg.85.1472851376914; Fri, 02 Sep 2016 14:22:56 -0700 (PDT) Received: from ?IPv6:2003:62:5f43:9500:39ed:a1fb:9a43:e02d? (p200300625F43950039EDA1FB9A43E02D.dip0.t-ipconnect.de. [2003:62:5f43:9500:39ed:a1fb:9a43:e02d]) by smtp.googlemail.com with ESMTPSA id c139sm5401252wme.4.2016.09.02.14.22.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Sep 2016 14:22:56 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH v2 13/23] spi: fsl-espi: remove element actual_length from struct fsl_espi_trans To: Mark Brown References: Cc: "linux-spi@vger.kernel.org" Message-ID: Date: Fri, 2 Sep 2016 23:22:17 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If an error occurs during processing the message, then we don't have to populate the actual_length element of struct message. So we can get rid of element actual_length in struct fsl_espi_transfer. Signed-off-by: Heiner Kallweit --- v2: - rebased --- drivers/spi/spi-fsl-espi.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index 6b60f7b..726d5fd 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -41,7 +41,6 @@ struct fsl_espi_transfer { const void *tx_buf; void *rx_buf; unsigned len; - unsigned actual_length; }; /* eSPI Controller mode register definitions */ @@ -327,8 +326,6 @@ static int fsl_espi_cmd_trans(struct spi_message *m, espi_trans->rx_buf = mspi->local_buf; ret = fsl_espi_do_trans(m, espi_trans); - espi_trans->actual_length = espi_trans->len; - return ret; } @@ -350,7 +347,6 @@ static int fsl_espi_rw_trans(struct spi_message *m, if (trans->len > tx_only) memcpy(rx_buff, trans->rx_buf + tx_only, trans->len - tx_only); - trans->actual_length += trans->len; } return ret; @@ -373,14 +369,14 @@ static int fsl_espi_do_one_msg(struct spi_master *master, } espi_trans.len = xfer_len; - espi_trans.actual_length = 0; if (!rx_buf) ret = fsl_espi_cmd_trans(m, &espi_trans, NULL); else ret = fsl_espi_rw_trans(m, &espi_trans, rx_buf); - m->actual_length = espi_trans.actual_length; + m->actual_length = ret ? 0 : espi_trans.len; + if (m->status == -EINPROGRESS) m->status = ret;