[brcm63xx] led and buttons support for board DWV-S0
[openwrt.git] / target / linux / brcm63xx / patches-3.8 / 009-spi-bcm63xx-check-spi-bits_per_word-in-spi_setup.patch
1 From 13a364be644ed9b4666d452756556bb98afdcc56 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Mon, 11 Mar 2013 13:48:27 +0100
4 Subject: [PATCH 07/12] spi/bcm63xx: check spi bits_per_word in spi_setup
5
6 Instead of fixing up the bits_per_word (which the spi subsystem already
7 does for us), check it for supported values.
8
9 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
10 ---
11  drivers/spi/spi-bcm63xx.c |    7 +++++--
12  1 file changed, 5 insertions(+), 2 deletions(-)
13
14 --- a/drivers/spi/spi-bcm63xx.c
15 +++ b/drivers/spi/spi-bcm63xx.c
16 @@ -151,8 +151,11 @@ static void bcm63xx_spi_setup_transfer(s
17  
18  static int bcm63xx_spi_setup(struct spi_device *spi)
19  {
20 -       if (!spi->bits_per_word)
21 -               spi->bits_per_word = 8;
22 +       if (spi->bits_per_word != 8) {
23 +               dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
24 +                       __func__, spi->bits_per_word);
25 +               return -EINVAL;
26 +       }
27  
28         return 0;
29  }