diff mbox

spi/atmel: fix speed_hz check in atmel_spi_transfer()

Message ID 1361310297-28002-1-git-send-email-manabian@gmail.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Joachim Eastwood Feb. 19, 2013, 9:44 p.m. UTC
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@gmail.com>
---
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(-)

Comments

Nicolas Ferre Feb. 20, 2013, 7:51 a.m. UTC | #1
On 02/19/2013 10:44 PM, Joachim Eastwood :
> 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@gmail.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Thanks for spotting this Joachim.

Bye,

> ---
> 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;
>  		}
>  
>
Grant Likely March 2, 2013, 10:31 p.m. UTC | #2
On Wed, 20 Feb 2013 08:51:48 +0100, Nicolas Ferre <nicolas.ferre@atmel.com> wrote:
> On 02/19/2013 10:44 PM, Joachim Eastwood :
> > 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@gmail.com>
> 
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> 
> Thanks for spotting this Joachim.

Applied, thanks.

g.

------------------------------------------------------------------------------
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
diff mbox

Patch

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;
 		}