aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorBob Liu <lliubbo@gmail.com>2010-09-16 23:46:22 -0400
committerMike Frysinger <vapier@gentoo.org>2010-10-18 02:49:43 -0400
commit2e768659df35ea337cb57ea3573c918d31e07894 (patch)
tree3076e57dd4b733ed31da18c6b8c5c74eb518f5c1 /drivers/spi
parent4190f6a51f3f9c7c8298202d31b3ead9381c33f1 (diff)
spi/bfin_spi: check per-transfer bits_per_word
Currently, if the bits_per_word when doing a transfer is not 8bits, we always treat it as 16bits when we should actually be returning an error. Signed-off-by: Bob Liu <lliubbo@gmail.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi_bfin5xx.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index 21de8605dbce..bd182145bc2c 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -644,11 +644,16 @@ static void bfin_spi_pump_transfers(unsigned long data)
644 drv_data->len = transfer->len; 644 drv_data->len = transfer->len;
645 cr_width = 0; 645 cr_width = 0;
646 drv_data->ops = &bfin_transfer_ops_u8; 646 drv_data->ops = &bfin_transfer_ops_u8;
647 } else { 647 } else if (bits_per_word == 16) {
648 drv_data->n_bytes = 2; 648 drv_data->n_bytes = 2;
649 drv_data->len = (transfer->len) >> 1; 649 drv_data->len = (transfer->len) >> 1;
650 cr_width = BIT_CTL_WORDSIZE; 650 cr_width = BIT_CTL_WORDSIZE;
651 drv_data->ops = &bfin_transfer_ops_u16; 651 drv_data->ops = &bfin_transfer_ops_u16;
652 } else {
653 dev_err(&drv_data->pdev->dev, "transfer: unsupported bits_per_word\n");
654 message->status = -EINVAL;
655 bfin_spi_giveback(drv_data);
656 return;
652 } 657 }
653 cr = read_CTRL(drv_data) & ~(BIT_CTL_TIMOD | BIT_CTL_WORDSIZE); 658 cr = read_CTRL(drv_data) & ~(BIT_CTL_TIMOD | BIT_CTL_WORDSIZE);
654 cr |= cr_width; 659 cr |= cr_width;