linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] spi: make sure all transfer has proper speed set
@ 2013-01-04 18:47 Laxman Dewangan
       [not found] ` <1357325235-25485-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
  2013-02-05 13:11 ` [PATCH 1/2] spi: make sure all transfer has proper speed set Grant Likely
  0 siblings, 2 replies; 4+ messages in thread
From: Laxman Dewangan @ 2013-01-04 18:47 UTC (permalink / raw)
  To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Laxman Dewangan, swarren-DDmLM1+adcrQT0dZR+AlfA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

When spi client does the spi transfer and if it does not set
the speed for each transfer then set it as default
of spi device in spi core before calling low level transfer.

This will remove the extra check in low level driver for setting
speed.

Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 drivers/spi/spi.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 19ee901..9676a29 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1366,12 +1366,14 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message)
 	}
 
 	/**
-	 * Set transfer bits_per_word as spi device default if it is not
-	 * set for this transfer.
+	 * Set transfer bits_per_word and max speed as spi device default if
+	 * it is not set for this transfer.
 	 */
 	list_for_each_entry(xfer, &message->transfers, transfer_list) {
 		if (!xfer->bits_per_word)
 			xfer->bits_per_word = spi->bits_per_word;
+		if (!xfer->speed_hz)
+			xfer->speed_hz = spi->max_speed_hz;
 	}
 
 	message->spi = spi;
-- 
1.7.1.1


------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-05 13:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-04 18:47 [PATCH 1/2] spi: make sure all transfer has proper speed set Laxman Dewangan
     [not found] ` <1357325235-25485-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-04 18:47   ` [PATCH 2/2] spi: tegra: remove checks for valid speed Laxman Dewangan
     [not found]     ` <1357325235-25485-2-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-02-05 13:12       ` Grant Likely
2013-02-05 13:11 ` [PATCH 1/2] spi: make sure all transfer has proper speed set Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).