From: Andy Shevchenko Date: Thu, 2 May 2024 15:48:25 +0000 (+0300) Subject: spi: bitbang: Use NSEC_PER_*SEC rather than hard coding X-Git-Tag: io_uring-6.10-20240523~103^2~8 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=645094b41157cce4ec41dc31298646c82f6998e0;p=linux-block.git spi: bitbang: Use NSEC_PER_*SEC rather than hard coding Use NSEC_PER_*SEC rather than the hard coded value of 1000s. Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20240502154825.2752464-1-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index a0e2204fc039..c11af39c9842 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -168,8 +169,8 @@ int spi_bitbang_setup_transfer(struct spi_device *spi, struct spi_transfer *t) if (!hz) hz = spi->max_speed_hz; if (hz) { - cs->nsecs = (1000000000/2) / hz; - if (cs->nsecs > (MAX_UDELAY_MS * 1000 * 1000)) + cs->nsecs = (NSEC_PER_SEC / 2) / hz; + if (cs->nsecs > (MAX_UDELAY_MS * NSEC_PER_MSEC)) return -EINVAL; }