From patchwork Wed Mar 19 03:57:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3857151 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A8F62BF540 for ; Wed, 19 Mar 2014 18:03:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C5DD72011B for ; Wed, 19 Mar 2014 18:03:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6267520259 for ; Wed, 19 Mar 2014 18:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758054AbaCSD5n (ORCPT ); Tue, 18 Mar 2014 23:57:43 -0400 Received: from mail-pb0-f53.google.com ([209.85.160.53]:44357 "EHLO mail-pb0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756662AbaCSD5n (ORCPT ); Tue, 18 Mar 2014 23:57:43 -0400 Received: by mail-pb0-f53.google.com with SMTP id rp16so8218365pbb.26 for ; Tue, 18 Mar 2014 20:57:42 -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:in-reply-to :references:content-type:mime-version:content-transfer-encoding; bh=Bw6kYJE2gZbEYCft/hYMxgo/aYKpaeRMNJQecCwy6VY=; b=Zx8za1jZuBxA+IkYeRClUUldIpWPt3idrdVYUaMsWHy/cLc5DaiH9SZ81i6bqhDpqP QLOGV+nMmZa7LY/TVXRWEBzR1VZO7MIsCs9wHF/KW5JZBOURMmW1IGwr5c/p+4/Pqu9n XNxkFfeS3QXV0KnYqxIVyxFwSwC8+O4t70nimr37wG+D0WhmApxH0G1O+7esyufjXnj5 V70JA+c0xCtksQqI41pYbtIgmigmrd6vAdLekJeMW0PfHIoqN7JtsV4c7poRNeqNc6Tu Bhkm6eTa5k1PUwUCslw9HCHUIChZPVTmYPQRal+7LBeNxByK83MI9hzSp/F6DJwl7k2p YVKg== X-Gm-Message-State: ALoCoQlq+jhFsVDK1nmWXXBVoPzRsId1aeycYdjUF6Udvc6CzQ7srnbmkutChT4tPOmyd1f0fgDy X-Received: by 10.66.65.204 with SMTP id z12mr37290790pas.60.1395201462713; Tue, 18 Mar 2014 20:57:42 -0700 (PDT) Received: from [192.168.0.102] (218-164-140-191.dynamic.hinet.net. [218.164.140.191]) by mx.google.com with ESMTPSA id qq5sm57631954pbb.24.2014.03.18.20.57.40 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 18 Mar 2014 20:57:42 -0700 (PDT) Message-ID: <1395201458.16346.6.camel@phoenix> Subject: [PATCH 4/7] spi: omap2-mcspi: Let spi core validate Tx/Rx buffers for non-zero length transfer From: Axel Lin To: Mark Brown Cc: Illia Smyrnov , linux-spi@vger.kernel.org Date: Wed, 19 Mar 2014 11:57:38 +0800 In-Reply-To: <1395201227.16346.1.camel@phoenix> References: <1395201227.16346.1.camel@phoenix> 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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Signed-off-by: Axel Lin --- drivers/spi/spi-omap2-mcspi.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 2941c5b..a0746a7 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1081,10 +1081,6 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m) omap2_mcspi_set_enable(spi, 0); list_for_each_entry(t, &m->transfers, transfer_list) { - if (t->tx_buf == NULL && t->rx_buf == NULL && t->len) { - status = -EINVAL; - break; - } if (par_override || (t->speed_hz != spi->max_speed_hz) || (t->bits_per_word != spi->bits_per_word)) { @@ -1212,16 +1208,6 @@ static int omap2_mcspi_transfer_one_message(struct spi_master *master, void *rx_buf = t->rx_buf; unsigned len = t->len; - if ((len && !(rx_buf || tx_buf))) { - dev_dbg(mcspi->dev, "transfer: %d Hz, %d %s%s, %d bpw\n", - t->speed_hz, - len, - tx_buf ? "tx" : "", - rx_buf ? "rx" : "", - t->bits_per_word); - return -EINVAL; - } - if (m->is_dma_mapped || len < DMA_MIN_BYTES) continue;