[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201209173514.93328-1-tudor.ambarus@microchip.com>
Date: Wed, 9 Dec 2020 19:35:14 +0200
From: Tudor Ambarus <tudor.ambarus@...rochip.com>
To: <broonie@...nel.org>, <linux-spi@...r.kernel.org>
CC: <linux-kernel@...r.kernel.org>,
Tudor Ambarus <tudor.ambarus@...rochip.com>
Subject: [PATCH] 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: Tudor Ambarus <tudor.ambarus@...rochip.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
Powered by blists - more mailing lists