From patchwork Thu Aug 25 04:52:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9298659 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 3F7E560B16 for ; Thu, 25 Aug 2016 04:55:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 304D0291C0 for ; Thu, 25 Aug 2016 04:55:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2516B291C9; Thu, 25 Aug 2016 04:55:35 +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 A2361291C8 for ; Thu, 25 Aug 2016 04:55:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754944AbcHYEyl (ORCPT ); Thu, 25 Aug 2016 00:54:41 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34123 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754739AbcHYExi (ORCPT ); Thu, 25 Aug 2016 00:53:38 -0400 Received: by mail-wm0-f66.google.com with SMTP id q128so5639340wma.1 for ; Wed, 24 Aug 2016 21:53:38 -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=/g7WpnoK0t9tPReVX38xewIrO1KCpKl9Yeych3odZ6E=; b=GiSp9Tf7IMoL8HFWD/eUiVSmKttxSLpwscVnBkgb9kqIWxwnjeCT/REfWg/qmKkqsh NlWmTsSqdqvUC2u+RuroEIxmpXWwb2+TSL52Ddg7frqIidkeUbUq96LXI6ZAy76W8/RV SItrgDnZ3RAeztGUhMI3ib0sHqqHlQReNOwQumgCF5BP+ixPXKwgOZ6zyMBFpU5/1uHv GXtfHsD/YjC77XLWqaPIWWdVDXzYQeYKstaNHDpwaCbK27C/tcjL99+/Ne80c+ba2oIV GYSzRlfjwjn/ab7C/0hFVqhNTCu1xwHf9YOOkIOuePzeOHHdoGQ3jNvMOwo3+AEkCRGi BjzQ== 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=/g7WpnoK0t9tPReVX38xewIrO1KCpKl9Yeych3odZ6E=; b=TuiYK5t9+CLRR9cexusrNRVgXf/MEgSBg1h0oDaExvatJEe00nZGQ7U9Nrx6FLDxg/ 2RNcfpGmbjZ8k64vdDDO/vQSCg2g7ld7R4oEO2cjkh2sL4MpB5cMBG4Rpa8Gu2qz5IXy GsIWMm3LbLf7V/VmkcHKbsF5vUKkUNBVBAz7vktPXFh2dCI/7pDOPE8CDhk9Ssmlf38n tX9grvczS/NwOx3wDWaBLCMC/v6JZ7JGaZSKEwL0JEvcceKYgn6f690nJ3SvwvVhH+kR cnDhmD/G9xtXYoGRtUzs2ke/3lZJWQjA2yckB2SLxuyLW0zivMZxyBCenX2W1TtvwKZh rfiw== X-Gm-Message-State: AEkoouuW+Jv0SDCCbHzEMwn66Vm68b/zSXqJ8cFn7b4EHkN+NWua0FVfAuZbOVMuIMr7aQ== X-Received: by 10.194.142.78 with SMTP id ru14mr5360337wjb.41.1472100817504; Wed, 24 Aug 2016 21:53:37 -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 ex14sm13115593wjc.30.2016.08.24.21.53.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Aug 2016 21:53:37 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH 23/23] spi: fsl-espi: merge fsl_espi_trans and fsl_espi_do_trans To: Mark Brown References: Cc: "linux-spi@vger.kernel.org" Message-ID: Date: Thu, 25 Aug 2016 06:52:52 +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 --- 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 51b0213..caedabd 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);