All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joachim Eastwood <manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Joachim Eastwood
	<manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org
Subject: [PATCH] spi/atmel: fix speed_hz check in atmel_spi_transfer()
Date: Tue, 19 Feb 2013 22:44:57 +0100	[thread overview]
Message-ID: <1361310297-28002-1-git-send-email-manabian@gmail.com> (raw)
In-Reply-To: <CACxGe6u0o0V3Jm9-iyizKH5KX=dPe-CL0bH-Kc7KM_k6gAk69A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

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 <manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
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;
 		}
 
-- 
1.8.0


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb

  parent reply	other threads:[~2013-02-19 21:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-17 11:15 spi-atmel broken in next Joachim Eastwood
     [not found] ` <CAGhQ9VwoehjY4niDqcnb88va9vNLw=jFmxOnq6k0QP6GZJ4gqQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-17 20:12   ` Grant Likely
     [not found]     ` <CACxGe6u0o0V3Jm9-iyizKH5KX=dPe-CL0bH-Kc7KM_k6gAk69A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-19 21:44       ` Joachim Eastwood [this message]
     [not found]         ` <1361310297-28002-1-git-send-email-manabian-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-02-20  7:51           ` [PATCH] spi/atmel: fix speed_hz check in atmel_spi_transfer() Nicolas Ferre
     [not found]             ` <51248094.90808-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2013-03-02 22:31               ` Grant Likely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1361310297-28002-1-git-send-email-manabian@gmail.com \
    --to=manabian-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.