projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e748edd
)
spi: Limit the spi device max speed to controller's max speed
author
Tudor Ambarus
<tudor.ambarus@microchip.com>
Wed, 9 Dec 2020 17:35:14 +0000
(19:35 +0200)
committer
Mark Brown
<broonie@kernel.org>
Fri, 11 Dec 2020 13:21:36 +0000
(13:21 +0000)
Make sure the max_speed_hz of spi_device does not override
the max_speed_hz of controller.
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Link:
https://lore.kernel.org/r/20201209173514.93328-1-tudor.ambarus@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c
patch
|
blob
|
history
diff --git
a/drivers/spi/spi.c
b/drivers/spi/spi.c
index
fc9a597
..
45021d2
100644
(file)
--- a/
drivers/spi/spi.c
+++ b/
drivers/spi/spi.c
@@
-3369,7
+3369,8
@@
int spi_setup(struct spi_device *spi)
if (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;
mutex_lock(&spi->controller->io_mutex);