Merge xburst target.
[openwrt/staging/florian.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 diff --git a/drivers/spi/spi_gpio.c b/drivers/spi/spi_gpio.c
11 index 26bd03e..5f89c21 100644
12 --- a/drivers/spi/spi_gpio.c
13 +++ b/drivers/spi/spi_gpio.c
14 @@ -243,9 +243,11 @@ spi_gpio_request(struct spi_gpio_platform_data *pdata, const char *label)
15 if (value)
16 goto done;
17
18 - value = spi_gpio_alloc(SPI_MISO_GPIO, label, true);
19 - if (value)
20 - goto free_mosi;
21 + if (SPI_MISO_GPIO != SPI_MOSI_GPIO) {
22 + value = spi_gpio_alloc(SPI_MISO_GPIO, label, true);
23 + if (value)
24 + goto free_mosi;
25 + }
26
27 value = spi_gpio_alloc(SPI_SCK_GPIO, label, false);
28 if (value)
29 @@ -308,7 +310,8 @@ static int __init spi_gpio_probe(struct platform_device *pdev)
30 if (status < 0) {
31 spi_master_put(spi_gpio->bitbang.master);
32 gpio_free:
33 - gpio_free(SPI_MISO_GPIO);
34 + if (SPI_MISO_GPIO != SPI_MOSI_GPIO)
35 + gpio_free(SPI_MISO_GPIO);
36 gpio_free(SPI_MOSI_GPIO);
37 gpio_free(SPI_SCK_GPIO);
38 spi_master_put(master);
39 @@ -332,7 +335,8 @@ static int __exit spi_gpio_remove(struct platform_device *pdev)
40
41 platform_set_drvdata(pdev, NULL);
42
43 - gpio_free(SPI_MISO_GPIO);
44 + if (SPI_MISO_GPIO != SPI_MOSI_GPIO)
45 + gpio_free(SPI_MISO_GPIO);
46 gpio_free(SPI_MOSI_GPIO);
47 gpio_free(SPI_SCK_GPIO);
48
49 --
50 1.5.6.5
51