From patchwork Fri Jan 17 10:00:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3503251 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 6F8709F32F for ; Fri, 17 Jan 2014 10:00:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6535020165 for ; Fri, 17 Jan 2014 10:00:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 62F982012F for ; Fri, 17 Jan 2014 10:00:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751382AbaAQKAv (ORCPT ); Fri, 17 Jan 2014 05:00:51 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:46339 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751176AbaAQKAt (ORCPT ); Fri, 17 Jan 2014 05:00:49 -0500 Received: by mail-pa0-f53.google.com with SMTP id lj1so3912121pab.40 for ; Fri, 17 Jan 2014 02:00:48 -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=TKjNY8tPRxqJausDRPXD0cmaAMZNBnxJdPGRt3Fgjv8=; b=BlxHWfR1fN659cZjotypeGkuiSYgZ40VksF0fYbT6o/m4TjDRqxYIgdYnPKhsU4Rgr OY0uuZyVtlNkx6jz9w+2JhjDwT1l0sWKkeTeJlx/yykMU4d+irrw3KVlD+MZb6IWe/rt pWfsdyfUNaVR9gnSLZrl+y25rqRoR5rLoAe7a/MhFoyA5rBW+WCxDzgvsjktQq6xGAgF q/3iZRsTp1uYhCErOrhE6jLkAkFpUJr4du2d+77lTxBK+6EJB453gxTZGb/umBKVhrXx WJsfstJnLW2SwokaitNZ4hcFmqpzbeuIvq9BtP+XOVaH69+BErJQjPntaKvvEd9MG0xF sMAw== X-Gm-Message-State: ALoCoQm6ILaYJgy53FQpk3W01iE50k7l0V5iyzJCb7zyf8rS0nn4EYYxMi22sWFQQo24CT3r1HcU X-Received: by 10.67.5.233 with SMTP id cp9mr973492pad.147.1389952848819; Fri, 17 Jan 2014 02:00:48 -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 gv10sm21458045pbd.0.2014.01.17.02.00.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Jan 2014 02:00:48 -0800 (PST) Message-ID: <1389952842.6412.1.camel@phoenix> Subject: [PATCH] spi: sc18is602: Convert to use bits_per_word_mask From: Axel Lin To: Mark Brown Cc: Guenter Roeck , linux-spi@vger.kernel.org Date: Fri, 17 Jan 2014 18:00:42 +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=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 Since commit 543bb25 "spi: add ability to validate xfer->bits_per_word in SPI core", the driver can set bits_per_word_mask for the master then the SPI core will reject transfers that attempt to use an unsupported bits_per_word value. So we can remove the bits_per_word checking in sc18is602_check_transfer() and let SPI core handle the checking. Signed-off-by: Axel Lin Acked-by: Guenter Roeck --- drivers/spi/spi-sc18is602.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c index c1a01d1..c981d21 100644 --- a/drivers/spi/spi-sc18is602.c +++ b/drivers/spi/spi-sc18is602.c @@ -183,18 +183,11 @@ static int sc18is602_setup_transfer(struct sc18is602 *hw, u32 hz, u8 mode) static int sc18is602_check_transfer(struct spi_device *spi, struct spi_transfer *t, int tlen) { - int bpw; uint32_t hz; if (t && t->len + tlen > SC18IS602_BUFSIZ) return -EINVAL; - bpw = spi->bits_per_word; - if (t && t->bits_per_word) - bpw = t->bits_per_word; - if (bpw != 8) - return -EINVAL; - hz = spi->max_speed_hz; if (t && t->speed_hz) hz = t->speed_hz; @@ -315,6 +308,7 @@ static int sc18is602_probe(struct i2c_client *client, } master->bus_num = client->adapter->nr; master->mode_bits = SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST; + master->bits_per_word_mask = SPI_BPW_MASK(8); master->setup = sc18is602_setup; master->transfer_one_message = sc18is602_transfer_one; master->dev.of_node = np;