From patchwork Thu Aug 25 04:45:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9298669 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 C705B60CF5 for ; Thu, 25 Aug 2016 04:55:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2649291C5 for ; Thu, 25 Aug 2016 04:55:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A74A4291CC; Thu, 25 Aug 2016 04:55:57 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 4D4F5291C9 for ; Thu, 25 Aug 2016 04:55:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754880AbcHYEzk (ORCPT ); Thu, 25 Aug 2016 00:55:40 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36697 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753521AbcHYExR (ORCPT ); Thu, 25 Aug 2016 00:53:17 -0400 Received: by mail-wm0-f65.google.com with SMTP id i138so5622933wmf.3 for ; Wed, 24 Aug 2016 21:53:16 -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=7vrATJ0XPboDX72AoGJRCW/oP9mklLgcWovECCBe3Sc=; b=npPS7Tmg6M6FYkcwV5xlc9WwYtrmvVo2n39RvTLlBWUxFcIIuo+yzta+rrRA7jz9Qh wEYkX8/oR945qDDIQi9+CLybSCrNuf04P041caHHRJVTEQjd6uFXNy1tA9WcwEReuiEr lXzZtQhKaMbhfrfogCT/rLGOCtdFf8s+hrX4A/upO214hDxl9ZafkUV7hlnzRsm2M0kq 4S7ge3F1WZc3G2oCqkpdb8o+eiuF/JB7LgS21dRkzqBiERIFXUe193J0ukJbE2pJGSyI 3VYa+wpzgejXQD9z8l5t+debV9In14GSw+u5rUR8r1eLQ2jWovc4NQF0GPvncfr6lQov 0zuA== 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=7vrATJ0XPboDX72AoGJRCW/oP9mklLgcWovECCBe3Sc=; b=RBkB2FnC7L3bep4GFbPgBx/vh5TH5mywRf4In2z8wwqzvMXito2SmCEq36w8T6bjty vWoezysYRrW8INsapKBCeI82fMCECUUg0px17s/10krPAgoYjgOguY3k0jFHZKrdyWhH oreEgzLlM5WyU437jTgkWciM4kXdF9+s7ZosobUiqZl92mGgd/o6IpOuGiMjnjFkD4cv vtka9psS28SyWgq6HoNXxbbgXJXonCJJKOZ6irEDqxhnqY8HATScYf00Xrre6x1zVGJ7 Q1s8NfA/CSz/mA26BWJUEmqMLtHDUmPGHeAx0/b/J9w+tnEOwCRVCWV5SjtWRCw7rUeF eBxQ== X-Gm-Message-State: AEkoout9xqDcY2eGVe9/Gux7ycJUL3/IHwTjIFQpcKHEziNxB1z8MnsAteq4Eal8YIeoMQ== X-Received: by 10.194.161.70 with SMTP id xq6mr6230214wjb.189.1472100795942; Wed, 24 Aug 2016 21:53:15 -0700 (PDT) Received: from ?IPv6:2003:62:5f43:9500:dd82:2805:e44f:720e? (p200300625F439500DD822805E44F720E.dip0.t-ipconnect.de. [2003:62:5f43:9500:dd82:2805:e44f:720e]) by smtp.googlemail.com with ESMTPSA id pm1sm13076797wjb.40.2016.08.24.21.53.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Aug 2016 21:53:15 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH 07/23] spi: fsl-espi: remove unneeded variable in fsl_espi_do_trans To: Mark Brown References: Cc: "linux-spi@vger.kernel.org" Message-ID: <683bca81-4522-78d7-338f-0e1a137f4f4f@gmail.com> Date: Thu, 25 Aug 2016 06:45:55 +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 Creating a message, adding one transfer, and then iterating over all transfers in the message doesn't make sense. We can simply use the original transfer directly. Signed-off-by: Heiner Kallweit --- drivers/spi/spi-fsl-espi.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index b3c3612..494a7bf 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -256,11 +256,9 @@ static void fsl_espi_do_trans(struct spi_message *m, struct spi_device *spi = m->spi; struct mpc8xxx_spi *mspi = spi_master_get_devdata(spi->master); struct fsl_espi_transfer *espi_trans = tr; - struct spi_message message; struct spi_transfer *t, *first, trans; int status = 0; - spi_message_init(&message); memset(&trans, 0, sizeof(trans)); first = list_first_entry(&m->transfers, struct spi_transfer, @@ -282,23 +280,18 @@ static void fsl_espi_do_trans(struct spi_message *m, trans.len = espi_trans->len; trans.tx_buf = espi_trans->tx_buf; trans.rx_buf = espi_trans->rx_buf; - spi_message_add_tail(&trans, &message); - list_for_each_entry(t, &message.transfers, transfer_list) { - if (t->bits_per_word || t->speed_hz) - fsl_espi_setup_transfer(spi, t); + if (trans.bits_per_word || trans.speed_hz) + fsl_espi_setup_transfer(spi, &trans); - if (t->len) - status = fsl_espi_bufs(spi, t); + if (trans.len) + status = fsl_espi_bufs(spi, &trans); - if (status) { - status = -EMSGSIZE; - break; - } + if (status) + status = -EMSGSIZE; - if (t->delay_usecs) - udelay(t->delay_usecs); - } + if (trans.delay_usecs) + udelay(trans.delay_usecs); espi_trans->status = status; fsl_espi_setup_transfer(spi, NULL);