From patchwork Fri Jan 17 10:53:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3503571 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 067F29F32F for ; Fri, 17 Jan 2014 10:53:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F34B320170 for ; Fri, 17 Jan 2014 10:53:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C0D7720165 for ; Fri, 17 Jan 2014 10:53:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752326AbaAQKxt (ORCPT ); Fri, 17 Jan 2014 05:53:49 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:42059 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752319AbaAQKxs (ORCPT ); Fri, 17 Jan 2014 05:53:48 -0500 Received: by mail-pa0-f53.google.com with SMTP id lj1so3965289pab.40 for ; Fri, 17 Jan 2014 02:53:47 -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=EPxHOPwPLSeoRgVZxuCvdFIy4PtkFNZFxli7iDkF+2M=; b=I66G3EN4ufdy3WP9BERQ110yU7b6plsZlifxOhNwEa5JZf9sBQmq4CWcQL/pG+uX/y vvTCNXlvu+TJE26t7iOu0zd2RQjGADjXvWo2lAug5kgzT3KMYWcmF/Rmz28ynyINFNSv 1Jnqykpc+RDmkS4VsLMGKPE492rAiRDcDuqf65svLPLs4laa/xjqXgBIQH0GcEM6/eus qFeauKop9SL/K6ILYKnV/97Wuxl5u7hJ1IXWbCUzxDfK0zvhqdOwJCEFxgCeWNJ30Q7B KLR456dFyrU2ZuzDnBiUSTzPDf7bM2OT2ny5CUiH03Tuy3EEoSgvuDcNm/9ccMorol4C arsg== X-Gm-Message-State: ALoCoQktB/QemjUsYto24kD9C3qrTPGp4eG5EZX2nu3fcogtYBZtBXg/GP08hz3lE01JhoMEYUyT X-Received: by 10.68.180.66 with SMTP id dm2mr1202505pbc.143.1389956027834; Fri, 17 Jan 2014 02:53:47 -0800 (PST) Received: from [192.168.0.102] (218-164-142-208.dynamic.hinet.net. [218.164.142.208]) by mx.google.com with ESMTPSA id da3sm21801777pbc.30.2014.01.17.02.53.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Jan 2014 02:53:47 -0800 (PST) Message-ID: <1389956020.6412.5.camel@phoenix> Subject: [PATCH] spi: Remove duplicate code to set default bits_per_word setting From: Axel Lin To: Mark Brown Cc: Matt Porter , Alison Wang , Chao Fu , Marek Vasut , Yoshihiro Shimoda , Guenter Roeck , Barry Song , Tomoya MORINAGA , linux-spi@vger.kernel.org Date: Fri, 17 Jan 2014 18:53:40 +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=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 The implementation in spi_setup() already set spi->bits_per_word = 8 when spi->bits_per_word is 0 before calling spi->master->setup. So we don't need to do it again in setup() callback. Cc: Matt Porter Cc: Alison Wang Cc: Chao Fu Cc: Marek Vasut Cc: Yoshihiro Shimoda Cc: Guenter Roeck Cc: Barry Song Cc: Tomoya MORINAGA Signed-off-by: Axel Lin Acked-by: Marek Vasut Acked-by: Barry Song Acked-by: Guenter Roeck --- drivers/spi/spi-davinci.c | 4 ---- drivers/spi/spi-fsl-dspi.c | 3 --- drivers/spi/spi-mxs.c | 9 --------- drivers/spi/spi-rspi.c | 2 -- drivers/spi/spi-sc18is602.c | 3 --- drivers/spi/spi-sh.c | 3 --- drivers/spi/spi-sirf.c | 7 ------- drivers/spi/spi-topcliff-pch.c | 6 ------ 8 files changed, 37 deletions(-) diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 79d40c8..5e7389f 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -396,10 +396,6 @@ static int davinci_spi_setup(struct spi_device *spi) dspi = spi_master_get_devdata(spi->master); pdata = &dspi->pdata; - /* if bits per word length is zero then set it default 8 */ - if (!spi->bits_per_word) - spi->bits_per_word = 8; - if (!(spi->mode & SPI_NO_CS)) { if ((pdata->chip_sel == NULL) || (pdata->chip_sel[spi->chip_select] == SPI_INTERN_CS)) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index a37f156..ec79f72 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -375,9 +375,6 @@ static int dspi_setup(struct spi_device *spi) if (!spi->max_speed_hz) return -EINVAL; - if (!spi->bits_per_word) - spi->bits_per_word = 8; - return dspi_setup_transfer(spi, NULL); } diff --git a/drivers/spi/spi-mxs.c b/drivers/spi/spi-mxs.c index 3adebfa..79e5aa2 100644 --- a/drivers/spi/spi-mxs.c +++ b/drivers/spi/spi-mxs.c @@ -111,14 +111,6 @@ static int mxs_spi_setup_transfer(struct spi_device *dev, return 0; } -static int mxs_spi_setup(struct spi_device *dev) -{ - if (!dev->bits_per_word) - dev->bits_per_word = 8; - - return 0; -} - static u32 mxs_spi_cs_to_reg(unsigned cs) { u32 select = 0; @@ -502,7 +494,6 @@ static int mxs_spi_probe(struct platform_device *pdev) return -ENOMEM; master->transfer_one_message = mxs_spi_transfer_one; - master->setup = mxs_spi_setup; master->bits_per_word_mask = SPI_BPW_MASK(8); master->mode_bits = SPI_CPOL | SPI_CPHA; master->num_chipselect = 3; diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index c26840c..28987d9 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c @@ -802,8 +802,6 @@ static int rspi_setup(struct spi_device *spi) { struct rspi_data *rspi = spi_master_get_devdata(spi->master); - if (!spi->bits_per_word) - spi->bits_per_word = 8; rspi->max_speed_hz = spi->max_speed_hz; rspi->spcmd = SPCMD_SSLKP; diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c index c981d21..121c2e1 100644 --- a/drivers/spi/spi-sc18is602.c +++ b/drivers/spi/spi-sc18is602.c @@ -247,9 +247,6 @@ error: static int sc18is602_setup(struct spi_device *spi) { - if (!spi->bits_per_word) - spi->bits_per_word = 8; - if (spi->mode & ~(SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST)) return -EINVAL; diff --git a/drivers/spi/spi-sh.c b/drivers/spi/spi-sh.c index 9fea8cc..f6f2c70 100644 --- a/drivers/spi/spi-sh.c +++ b/drivers/spi/spi-sh.c @@ -352,9 +352,6 @@ static int spi_sh_setup(struct spi_device *spi) { struct spi_sh_data *ss = spi_master_get_devdata(spi->master); - if (!spi->bits_per_word) - spi->bits_per_word = 8; - pr_debug("%s: enter\n", __func__); spi_sh_write(ss, 0xfe, SPI_SH_CR1); /* SPI sycle stop */ diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index ed5e501..e430689 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c @@ -536,16 +536,9 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t) static int spi_sirfsoc_setup(struct spi_device *spi) { - struct sirfsoc_spi *sspi; - if (!spi->max_speed_hz) return -EINVAL; - sspi = spi_master_get_devdata(spi->master); - - if (!spi->bits_per_word) - spi->bits_per_word = 8; - return spi_sirfsoc_setup_transfer(spi, NULL); } diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c index 338fc11..2e7f38c 100644 --- a/drivers/spi/spi-topcliff-pch.c +++ b/drivers/spi/spi-topcliff-pch.c @@ -466,12 +466,6 @@ static void pch_spi_reset(struct spi_master *master) static int pch_spi_setup(struct spi_device *pspi) { - /* check bits per word */ - if (pspi->bits_per_word == 0) { - pspi->bits_per_word = 8; - dev_dbg(&pspi->dev, "%s 8 bits per word\n", __func__); - } - /* Check baud rate setting */ /* if baud rate of chip is greater than max we can support,return error */