From patchwork Sun Sep 4 07:59:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9312415 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 0CE23600CA for ; Sun, 4 Sep 2016 08:07:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3508287DA for ; Sun, 4 Sep 2016 08:07:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7E8B288F0; Sun, 4 Sep 2016 08:07:40 +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=-4.4 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 85B61287DA for ; Sun, 4 Sep 2016 08:07:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752226AbcIDIHi (ORCPT ); Sun, 4 Sep 2016 04:07:38 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33893 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752082AbcIDIHe (ORCPT ); Sun, 4 Sep 2016 04:07:34 -0400 Received: by mail-wm0-f67.google.com with SMTP id v143so8664397wmv.1 for ; Sun, 04 Sep 2016 01:07:33 -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=YpLM7slL79ezUCTM1cfXrY3jtRO3ySBNDNmXi0Vyp2C0+0EiRCpdIPiVx8pLzFXicJ Rc8zJroR+NQblbPPqP1sc27HGn5ZfHokXJ74h1xrV7v8ZBSe3lrg+J878f2RYC4RLCIc vLNkhjix/ywVP5TiqImxL03qNxUF0z9w3SWSBlziFdfTxxZfbRLaalC7UuCUf+U5nKBZ xOhCh40F+d4kzlUDvON6gJQDy5e0AI/FHIaQDYpSePF1xH1dhv25SqbdPh9R21MqYGW0 EXVvNmiWjuW4QYCTYQfKSz/eP3yRNrqcml6uB4VDK8jLYc+Mq+zOtnvMTqG3dTjfImT8 7Irw== 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=N+9opFFHcovhAGR9Mv0M9xA/YrQ8+oSQuFJ1fIpvYHoUG2XQJETkC+Q5Y0Yor52dGw 7hy1Ni9d2WO8mVCkeLnidZTL8/Kb/i8XZZwi6gob2Xw7unuVkwTbvDEJKLPEwLBlPDyj hOWA+BlH0cBPV9M6E7z4lOTINB4C/FPma073KM5W++0RLp+jhraZWkh2GkyGw4SnNZ36 kwH2hAgZlMAm8U4lYv3/kPhrscBniPOsXhtFaxCUtXbTx6lIbnxnCV+M+fNTXTG4sPGB 0piSecZrde+u7lJjVWirwlx/KF6+EzVtURb4TwG3E9NBC2GUaSGmYqK+q9kLDzYfKV1d XODQ== X-Gm-Message-State: AE9vXwNuVjigXv9h9a+lZ8iXcAEjXJGtwQjEQKPoZhN+yAeSHQLqMPCXFE9n6VFu3n+mjQ== X-Received: by 10.194.173.35 with SMTP id bh3mr25480394wjc.86.1472976453023; Sun, 04 Sep 2016 01:07:33 -0700 (PDT) Received: from ?IPv6:2003:62:5f43:9500:c1f5:c528:a3d:f8c4? (p200300625F439500C1F5C5280A3DF8C4.dip0.t-ipconnect.de. [2003:62:5f43:9500:c1f5:c528:a3d:f8c4]) by smtp.googlemail.com with ESMTPSA id n7sm7422596wjs.34.2016.09.04.01.07.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Sep 2016 01:07:32 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH v2 08/18] spi: fsl-espi: remove element actual_length from struct fsl_espi_trans To: Mark Brown References: Cc: "linux-spi@vger.kernel.org" Message-ID: <67c8d6d6-322e-65e0-b78d-bbb8354353c9@gmail.com> Date: Sun, 4 Sep 2016 09:59:41 +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;