Commit 9326e4f1 authored by Tudor Ambarus's avatar Tudor Ambarus Committed by Mark Brown

spi: Limit the spi device max speed to controller's max speed

Make sure the max_speed_hz of spi_device does not override
the max_speed_hz of controller.
Signed-off-by: default avatarTudor Ambarus <tudor.ambarus@microchip.com>
Link: https://lore.kernel.org/r/20201209173514.93328-1-tudor.ambarus@microchip.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent e748edd9
...@@ -3369,7 +3369,8 @@ int spi_setup(struct spi_device *spi) ...@@ -3369,7 +3369,8 @@ int spi_setup(struct spi_device *spi)
if (status) if (status)
return status; return status;
if (!spi->max_speed_hz) if (!spi->max_speed_hz ||
spi->max_speed_hz > spi->controller->max_speed_hz)
spi->max_speed_hz = spi->controller->max_speed_hz; spi->max_speed_hz = spi->controller->max_speed_hz;
mutex_lock(&spi->controller->io_mutex); mutex_lock(&spi->controller->io_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment