Skip to content

Commit

Permalink
spi: make sure all transfer has proper speed set
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Laxman Dewangan authored and Grant Likely committed Feb 5, 2013
1 parent c4a31f4 commit 059b8ff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/spi/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 059b8ff

Please sign in to comment.