From patchwork Tue Feb 19 21:44:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joachim Eastwood X-Patchwork-Id: 2165301 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork2.kernel.org (Postfix) with ESMTP id 71EEEDF24C for ; Tue, 19 Feb 2013 21:45:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1U7v0X-0002yf-U8; Tue, 19 Feb 2013 21:45:49 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1U7v0V-0002yZ-V1 for spi-devel-general@lists.sourceforge.net; Tue, 19 Feb 2013 21:45:48 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of gmail.com designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; envelope-from=manabian@gmail.com; helo=mail-la0-f54.google.com; Received: from mail-la0-f54.google.com ([209.85.215.54]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1U7v0V-0005pw-0n for spi-devel-general@lists.sourceforge.net; Tue, 19 Feb 2013 21:45:47 +0000 Received: by mail-la0-f54.google.com with SMTP id gw10so6905943lab.41 for ; Tue, 19 Feb 2013 13:45:40 -0800 (PST) X-Received: by 10.152.111.67 with SMTP id ig3mr8795937lab.41.1361310340413; Tue, 19 Feb 2013 13:45:40 -0800 (PST) Received: from localhost.localdomain ([90.149.223.57]) by mx.google.com with ESMTPS id f4sm13025914lbo.4.2013.02.19.13.45.37 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Feb 2013 13:45:39 -0800 (PST) From: Joachim Eastwood To: grant.likely@secretlab.ca Subject: [PATCH] spi/atmel: fix speed_hz check in atmel_spi_transfer() Date: Tue, 19 Feb 2013 22:44:57 +0100 Message-Id: <1361310297-28002-1-git-send-email-manabian@gmail.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: References: X-Spam-Score: -1.6 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (manabian[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1U7v0V-0005pw-0n Cc: spi-devel-general@lists.sourceforge.net, Joachim Eastwood , nicolas.ferre@atmel.com X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net atmel_spi_transfer() would check speed_hz and fail if the speed was changed in the transfer. After commit "spi: make sure all transfer has proper speed set" this would happen on all transfers. Change speed_hz check to only fail if a lower speed than max is requested. Signed-off-by: Joachim Eastwood Acked-by: Nicolas Ferre --- Hi Grant, Fix for spi-atmel as per your suggestion; check if speed_hz is less than bus max speed. regards Joachim Eastwood drivers/spi/spi-atmel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 656d137..80f5867 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -847,8 +847,8 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg) } /* FIXME implement these protocol options!! */ - if (xfer->speed_hz) { - dev_dbg(&spi->dev, "no protocol options yet\n"); + if (xfer->speed_hz < spi->max_speed_hz) { + dev_dbg(&spi->dev, "can't change speed in transfer\n"); return -ENOPROTOOPT; }