update to 2.6.32.7
[openwrt-10.03/.git] / target / linux / xburst / patches-2.6.32 / 400-spi-gpio-3wire.patch
1 From df07ed6a52d9f6027ff1753c00b3128fa18dde31 Mon Sep 17 00:00:00 2001
2 From: Lars-Peter Clausen <lars@metafoo.de>
3 Date: Mon, 11 Jan 2010 04:29:48 +0100
4 Subject: [PATCH] /opt/Projects/openwrt/target/linux/xburst/patches-2.6.31/400-spi-gpio-3wire.patch
5
6 ---
7  drivers/spi/spi_gpio.c |   14 +++++++++-----
8  1 files changed, 9 insertions(+), 5 deletions(-)
9
10 --- a/drivers/spi/spi_gpio.c
11 +++ b/drivers/spi/spi_gpio.c
12 @@ -254,9 +254,11 @@ spi_gpio_request(struct spi_gpio_platfor
13         if (value)
14                 goto done;
15  
16 -       value = spi_gpio_alloc(SPI_MISO_GPIO, label, true);
17 -       if (value)
18 -               goto free_mosi;
19 +       if (SPI_MISO_GPIO != SPI_MOSI_GPIO) {
20 +               value = spi_gpio_alloc(SPI_MISO_GPIO, label, true);
21 +               if (value)
22 +                       goto free_mosi;
23 +       }
24  
25         value = spi_gpio_alloc(SPI_SCK_GPIO, label, false);
26         if (value)
27 @@ -319,7 +321,8 @@ static int __devinit spi_gpio_probe(stru
28         if (status < 0) {
29                 spi_master_put(spi_gpio->bitbang.master);
30  gpio_free:
31 -               gpio_free(SPI_MISO_GPIO);
32 +               if (SPI_MISO_GPIO != SPI_MOSI_GPIO)
33 +                       gpio_free(SPI_MISO_GPIO);
34                 gpio_free(SPI_MOSI_GPIO);
35                 gpio_free(SPI_SCK_GPIO);
36                 spi_master_put(master);
37 @@ -343,7 +346,8 @@ static int __devexit spi_gpio_remove(str
38  
39         platform_set_drvdata(pdev, NULL);
40  
41 -       gpio_free(SPI_MISO_GPIO);
42 +       if (SPI_MISO_GPIO != SPI_MOSI_GPIO)
43 +               gpio_free(SPI_MISO_GPIO);
44         gpio_free(SPI_MOSI_GPIO);
45         gpio_free(SPI_SCK_GPIO);
46