From patchwork Tue Sep 15 13:26:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Nikula X-Patchwork-Id: 7184991 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C974FBEEC1 for ; Tue, 15 Sep 2015 13:27:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E665F206E2 for ; Tue, 15 Sep 2015 13:27:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2041F206DD for ; Tue, 15 Sep 2015 13:27:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752560AbbION10 (ORCPT ); Tue, 15 Sep 2015 09:27:26 -0400 Received: from mga03.intel.com ([134.134.136.65]:14746 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752546AbbION1Z (ORCPT ); Tue, 15 Sep 2015 09:27:25 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 15 Sep 2015 06:27:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,536,1437462000"; d="scan'208";a="804826617" Received: from mylly.fi.intel.com (HELO mylly.fi.intel.com.) ([10.237.72.68]) by orsmga002.jf.intel.com with ESMTP; 15 Sep 2015 06:27:14 -0700 From: Jarkko Nikula To: linux-spi@vger.kernel.org Cc: Mark Brown , Nicolas Ferre , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Kukjin Kim , Krzysztof Kozlowski , Jarkko Nikula Subject: [PATCH 15/16] spi: pxa2xx: Remove if statement that is always true in pump_transfers() Date: Tue, 15 Sep 2015 16:26:27 +0300 Message-Id: <1442323588-29642-15-git-send-email-jarkko.nikula@linux.intel.com> X-Mailer: git-send-email 2.5.1 In-Reply-To: <1442323588-29642-1-git-send-email-jarkko.nikula@linux.intel.com> References: <1442323588-29642-1-git-send-email-jarkko.nikula@linux.intel.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is continuation to previous commit by separating unindentation from variable removal done in previous commit. As said SPI core have validated both the speed_hz and bits_per_word and the if statement here evaluates always to true. Remove the test and unindent the code block accordingly. While at it remove also needless "cr0 = chip->cr0" as cr0 will be overwritten anyway and fix block comment style. Signed-off-by: Jarkko Nikula --- drivers/spi/spi-pxa2xx.c | 76 +++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 40862f589277..3948e6deb0f1 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -922,47 +922,45 @@ static void pump_transfers(unsigned long data) drv_data->read = drv_data->rx ? chip->read : null_reader; /* Change speed and bit per word on a per transfer */ - cr0 = chip->cr0; - if (transfer->speed_hz || transfer->bits_per_word) { - - bits = transfer->bits_per_word; - speed = transfer->speed_hz; - - clk_div = pxa2xx_ssp_get_clk_div(drv_data, chip, speed); - - if (bits <= 8) { - drv_data->n_bytes = 1; - drv_data->read = drv_data->read != null_reader ? - u8_reader : null_reader; - drv_data->write = drv_data->write != null_writer ? - u8_writer : null_writer; - } else if (bits <= 16) { - drv_data->n_bytes = 2; - drv_data->read = drv_data->read != null_reader ? - u16_reader : null_reader; - drv_data->write = drv_data->write != null_writer ? - u16_writer : null_writer; - } else if (bits <= 32) { - drv_data->n_bytes = 4; - drv_data->read = drv_data->read != null_reader ? - u32_reader : null_reader; - drv_data->write = drv_data->write != null_writer ? - u32_writer : null_writer; - } - /* if bits/word is changed in dma mode, then must check the - * thresholds and burst also */ - if (chip->enable_dma) { - if (pxa2xx_spi_set_dma_burst_and_threshold(chip, - message->spi, - bits, &dma_burst, - &dma_thresh)) - dev_warn_ratelimited(&message->spi->dev, - "pump_transfers: DMA burst size reduced to match bits_per_word\n"); - } - - cr0 = pxa2xx_configure_sscr0(drv_data, clk_div, bits); + bits = transfer->bits_per_word; + speed = transfer->speed_hz; + + clk_div = pxa2xx_ssp_get_clk_div(drv_data, chip, speed); + + if (bits <= 8) { + drv_data->n_bytes = 1; + drv_data->read = drv_data->read != null_reader ? + u8_reader : null_reader; + drv_data->write = drv_data->write != null_writer ? + u8_writer : null_writer; + } else if (bits <= 16) { + drv_data->n_bytes = 2; + drv_data->read = drv_data->read != null_reader ? + u16_reader : null_reader; + drv_data->write = drv_data->write != null_writer ? + u16_writer : null_writer; + } else if (bits <= 32) { + drv_data->n_bytes = 4; + drv_data->read = drv_data->read != null_reader ? + u32_reader : null_reader; + drv_data->write = drv_data->write != null_writer ? + u32_writer : null_writer; + } + /* + * if bits/word is changed in dma mode, then must check the + * thresholds and burst also + */ + if (chip->enable_dma) { + if (pxa2xx_spi_set_dma_burst_and_threshold(chip, + message->spi, + bits, &dma_burst, + &dma_thresh)) + dev_warn_ratelimited(&message->spi->dev, + "pump_transfers: DMA burst size reduced to match bits_per_word\n"); } + cr0 = pxa2xx_configure_sscr0(drv_data, clk_div, bits); + message->state = RUNNING_STATE; drv_data->dma_mapped = 0;