Sfoglia il codice sorgente

spi: Fall back to master maximum speed if no slave speed specified

If a slave appears with no maximum transfer speed specified fall back to
using the maximum for the master instead.  It's questionable if we
should let slaves do this but let's be defensive.

Signed-off-by: Mark Brown <broonie@kernel.org>
Mark Brown 10 anni fa
parent
commit
7dc9fbc342
1 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. 2 0
      drivers/spi/spi.c

+ 2 - 0
drivers/spi/spi.c

@@ -1860,6 +1860,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
 
 
 		if (!xfer->speed_hz)
 		if (!xfer->speed_hz)
 			xfer->speed_hz = spi->max_speed_hz;
 			xfer->speed_hz = spi->max_speed_hz;
+		if (!xfer->speed_hz)
+			xfer->speed_hz = master->max_speed_hz;
 
 
 		if (master->max_speed_hz &&
 		if (master->max_speed_hz &&
 		    xfer->speed_hz > master->max_speed_hz)
 		    xfer->speed_hz > master->max_speed_hz)