From patchwork Fri Mar 28 15:37:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3904541 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 E25D09F2B6 for ; Fri, 28 Mar 2014 15:38:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 144E7202FE for ; Fri, 28 Mar 2014 15:38:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4189720295 for ; Fri, 28 Mar 2014 15:38:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752225AbaC1PiB (ORCPT ); Fri, 28 Mar 2014 11:38:01 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:57919 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751712AbaC1PiA (ORCPT ); Fri, 28 Mar 2014 11:38:00 -0400 Received: by mail-pa0-f47.google.com with SMTP id lj1so5127901pab.6 for ; Fri, 28 Mar 2014 08:37:59 -0700 (PDT) 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=wQFSuEAQEmk2DkrrAuOFzjOfwrPHEKwy/29XUJv//YA=; b=aqARAG6I5zpHYfryf+/4Txxzf+ujH0Tlk3zjWAnVrjOgl/4B7NKU2izYkAp1JvmKmv T9OqhK9qLaLE/Oo7bcv0729pMBYQ3mgQrbfzUwmk7rm1fVVVS+MrW/R4fMz3NGpsE7jP W6P2uKyVu60RNPx9ks+XN+914YuvCNdInoU2Le/ZEDzHHXLeJdWZ2Uk0Oj/7c3zDIbdV eFJBsCX0F7FYujvy02hjfeb6DtIvX/3XPceupkXvWoljoJO18YXgR13qNTllW4oei2sX jgVbB8MSv+sgR1FvWA1KgvA7NjDW4qy3b5Mo5oW2SI7DQALIS0oIelNUAFm4NyHQ6Ig8 9LmQ== X-Gm-Message-State: ALoCoQm3Od1S4bnudwAbB7Ux0xyE1lPUMg9//OCPEw7toWuwFyjHqTVBsmIGIYiB8JykR53arc8g X-Received: by 10.67.8.102 with SMTP id dj6mr9471138pad.10.1396021079829; Fri, 28 Mar 2014 08:37:59 -0700 (PDT) Received: from [192.168.0.119] (59-115-28-1.dynamic.hinet.net. [59.115.28.1]) by mx.google.com with ESMTPSA id pq3sm24514950pbb.57.2014.03.28.08.37.57 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 28 Mar 2014 08:37:58 -0700 (PDT) Message-ID: <1396021074.13764.1.camel@phoenix> Subject: [PATCH] spi: mpc52xx: Convert to use bits_per_word_mask From: Axel Lin To: Mark Brown Cc: Grant Likely , linux-spi@vger.kernel.org Date: Fri, 28 Mar 2014 23:37:54 +0800 X-Mailer: Evolution 3.8.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.3 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 This controller only supports 8-bit word length. Set bits_per_word_mask so spi core will reject transfers that attempt to use an unsupported bits_per_word value. Also remove the duplicate code to test spi->mode, it is done by spi core. Signed-off-by: Axel Lin --- drivers/spi/spi-mpc52xx.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/spi/spi-mpc52xx.c b/drivers/spi/spi-mpc52xx.c index bd404c2..aac2a5d 100644 --- a/drivers/spi/spi-mpc52xx.c +++ b/drivers/spi/spi-mpc52xx.c @@ -356,17 +356,6 @@ static void mpc52xx_spi_wq(struct work_struct *work) * spi_master ops */ -static int mpc52xx_spi_setup(struct spi_device *spi) -{ - if (spi->bits_per_word % 8) - return -EINVAL; - - if (spi->mode & ~(SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST)) - return -EINVAL; - - return 0; -} - static int mpc52xx_spi_transfer(struct spi_device *spi, struct spi_message *m) { struct mpc52xx_spi *ms = spi_master_get_devdata(spi->master); @@ -429,9 +418,9 @@ static int mpc52xx_spi_probe(struct platform_device *op) goto err_alloc; } - master->setup = mpc52xx_spi_setup; master->transfer = mpc52xx_spi_transfer; master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST; + master->bits_per_word_mask = SPI_BPW_MASK(8); master->dev.of_node = op->dev.of_node; platform_set_drvdata(op, master);