From patchwork Wed Sep 7 20:51:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9319905 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 BFB68607D3 for ; Wed, 7 Sep 2016 20:55:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADFD129425 for ; Wed, 7 Sep 2016 20:55:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A308D29428; Wed, 7 Sep 2016 20:55:44 +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 9575B29425 for ; Wed, 7 Sep 2016 20:55:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755083AbcIGUzn (ORCPT ); Wed, 7 Sep 2016 16:55:43 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36349 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751810AbcIGUzm (ORCPT ); Wed, 7 Sep 2016 16:55:42 -0400 Received: by mail-wm0-f66.google.com with SMTP id l65so4840450wmf.3 for ; Wed, 07 Sep 2016 13:55:42 -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=pxNNhqW0V81+6qirguw+kJawUR32SBXd2OZS/gTC6v8=; b=t3KNWUPNZPl/OPzSS+jxRQiaT2hZ9iTFqcdMnxGsOlTULYoAUlpnzJ6ephMPMvrxE/ kEnTmt/i/C0ixdI7OT6X0I1hxyCI+uhrty4oSWzmlo9WQqdwUT+AybINM2YRRtEf6BK7 u+sktEILPVy1wlB+AUNKTp791qtNmV25ltnTv168bBekEVDit3A42g5+zOkYjyguCWZr sG1mHJjASM1WWpuuZgyO8PKCmRtx0TkZZ3CQsa3kELnov2Lgmq584+AaNDyQYxcOr8YE riXrsE+sy/mUbRrHePDg6mHZh4m0WnMIxGw8D5VJqv0vX2sqYOSls4gT5JZopW/zJ76q NFDQ== 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=pxNNhqW0V81+6qirguw+kJawUR32SBXd2OZS/gTC6v8=; b=Sy07EjuhDEejG5Tqsk06w18BAkmW6nrl4wrn/xeEpVWXM5Yy6x1EHiMjHbiJYeZIUF yngsDK/LESu0MOpfHmZMx3g7W1xIMyvcS0gJfvopterY2wnU3sRzLk6NPqeaQ1VTB2rk A68s2mG+enS6S7AEmVwpNNxjbuqWSVbXvfVKbcbVZLrZK/R2tcaoVbW0yNvsQnDUtDln ZVjNOSMCKFzr0cMP2/ny7IEB8bHh6J2E9o+Kobh8yZVgONKG9gl19onaJ6towkCk7QHt MehIVG7aiol0GyMpwQD0iEPvfRTlrTyltiHjcpkwkag3xS+UD3kHa7/c3BJkeDn+fwVi ug8g== X-Gm-Message-State: AE9vXwNdNkP89JPHhcMN5tlnkCczE1w4qjLmxAH6g6L3S6y4moT0yDf7JxBS2xNJUHZDww== X-Received: by 10.194.113.41 with SMTP id iv9mr49038422wjb.97.1473281741110; Wed, 07 Sep 2016 13:55:41 -0700 (PDT) Received: from ?IPv6:2003:62:5f43:9500:6565:4488:ad4:60db? (p200300625F439500656544880AD460DB.dip0.t-ipconnect.de. [2003:62:5f43:9500:6565:4488:ad4:60db]) by smtp.googlemail.com with ESMTPSA id w203sm6023273wmw.7.2016.09.07.13.55.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Sep 2016 13:55:40 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH v3 05/15] spi: fsl-espi: remove element actual_length from struct fsl_espi_trans To: Mark Brown References: Cc: "linux-spi@vger.kernel.org" Message-ID: <52f1d7a5-d0d5-2734-3977-715347047587@gmail.com> Date: Wed, 7 Sep 2016 22:51:48 +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 v3: - new numbering --- 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;