From patchwork Sun Mar 2 15:01:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3749581 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5D6529F1EE for ; Sun, 2 Mar 2014 15:02:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 53262201DE for ; Sun, 2 Mar 2014 15:01:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5197420374 for ; Sun, 2 Mar 2014 15:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751177AbaCBPBz (ORCPT ); Sun, 2 Mar 2014 10:01:55 -0500 Received: from mail-pb0-f53.google.com ([209.85.160.53]:50308 "EHLO mail-pb0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751100AbaCBPBz (ORCPT ); Sun, 2 Mar 2014 10:01:55 -0500 Received: by mail-pb0-f53.google.com with SMTP id rp16so2713440pbb.26 for ; Sun, 02 Mar 2014 07:01:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=+M3BCpHRiExrYYSZ4KO7IGU0kXOiHGY2xHvA9sx1i04=; b=hhw/efBdchTlPc4TYWlKehDkv4mNeceYgYeOlufEhyGgITjSTbwz6OW9NtilpJN5wj wD5s0VPH10PWxlChSK1JbWbaFsJoGbDKT3eVdb9+p7TQJ2jh9nL5Y+5F7yZtzEhwYctZ /baftoNF36CUChxfVk2pvxQ8o36oK28hvhDeg0rbCZzlOogrzrjjirZq03N1Sq0TZ8S1 8my09KFHqow7qjtpLXx2Eux55AIJC7YWQzji+WSC1P+A+ZTkB+KYxpzgJXCMORaApRfK f882HnlXDMb6nay8nzOZlEth0ei9QfiZcPwen+Vkg94/Ka7wLS+I3YocjKCKZ1xilE0n rjFw== X-Gm-Message-State: ALoCoQlgULKMO8U3ESoOA5GBMCNObJ5iNtZt9BqetXxFn5pknnoTUQ2jCt5AfBuR8GEZqH+UaS/0 X-Received: by 10.68.166.196 with SMTP id zi4mr14401252pbb.90.1393772514586; Sun, 02 Mar 2014 07:01:54 -0800 (PST) Received: from [192.168.0.102] (218-164-136-100.dynamic.hinet.net. [218.164.136.100]) by mx.google.com with ESMTPSA id qw1sm18996084pbc.16.2014.03.02.07.01.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 02 Mar 2014 07:01:54 -0800 (PST) Message-ID: <1393772510.4044.9.camel@phoenix> Subject: [PATCH] spi: sh-hspi: Remove duplicate code to set default transfer speed From: Axel Lin To: Mark Brown Cc: Kuninori Morimoto , linux-spi@vger.kernel.org Date: Sun, 02 Mar 2014 23:01:50 +0800 X-Mailer: Evolution 3.6.4-0ubuntu1 Mime-Version: 1.0 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, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 In the implementation of __spi_validate(), spi core will use spi device's max speed as default transfer speed if it is not set for this transfer. So we can remove the same logic in hspi_hw_setup(). Signed-off-by: Axel Lin Acked-by: Geert Uytterhoeven --- drivers/spi/spi-sh-hspi.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c index 3c5d3b8..7435626 100644 --- a/drivers/spi/spi-sh-hspi.c +++ b/drivers/spi/spi-sh-hspi.c @@ -113,14 +113,9 @@ static void hspi_hw_setup(struct hspi_priv *hspi, { struct spi_device *spi = msg->spi; struct device *dev = hspi->dev; - u32 target_rate; u32 spcr, idiv_clk; u32 rate, best_rate, min, tmp; - target_rate = t ? t->speed_hz : 0; - if (!target_rate) - target_rate = spi->max_speed_hz; - /* * find best IDIV/CLKCx settings */ @@ -140,7 +135,7 @@ static void hspi_hw_setup(struct hspi_priv *hspi, rate /= (((idiv_clk & 0x1F) + 1) * 2); /* save best settings */ - tmp = abs(target_rate - rate); + tmp = abs(t->speed_hz - rate); if (tmp < min) { min = tmp; spcr = idiv_clk; @@ -153,7 +148,7 @@ static void hspi_hw_setup(struct hspi_priv *hspi, if (spi->mode & SPI_CPOL) spcr |= 1 << 6; - dev_dbg(dev, "speed %d/%d\n", target_rate, best_rate); + dev_dbg(dev, "speed %d/%d\n", t->speed_hz, best_rate); hspi_write(hspi, SPCR, spcr); hspi_write(hspi, SPSR, 0x0);