spi: s3c24xx: Convert to let spi core validate bits_per_word
authorAxel Lin <axel.lin@ingics.com>
Fri, 14 Feb 2014 12:38:16 +0000 (20:38 +0800)
committerMark Brown <broonie@linaro.org>
Fri, 14 Feb 2014 18:08:07 +0000 (18:08 +0000)
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 <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi-s3c24xx.c

index 746424aa5353fb2a779b04c0fc93aae0163da0ea..f1ffbfa6acef3b6afb75d45ce3562758f88be3a5 100644 (file)
@@ -123,25 +123,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;
 
@@ -544,6 +534,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 */