Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: rename SPI_CS_CNT_MAX => SPI_DEVICE_CS_CNT_MAX

Rename SPI_CS_CNT_MAX to SPI_DEVICE_CS_CNT_MAX to make it more obvious
that this is the max number of CS per device supported, not per
controller.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Link: https://patch.msgid.link/20250915183725.219473-8-jonas.gorski@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jonas Gorski and committed by
Mark Brown
e336ab50 08fda410

+14 -14
+1 -1
drivers/spi/spi-cadence-quadspi.c
··· 33 33 #define CQSPI_NAME "cadence-qspi" 34 34 #define CQSPI_MAX_CHIPSELECT 4 35 35 36 - static_assert(CQSPI_MAX_CHIPSELECT <= SPI_CS_CNT_MAX); 36 + static_assert(CQSPI_MAX_CHIPSELECT <= SPI_DEVICE_CS_CNT_MAX); 37 37 38 38 /* Quirks */ 39 39 #define CQSPI_NEEDS_WR_DELAY BIT(0)
+7 -7
drivers/spi/spi.c
··· 670 670 int status, idx; 671 671 u8 cs; 672 672 673 - if (spi->num_chipselect > SPI_CS_CNT_MAX) { 673 + if (spi->num_chipselect > SPI_DEVICE_CS_CNT_MAX) { 674 674 dev_err(dev, "num_cs %d > max %d\n", spi->num_chipselect, 675 - SPI_CS_CNT_MAX); 675 + SPI_DEVICE_CS_CNT_MAX); 676 676 return -EOVERFLOW; 677 677 } 678 678 ··· 699 699 } 700 700 701 701 /* Initialize unused logical CS as invalid */ 702 - for (idx = spi->num_chipselect; idx < SPI_CS_CNT_MAX; idx++) 702 + for (idx = spi->num_chipselect; idx < SPI_DEVICE_CS_CNT_MAX; idx++) 703 703 spi_set_chipselect(spi, idx, SPI_INVALID_CS); 704 704 705 705 /* Set the bus ID string */ ··· 1076 1076 trace_spi_set_cs(spi, activate); 1077 1077 1078 1078 spi->controller->last_cs_index_mask = spi->cs_index_mask; 1079 - for (idx = 0; idx < SPI_CS_CNT_MAX; idx++) { 1079 + for (idx = 0; idx < SPI_DEVICE_CS_CNT_MAX; idx++) { 1080 1080 if (enable && idx < spi->num_chipselect) 1081 1081 spi->controller->last_cs[idx] = spi_get_chipselect(spi, 0); 1082 1082 else ··· 2354 2354 static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, 2355 2355 struct device_node *nc) 2356 2356 { 2357 - u32 value, cs[SPI_CS_CNT_MAX]; 2357 + u32 value, cs[SPI_DEVICE_CS_CNT_MAX]; 2358 2358 int rc, idx; 2359 2359 2360 2360 /* Mode (clock phase/polarity/etc.) */ ··· 2429 2429 2430 2430 /* Device address */ 2431 2431 rc = of_property_read_variable_u32_array(nc, "reg", &cs[0], 1, 2432 - SPI_CS_CNT_MAX); 2432 + SPI_DEVICE_CS_CNT_MAX); 2433 2433 if (rc < 0) { 2434 2434 dev_err(&ctlr->dev, "%pOF has no valid 'reg' property (%d)\n", 2435 2435 nc, rc); ··· 3313 3313 } 3314 3314 3315 3315 /* Setting last_cs to SPI_INVALID_CS means no chip selected */ 3316 - for (idx = 0; idx < SPI_CS_CNT_MAX; idx++) 3316 + for (idx = 0; idx < SPI_DEVICE_CS_CNT_MAX; idx++) 3317 3317 ctlr->last_cs[idx] = SPI_INVALID_CS; 3318 3318 3319 3319 status = device_add(&ctlr->dev);
+6 -6
include/linux/spi/spi.h
··· 21 21 #include <uapi/linux/spi/spi.h> 22 22 23 23 /* Max no. of CS supported per spi device */ 24 - #define SPI_CS_CNT_MAX 4 24 + #define SPI_DEVICE_CS_CNT_MAX 4 25 25 26 26 struct dma_chan; 27 27 struct software_node; ··· 229 229 struct spi_delay cs_hold; 230 230 struct spi_delay cs_inactive; 231 231 232 - u8 chip_select[SPI_CS_CNT_MAX]; 232 + u8 chip_select[SPI_DEVICE_CS_CNT_MAX]; 233 233 u8 num_chipselect; 234 234 235 235 /* ··· 238 238 * multiple chip selects & memories are connected in parallel 239 239 * then more than one bit need to be set in cs_index_mask. 240 240 */ 241 - u32 cs_index_mask : SPI_CS_CNT_MAX; 241 + u32 cs_index_mask : SPI_DEVICE_CS_CNT_MAX; 242 242 243 - struct gpio_desc *cs_gpiod[SPI_CS_CNT_MAX]; /* Chip select gpio desc */ 243 + struct gpio_desc *cs_gpiod[SPI_DEVICE_CS_CNT_MAX]; /* Chip select gpio desc */ 244 244 245 245 /* 246 246 * Likely need more hooks for more protocol options affecting how ··· 721 721 bool auto_runtime_pm; 722 722 bool fallback; 723 723 bool last_cs_mode_high; 724 - s8 last_cs[SPI_CS_CNT_MAX]; 725 - u32 last_cs_index_mask : SPI_CS_CNT_MAX; 724 + s8 last_cs[SPI_DEVICE_CS_CNT_MAX]; 725 + u32 last_cs_index_mask : SPI_DEVICE_CS_CNT_MAX; 726 726 struct completion xfer_completion; 727 727 size_t max_dma_len; 728 728