projects
/
linux-2.6-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3123109
)
spi: spidev: Convert BUILD_BUG_ON() to static_assert()
author
Andy Shevchenko
<andriy.shevchenko@linux.intel.com>
Wed, 23 Mar 2022 14:02:13 +0000
(16:02 +0200)
committer
Mark Brown
<broonie@kernel.org>
Tue, 5 Apr 2022 09:21:42 +0000
(10:21 +0100)
static_assert() is a preferred method to fail build when the certain
constraints are not met. Convert BUILD_BUG_ON() to static_assert().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link:
https://lore.kernel.org/r/20220323140215.2568-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spidev.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/spi/spidev.c
b/drivers/spi/spidev.c
index 53a55171426530cbada4894a4d083c5b49b2fe29..889c40063a34175b76b012fb1169bb31b261988a 100644
(file)
--- a/
drivers/spi/spidev.c
+++ b/
drivers/spi/spidev.c
@@
-46,6
+46,7
@@
static DECLARE_BITMAP(minors, N_SPI_MINORS);
+static_assert(N_SPI_MINORS > 0 && N_SPI_MINORS <= 256);
/* Bit masks for spi_device.mode management. Note that incorrect
* settings for some settings can cause *lots* of trouble for other
@@
-856,7
+857,6
@@
static int __init spidev_init(void)
* that will key udev/mdev to add/remove /dev nodes. Last, register
* the driver which manages those device numbers.
*/
- BUILD_BUG_ON(N_SPI_MINORS > 256);
status = register_chrdev(SPIDEV_MAJOR, "spi", &spidev_fops);
if (status < 0)
return status;