From patchwork Sun Sep 4 08:02:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9312433 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 B4EAC600CA for ; Sun, 4 Sep 2016 08:08:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6F38287DA for ; Sun, 4 Sep 2016 08:08:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BF3828925; Sun, 4 Sep 2016 08:08:12 +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 3B193287DA for ; Sun, 4 Sep 2016 08:08:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752472AbcIDIIH (ORCPT ); Sun, 4 Sep 2016 04:08:07 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35482 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752106AbcIDIHr (ORCPT ); Sun, 4 Sep 2016 04:07:47 -0400 Received: by mail-wm0-f67.google.com with SMTP id c133so8695829wmd.2 for ; Sun, 04 Sep 2016 01:07:46 -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=oKUR+lVLzSm4Q7NRlCWP36uQzXf4Mcx1oOap6u0fXEY=; b=GWDst76bc0dFmNpxr/Awx+VlBDznsoleGVi80CFJf+0fAVI8jthQi3aQPawy5ROkc+ cfNmFZ3Zv+As2Y+X/q6U5NJ12A4rX7KLKIaKpQ+C/JZH0tLsdvpEZ52Z1TpVMXtOUJig XSfai3EyUcPaFeIU7oWeu5mQ2+V0CKLE7eHRshlg7uyGmbsnWX/uLTyzexNhWfZnO0Y7 TlHwCLeQih6i4OLBr1irsfn7ktDv/olFvR4x4RDaHzTHocRzGJhu2U9HjtvqQH3aE1xz 9mBjdqKXnIIFsQ+HknHjQKE3lG4SeQz0fjAz5k/I7JBIcVsSLk2cQUs7LrneGs0aOxyP 6oHQ== 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=oKUR+lVLzSm4Q7NRlCWP36uQzXf4Mcx1oOap6u0fXEY=; b=MEAiyET5eQewKINHfrt1QXkTPe2cNOYfXlK0s+wirgxKvOnPpTGN4vtBfz8VWE94Ag CN1Si9r1oMQIjS1fPeLHKJQT/bRGRfQbpi/oS9kxkGzG9dvaMcF6wocgdQAEjFtdTHxT pKWO2E0u53kMiknMpbenl6BbTjsM3dk+SbBKqJk5SkCd+XTvKKmYUTDG1QsPID6BJ7/p zw/63SAc7Mu85z4ESqJGGn78MiXKfGpgsCY6LbXSzTu5SVySMFhg6m079DNuA2CpdehI XQ+MSBReSHhHvBPEZgVwN1K9TZqCE234H/2ndTFbxu/7mTFjS5JOB270MzvWzf4/icGl WfUA== X-Gm-Message-State: AE9vXwNLOK5ircCD5BmgYlmE1bjgi7UHnWjzH8TlIO+iIMh+a0WdtFGmysPw2cnvSruP0g== X-Received: by 10.194.243.8 with SMTP id wu8mr25614798wjc.178.1472976465646; Sun, 04 Sep 2016 01:07:45 -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 r4sm19855269wjs.13.2016.09.04.01.07.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Sep 2016 01:07:45 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH v2 18/18] spi: fsl-espi: merge fsl_espi_trans and fsl_espi_do_trans To: Mark Brown References: Cc: "linux-spi@vger.kernel.org" Message-ID: <7fdc7bc0-873a-b750-edcd-627a0b0012e6@gmail.com> Date: Sun, 4 Sep 2016 10:02:47 +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 Merge both functions to reduce source code size and improve readability. Signed-off-by: Heiner Kallweit --- v2: - rebased --- drivers/spi/spi-fsl-espi.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index 84355bb..f7d682f 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -276,11 +276,13 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t) return mpc8xxx_spi->count > 0 ? -EMSGSIZE : 0; } -static int fsl_espi_do_trans(struct spi_message *m, struct spi_transfer *trans) +static int fsl_espi_trans(struct spi_message *m, struct spi_transfer *trans) { + struct mpc8xxx_spi *mspi = spi_master_get_devdata(m->spi->master); struct spi_device *spi = m->spi; - int ret = 0; + int ret; + fsl_espi_copy_to_buf(m, mspi); fsl_espi_setup_transfer(spi, trans); ret = fsl_espi_bufs(spi, trans); @@ -290,18 +292,6 @@ static int fsl_espi_do_trans(struct spi_message *m, struct spi_transfer *trans) fsl_espi_setup_transfer(spi, NULL); - return ret; -} - -static int fsl_espi_trans(struct spi_message *m, struct spi_transfer *trans) -{ - struct mpc8xxx_spi *mspi = spi_master_get_devdata(m->spi->master); - int ret; - - fsl_espi_copy_to_buf(m, mspi); - - ret = fsl_espi_do_trans(m, trans); - if (!ret) fsl_espi_copy_from_buf(m, mspi);