diff options
author | Stephen Warren <swarren@wwwdotorg.org> | 2013-03-27 03:37:58 +0100 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-01 15:14:33 +0200 |
commit | f4b97eb5061256045e0f031b6a4bcf8c722b35ff (patch) | |
tree | 823ea30985327c098b07eaba70930461edb7fe50 /drivers/spi | |
parent | spi: add ability to validate xfer->bits_per_word in SPI core (diff) | |
download | linux-f4b97eb5061256045e0f031b6a4bcf8c722b35ff.tar.xz linux-f4b97eb5061256045e0f031b6a4bcf8c722b35ff.zip |
spi: bcm2835: make use of new bits_per_word_mask core feature
This driver only supports bits_per_word==8, so inform the SPI core of
this. Remove all the open-coded validation that's no longer needed.
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-bcm2835.c | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index 346601e2461d..89c0b5033114 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -182,23 +182,6 @@ static irqreturn_t bcm2835_spi_interrupt(int irq, void *dev_id) return IRQ_NONE; } -static int bcm2835_spi_check_transfer(struct spi_device *spi, - struct spi_transfer *tfr) -{ - /* tfr==NULL when called from bcm2835_spi_setup() */ - u32 bpw = tfr ? tfr->bits_per_word : spi->bits_per_word; - - switch (bpw) { - case 8: - break; - default: - dev_err(&spi->dev, "unsupported bits_per_word=%d\n", bpw); - return -EINVAL; - } - - return 0; -} - static int bcm2835_spi_start_transfer(struct spi_device *spi, struct spi_transfer *tfr) { @@ -273,19 +256,6 @@ static int bcm2835_spi_finish_transfer(struct spi_device *spi, return 0; } -static int bcm2835_spi_setup(struct spi_device *spi) -{ - int ret; - - ret = bcm2835_spi_check_transfer(spi, NULL); - if (ret) { - dev_err(&spi->dev, "setup: invalid message\n"); - return ret; - } - - return 0; -} - static int bcm2835_spi_transfer_one(struct spi_master *master, struct spi_message *mesg) { @@ -297,10 +267,6 @@ static int bcm2835_spi_transfer_one(struct spi_master *master, bool cs_change; list_for_each_entry(tfr, &mesg->transfers, transfer_list) { - err = bcm2835_spi_check_transfer(spi, tfr); - if (err) - goto out; - err = bcm2835_spi_start_transfer(spi, tfr); if (err) goto out; @@ -348,9 +314,9 @@ static int bcm2835_spi_probe(struct platform_device *pdev) platform_set_drvdata(pdev, master); master->mode_bits = BCM2835_SPI_MODE_BITS; + master->bits_per_word_mask = BIT(8 - 1); master->bus_num = -1; master->num_chipselect = 3; - master->setup = bcm2835_spi_setup; master->transfer_one_message = bcm2835_spi_transfer_one; master->dev.of_node = pdev->dev.of_node; |