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: 3652421 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 456699F382 for ; Fri, 14 Feb 2014 12:38:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7400620220 for ; Fri, 14 Feb 2014 12:38:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ABDA52021E for ; Fri, 14 Feb 2014 12:38:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751840AbaBNMiY (ORCPT ); Fri, 14 Feb 2014 07:38:24 -0500 Received: from mail-pb0-f51.google.com ([209.85.160.51]:47482 "EHLO mail-pb0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751753AbaBNMiX (ORCPT ); Fri, 14 Feb 2014 07:38:23 -0500 Received: by mail-pb0-f51.google.com with SMTP id un15so12223315pbc.24 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=UmIHDcO2P1oDwDDHaEovRJJ6ddLkFAwsro087uDShmALF1cyoo3+Tm0RMQXtRIeAG3 0BIY7qNrx4Yt2A1zWXydwEXQ5V4vhtjG28UvDxbkqMLobVB9ayiTxxgproSCXw8T/3sE ZCCSetifTVURWEUjLl/HLWZE4qmUQsuL/eAeDTU00zYRSkIVAd/QTGZJ4iQiD4m8+UnV GRe0/YH8RzOJoTrnmiZ9QMy5OyiSsgcj0JSL2ZdB50alhQwwsXsBPYHxn9DslvgSUx0q Qtie+HCe0jcyMoOkbMr5pxx9PdRAfnN1qLm4qNUGxV5bOyjRZUA/M0BYNJYcFbDSdeRQ fJ+A== X-Gm-Message-State: ALoCoQlvjemXhj7GbUCYso7l057736qCs/LThOHQ8eOvtsamO+wpc2iwQts9Cm1n1QrCCbN1I1i3 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-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@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 */