Skip to content

Commit e336ab5

Browse files
KanjiMonsterbroonie
authored andcommitted
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 08fda41 commit e336ab5

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

drivers/spi/spi-cadence-quadspi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#define CQSPI_NAME "cadence-qspi"
3434
#define CQSPI_MAX_CHIPSELECT 4
3535

36-
static_assert(CQSPI_MAX_CHIPSELECT <= SPI_CS_CNT_MAX);
36+
static_assert(CQSPI_MAX_CHIPSELECT <= SPI_DEVICE_CS_CNT_MAX);
3737

3838
/* Quirks */
3939
#define CQSPI_NEEDS_WR_DELAY BIT(0)

drivers/spi/spi.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,9 @@ static int __spi_add_device(struct spi_device *spi)
670670
int status, idx;
671671
u8 cs;
672672

673-
if (spi->num_chipselect > SPI_CS_CNT_MAX) {
673+
if (spi->num_chipselect > SPI_DEVICE_CS_CNT_MAX) {
674674
dev_err(dev, "num_cs %d > max %d\n", spi->num_chipselect,
675-
SPI_CS_CNT_MAX);
675+
SPI_DEVICE_CS_CNT_MAX);
676676
return -EOVERFLOW;
677677
}
678678

@@ -699,7 +699,7 @@ static int __spi_add_device(struct spi_device *spi)
699699
}
700700

701701
/* 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++)
703703
spi_set_chipselect(spi, idx, SPI_INVALID_CS);
704704

705705
/* Set the bus ID string */
@@ -1076,7 +1076,7 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force)
10761076
trace_spi_set_cs(spi, activate);
10771077

10781078
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++) {
10801080
if (enable && idx < spi->num_chipselect)
10811081
spi->controller->last_cs[idx] = spi_get_chipselect(spi, 0);
10821082
else
@@ -2354,7 +2354,7 @@ static void of_spi_parse_dt_cs_delay(struct device_node *nc,
23542354
static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
23552355
struct device_node *nc)
23562356
{
2357-
u32 value, cs[SPI_CS_CNT_MAX];
2357+
u32 value, cs[SPI_DEVICE_CS_CNT_MAX];
23582358
int rc, idx;
23592359

23602360
/* Mode (clock phase/polarity/etc.) */
@@ -2429,7 +2429,7 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
24292429

24302430
/* Device address */
24312431
rc = of_property_read_variable_u32_array(nc, "reg", &cs[0], 1,
2432-
SPI_CS_CNT_MAX);
2432+
SPI_DEVICE_CS_CNT_MAX);
24332433
if (rc < 0) {
24342434
dev_err(&ctlr->dev, "%pOF has no valid 'reg' property (%d)\n",
24352435
nc, rc);
@@ -3313,7 +3313,7 @@ int spi_register_controller(struct spi_controller *ctlr)
33133313
}
33143314

33153315
/* 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++)
33173317
ctlr->last_cs[idx] = SPI_INVALID_CS;
33183318

33193319
status = device_add(&ctlr->dev);

include/linux/spi/spi.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <uapi/linux/spi/spi.h>
2222

2323
/* Max no. of CS supported per spi device */
24-
#define SPI_CS_CNT_MAX 4
24+
#define SPI_DEVICE_CS_CNT_MAX 4
2525

2626
struct dma_chan;
2727
struct software_node;
@@ -229,7 +229,7 @@ struct spi_device {
229229
struct spi_delay cs_hold;
230230
struct spi_delay cs_inactive;
231231

232-
u8 chip_select[SPI_CS_CNT_MAX];
232+
u8 chip_select[SPI_DEVICE_CS_CNT_MAX];
233233
u8 num_chipselect;
234234

235235
/*
@@ -238,9 +238,9 @@ struct spi_device {
238238
* multiple chip selects & memories are connected in parallel
239239
* then more than one bit need to be set in cs_index_mask.
240240
*/
241-
u32 cs_index_mask : SPI_CS_CNT_MAX;
241+
u32 cs_index_mask : SPI_DEVICE_CS_CNT_MAX;
242242

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 */
244244

245245
/*
246246
* Likely need more hooks for more protocol options affecting how
@@ -721,8 +721,8 @@ struct spi_controller {
721721
bool auto_runtime_pm;
722722
bool fallback;
723723
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;
726726
struct completion xfer_completion;
727727
size_t max_dma_len;
728728

0 commit comments

Comments
 (0)