spi: s3c24xx: Convert to let spi core validate bits_per_word
Subsystems (3)
PATCH 1/1 spi: s3c24xx: Convert to let spi core validate bits_per_word
Set bits_per_word_mask so spi core will reject transfers that attempt to use an unsupported bits_per_word value.
Signed-off-by Axel Lin <[email protected]>
--- drivers/spi/spi-s3c24xx.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/spi/spi-s3c24xx.c +1 -10
@@ -122,25 +122,15 @@ static int s3c24xx_spi_update_state(struct spi_device *spi, {struct s3c24xx_spi *hw =to_hw (spi);struct s3c24xx_spi_devstate *cs = spi->controller_state; -unsigned int bpw;unsigned int hz;unsigned int div;unsigned long clk; - bpw = t ? t->bits_per_word : spi->bits_per_word; hz = t ? t->speed_hz : spi->max_speed_hz; -if (!bpw) - bpw =8 ; -if (!hz) hz = spi->max_speed_hz; -if (bpw !=8 ) { -dev_err (&spi->dev,"invalid bits-per-word (%d)\n" , bpw); -return -EINVAL ; - } -if (spi->mode != cs->mode) {u8 spcon =SPCON_DEFAULT |S3C2410_SPCON_ENSCK ;
@@ -543,6 +533,7 @@ static int s3c24xx_spi_probe(struct platform_device *pdev) master->num_chipselect = hw->pdata->num_cs; master->bus_num = pdata->bus_num; + master->bits_per_word_mask =SPI_BPW_MASK (8 );/* setup the state for the bitbang driver */
Signature · 8 lines
1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Mark Brown
AppliedQuoted 2 lines · Axel Lin
Set
bits_per_word_maskso spi core will reject transfers that attempt to use an unsupportedbits_per_wordvalue.
Applied, thanks.