From: Tudor Ambarus <tudor.ambarus@microchip.com>
To: <broonie@kernel.org>, <linux-spi@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
Tudor Ambarus <tudor.ambarus@microchip.com>
Subject: [PATCH] spi: Limit the spi device max speed to controller's max speed
Date: Wed, 9 Dec 2020 19:35:14 +0200 [thread overview]
Message-ID: <20201209173514.93328-1-tudor.ambarus@microchip.com> (raw)
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
next reply other threads:[~2020-12-09 17:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-09 17:35 Tudor Ambarus [this message]
2020-12-09 19:46 ` [PATCH] spi: Limit the spi device max speed to controller's max speed 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201209173514.93328-1-tudor.ambarus@microchip.com \
--to=tudor.ambarus@microchip.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox