From patchwork Tue Sep 13 21:15:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9329965 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 3FE2C6077F for ; Tue, 13 Sep 2016 21:16:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FED929785 for ; Tue, 13 Sep 2016 21:16:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 242F1297AC; Tue, 13 Sep 2016 21:16:53 +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.3 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 BF95F29785 for ; Tue, 13 Sep 2016 21:16:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751547AbcIMVQw (ORCPT ); Tue, 13 Sep 2016 17:16:52 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36767 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750940AbcIMVQv (ORCPT ); Tue, 13 Sep 2016 17:16:51 -0400 Received: by mail-wm0-f66.google.com with SMTP id b184so290924wma.3 for ; Tue, 13 Sep 2016 14:16:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=UgLj95xlBqEBdyb7FWddA4Mv2vAPoSExBcOmOJIkMn0=; b=vExHCSOcx6ddeNQDCK7l1QUgVkylMjYJikCLtnZjcM5z64pU95WxHu66fj3sg76S5R CUqZONBrP8YtI/irl0u7ICcdPxLcqVtcBtkZmOKESSIoUIwCJ0W2PqFypw4J6HYuXlpv lIg5xHfT6RBu4QpyC9pTPoU065RFEdUr8USJEHTduzda08+ZEvnOp4NZxJB2G1tBTYvs VwkN/Me8S6c/lEsjVunUB5iPK9P0QEyx226iIWkgvLIvW605DlF9bN4IC++JcEH3M6Ub LkZxxZMEwMb8uRvfJWMKmGmz8AHtVoxTgjqYcgnAJuagzfYSPiPQrcB5EQ1LnqKCpQYN /Jzw== 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:cc:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=UgLj95xlBqEBdyb7FWddA4Mv2vAPoSExBcOmOJIkMn0=; b=b3cSXpl6EtC5Eu7GEdTS1R4G8RfLP5o0n4TdswJTuGgvzWlWtVmkhe6u4JNjKkBOzW xnBaWkDdIpbkH8LCJG7yxcKogIjBb+yWxlwxdIKA+Kjhpr1BmgeXtcA3DhGACYOUL91g YvTRq+jRPmiu6ufkfdTwxYY5h5uiGErbcJDLSLzsf+VQS1v0zbR16yB2zt/2r/TlGqwT W00aHoQZi8r7c+momnNLvX338FvFxPQiuH2WiJbvHY5cOuSvkkavBWSNuKRynxdsDsJa tSovr9+4WekNfY4JEn7DkEJQzNdUZv00fFyvcW1bvEOVq4LViQ+tDj8BrW9vZRyzAaBh ug6w== X-Gm-Message-State: AE9vXwO4XoUhN6/HmAC5iRTWoz3cK7kFS2yiFU3w4RJSmo5azhZc0jvoJdSFUZoVkyJ9bg== X-Received: by 10.194.43.98 with SMTP id v2mr23979156wjl.46.1473801409973; Tue, 13 Sep 2016 14:16:49 -0700 (PDT) Received: from ?IPv6:2003:62:5f43:9500:1103:9781:fa4d:e4fc? (p200300625F43950011039781FA4DE4FC.dip0.t-ipconnect.de. [2003:62:5f43:9500:1103:9781:fa4d:e4fc]) by smtp.googlemail.com with ESMTPSA id gr7sm704401wjc.1.2016.09.13.14.16.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Sep 2016 14:16:49 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH 1/4] spi: fsl-espi: simplify fsl_espi_setup_transfer To: Mark Brown Cc: "linux-spi@vger.kernel.org" Message-ID: Date: Tue, 13 Sep 2016 23:15:45 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 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 t is not null then the SPI core takes care that bits_per_word and speed_hz are populated. This allows to simplify fsl_espi_setup_transfer. Signed-off-by: Heiner Kallweit --- drivers/spi/spi-fsl-espi.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index bef0676..060624f 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -176,23 +176,11 @@ static void fsl_espi_setup_transfer(struct spi_device *spi, struct spi_transfer *t) { struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); - int bits_per_word = 0; + int bits_per_word = t ? t->bits_per_word : spi->bits_per_word; + u32 hz = t ? t->speed_hz : spi->max_speed_hz; u8 pm; - u32 hz = 0; struct spi_mpc8xxx_cs *cs = spi->controller_state; - if (t) { - bits_per_word = t->bits_per_word; - hz = t->speed_hz; - } - - /* spi_transfer level calls that work per-word */ - if (!bits_per_word) - bits_per_word = spi->bits_per_word; - - if (!hz) - hz = spi->max_speed_hz; - cs->rx_shift = 0; cs->tx_shift = 0; cs->get_rx = mpc8xxx_spi_rx_buf_u32;