From patchwork Fri Feb 14 12:38:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3652431 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 2270E9F390 for ; Fri, 14 Feb 2014 12:38:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 500922021E for ; Fri, 14 Feb 2014 12:38:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73CCA2021F for ; Fri, 14 Feb 2014 12:38:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751902AbaBNMiY (ORCPT ); Fri, 14 Feb 2014 07:38:24 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:59164 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751788AbaBNMiX (ORCPT ); Fri, 14 Feb 2014 07:38:23 -0500 Received: by mail-pa0-f43.google.com with SMTP id rd3so12208592pab.2 for ; Fri, 14 Feb 2014 04:38:22 -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=HQNQxEMJkvTHSDiuenpZFYlz1BnRS+bPcEOv+Ah7Q3Q=; b=D+1weOmElKSNSRbQSPjrucpJtLLVMRDJ5SZJRULqlf1q75hh+trKv0DqcfVgoDf8hX v0c/A89jNSxUCrsiaSDU/xz8SVkA5WFB0F4R6zypA4F4tSe+pt49m7hcCV99pUdKlZWS SyqLhbz4c3+GOjbJU4RLlCiGkJWLX72EpLaGCOdLNBMni1GVmCp93woumcOl6OLk02o2 osvKNzKwqowkGbTebqSvuMdMHV8lOCz2rrozJqeZALMSNlhg41tsR7o199Urk1i5II2x EEMUP7Rj4Mz/P3ClRZzYrNPk9+EI936NQd1xCTzTvPpDlOq7kzp8MWNkQHpvKQZlhv00 Tc6w== X-Gm-Message-State: ALoCoQnogLp8Q+32WG/T7xzBO8DU0pAel7Gj7Gq2xCkYKGWR8BH79Xy2TTGXp291uMyiIru3Eh4A X-Received: by 10.68.201.10 with SMTP id jw10mr8858156pbc.25.1392381502623; Fri, 14 Feb 2014 04:38:22 -0800 (PST) Received: from [192.168.0.102] (218-164-130-78.dynamic.hinet.net. [218.164.130.78]) by mx.google.com with ESMTPSA id iu7sm16809617pbc.45.2014.02.14.04.38.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Feb 2014 04:38:21 -0800 (PST) Message-ID: <1392381496.31961.1.camel@phoenix> Subject: [PATCH] spi: s3c24xx: Convert to let spi core validate bits_per_word From: Axel Lin To: Mark Brown Cc: Ben Dooks , Kukjin Kim , linux-samsung-soc@vger.kernel.org, linux-spi@vger.kernel.org Date: Fri, 14 Feb 2014 20:38:16 +0800 X-Mailer: Evolution 3.6.4-0ubuntu1 Mime-Version: 1.0 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 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 Set bits_per_word_mask so spi core will reject transfers that attempt to use an unsupported bits_per_word value. Signed-off-by: Axel Lin --- drivers/spi/spi-s3c24xx.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c index c20df45..a275445 100644 --- a/drivers/spi/spi-s3c24xx.c +++ b/drivers/spi/spi-s3c24xx.c @@ -122,25 +122,15 @@ static int s3c24xx_spi_update_state(struct spi_device *spi, { struct s3c24xx_spi *hw = to_hw(spi); struct s3c24xx_spi_devstate *cs = spi->controller_state; - unsigned int bpw; unsigned int hz; unsigned int div; unsigned long clk; - bpw = t ? t->bits_per_word : spi->bits_per_word; hz = t ? t->speed_hz : spi->max_speed_hz; - if (!bpw) - bpw = 8; - if (!hz) hz = spi->max_speed_hz; - if (bpw != 8) { - dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw); - return -EINVAL; - } - if (spi->mode != cs->mode) { u8 spcon = SPCON_DEFAULT | S3C2410_SPCON_ENSCK; @@ -543,6 +533,7 @@ static int s3c24xx_spi_probe(struct platform_device *pdev) master->num_chipselect = hw->pdata->num_cs; master->bus_num = pdata->bus_num; + master->bits_per_word_mask = SPI_BPW_MASK(8); /* setup the state for the bitbang driver */