summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2013-01-05 00:17:14 +0530
committerGrant Likely <grant.likely@secretlab.ca>2013-02-05 13:11:03 +0000
commit059b8ffeee5b427949872bb6ed5db5ae0788054e (patch)
treec55df030036c4f8a52844645e67ed12a5eb57cde /drivers
parentc4a31f43005512b366e8bfc346e7f14c1a7a1ba7 (diff)
spi: make sure all transfer has proper speed set
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@nvidia.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/spi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 08ff4acd5225..2edbe1903804 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1369,12 +1369,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;