From patchwork Sun Mar 2 14:30:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3749531 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 B20A99F1EE for ; Sun, 2 Mar 2014 14:30:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D0ACE20374 for ; Sun, 2 Mar 2014 14:30:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 027992037D for ; Sun, 2 Mar 2014 14:30:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752453AbaCBOah (ORCPT ); Sun, 2 Mar 2014 09:30:37 -0500 Received: from mail-pb0-f45.google.com ([209.85.160.45]:43710 "EHLO mail-pb0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752251AbaCBOah (ORCPT ); Sun, 2 Mar 2014 09:30:37 -0500 Received: by mail-pb0-f45.google.com with SMTP id uo5so1991428pbc.18 for ; Sun, 02 Mar 2014 06:30:36 -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=FhDtmsVYzFVnSQUMBxImEYXHC4x+kIHN4gTnqoBNH4M=; b=mOpy0NipZdUZpd8KAlwY8/Wq+3VbnZUkb97tiNsZo6zyNe/5vgPgDId3obCMcFQZLt vNQmtoN4VxNDzWyl84pT8klLicWJP/NuST5aBCu0EtOC1TaF1gpvrazkomFVTUZL6zen aIstNu5x9YmiLlf9ANxyxtwhRpK4svAT7FfJWTKSVzoUDlnuDEhSotqRIJejZ14Wihyw dPAfWTjOIGRp/JqQZSupYcgeC9btZxJ+KzCBW2GTAnZrQRK1zbuOgfGP1cbz8aV22DfD gwoklffXISB2kAIpQzA/q5DrzoElt08lXSeMGbXzageU6GbwQ8bytg+X+hZZck+c7bl4 rduA== X-Gm-Message-State: ALoCoQk8I/5jM9RFg3iuVJvnKpvlqwXeoktnJLZImIC9l1Lt6v7Ani//56o2VHn/ykj54XxqAwxs X-Received: by 10.66.139.70 with SMTP id qw6mr2852544pab.111.1393770636839; Sun, 02 Mar 2014 06:30:36 -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 y9sm62762475pas.10.2014.03.02.06.30.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 02 Mar 2014 06:30:36 -0800 (PST) Message-ID: <1393770632.4044.5.camel@phoenix> Subject: [PATCH] spi: sh-msiof: Kill sh_msiof_spi_bits and sh_msiof_spi_hz functions From: Axel Lin To: Mark Brown Cc: Geert Uytterhoeven , Magnus Damm , linux-spi@vger.kernel.org Date: Sun, 02 Mar 2014 22:30:32 +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 set transfer bits_per_word and max speed as spi device default if it is not set for this transfer. So we can remove the same implementation in this driver. Signed-off-by: Axel Lin Acked-by: Geert Uytterhoeven --- drivers/spi/spi-sh-msiof.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index 1b59804..739eb2f 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c @@ -416,26 +416,6 @@ static void sh_msiof_spi_read_fifo_s32u(struct sh_msiof_spi_priv *p, put_unaligned(swab32(sh_msiof_read(p, RFDR) >> fs), &buf_32[k]); } -static int sh_msiof_spi_bits(struct spi_device *spi, struct spi_transfer *t) -{ - int bits; - - bits = t ? t->bits_per_word : 0; - if (!bits) - bits = spi->bits_per_word; - return bits; -} - -static u32 sh_msiof_spi_hz(struct spi_device *spi, struct spi_transfer *t) -{ - u32 hz; - - hz = t ? t->speed_hz : 0; - if (!hz) - hz = spi->max_speed_hz; - return hz; -} - static int sh_msiof_spi_setup(struct spi_device *spi) { struct device_node *np = spi->master->dev.of_node; @@ -573,7 +553,7 @@ static int sh_msiof_transfer_one(struct spi_master *master, int n; bool swab; - bits = sh_msiof_spi_bits(spi, t); + bits = t->bits_per_word; if (bits <= 8 && t->len > 15 && !(t->len & 3)) { bits = 32; @@ -623,8 +603,7 @@ static int sh_msiof_transfer_one(struct spi_master *master, } /* setup clocks (clock already enabled in chipselect()) */ - sh_msiof_spi_set_clk_regs(p, clk_get_rate(p->clk), - sh_msiof_spi_hz(spi, t)); + sh_msiof_spi_set_clk_regs(p, clk_get_rate(p->clk), t->speed_hz); /* transfer in fifo sized chunks */ words = t->len / bytes_per_word;