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>
This commit is contained in:
parent
c4a31f4300
commit
059b8ffeee
|
@ -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 transfer bits_per_word and max speed as spi device default if
|
||||||
* set for this transfer.
|
* it is not set for this transfer.
|
||||||
*/
|
*/
|
||||||
list_for_each_entry(xfer, &message->transfers, transfer_list) {
|
list_for_each_entry(xfer, &message->transfers, transfer_list) {
|
||||||
if (!xfer->bits_per_word)
|
if (!xfer->bits_per_word)
|
||||||
xfer->bits_per_word = spi->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;
|
message->spi = spi;
|
||||||
|
|
Loading…
Reference in New Issue