linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: Limit the spi device max speed to controller's max speed
@ 2020-12-09 17:35 Tudor Ambarus
  2020-12-09 19:46 ` Serge Semin
  2020-12-11 17:51 ` Mark Brown
  0 siblings, 2 replies; 13+ messages in thread
From: Tudor Ambarus @ 2020-12-09 17:35 UTC (permalink / raw)
  To: broonie, linux-spi; +Cc: linux-kernel, Tudor Ambarus

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>
---
 drivers/spi/spi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index cd3c395b4e90..51d7c004fbab 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -3378,7 +3378,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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-12-16  8:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09 17:35 [PATCH] spi: Limit the spi device max speed to controller's max speed Tudor Ambarus
2020-12-09 19:46 ` Serge Semin
2020-12-09 19:54   ` Mark Brown
2020-12-09 20:15     ` Serge Semin
2020-12-09 20:25       ` Mark Brown
2020-12-09 20:30         ` Serge Semin
2020-12-10  8:58           ` Tudor.Ambarus
2020-12-10 15:33             ` Mark Brown
2020-12-10 16:32               ` Tudor.Ambarus
2020-12-10 18:16                 ` Mark Brown
2020-12-11 17:51 ` Mark Brown
2020-12-15 14:24   ` Geert Uytterhoeven
2020-12-16  8:25     ` Tudor.Ambarus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).