Skip to content

Commit 83c522f

Browse files
KanjiMonsterbroonie
authored andcommitted
spi: don't check spi_controller::num_chipselect when parsing a dt device
Do not validate spi_controller::num_chipselect against SPI_CS_CNT_MAX when parsing an spi device firmware node. Firstly this is the wrong place, and this should be done while registering/validating the controller. Secondly, there is no reason for that check, as SPI_CS_CNT_MAX controls the amount of chipselects a device may have, not a controller may have. So drop that check as it needlessly limits controllers to SPI_CS_CNT_MAX number of chipselects. Likewise, drop the check for number of device chipselects larger than controller's number of chipselects, as __spi_add_device() will already catch that as either one of the chip selects will be out of range, or there is a duplicate one. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Link: https://patch.msgid.link/20250915183725.219473-6-jonas.gorski@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent f3982da commit 83c522f

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

drivers/spi/spi.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2427,11 +2427,6 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
24272427
return 0;
24282428
}
24292429

2430-
if (ctlr->num_chipselect > SPI_CS_CNT_MAX) {
2431-
dev_err(&ctlr->dev, "No. of CS is more than max. no. of supported CS\n");
2432-
return -EINVAL;
2433-
}
2434-
24352430
/* Device address */
24362431
rc = of_property_read_variable_u32_array(nc, "reg", &cs[0], 1,
24372432
SPI_CS_CNT_MAX);
@@ -2440,11 +2435,7 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
24402435
nc, rc);
24412436
return rc;
24422437
}
2443-
if (rc > ctlr->num_chipselect) {
2444-
dev_err(&ctlr->dev, "%pOF has number of CS > ctlr->num_chipselect (%d)\n",
2445-
nc, rc);
2446-
return -EINVAL;
2447-
}
2438+
24482439
if ((of_property_present(nc, "parallel-memories")) &&
24492440
(!(ctlr->flags & SPI_CONTROLLER_MULTI_CS))) {
24502441
dev_err(&ctlr->dev, "SPI controller doesn't support multi CS\n");

0 commit comments

Comments
 (0)