ar71xx: remove the xfrm.h chunk from the unaligned access hacks, it breaks ipsec
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / patches-3.8 / 004-spi-ath79-use-gpio_request_one.patch
1 From f0b166c931c9971f2ae9614881565d23f58b3178 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Thu, 27 Dec 2012 10:42:27 +0100
4 Subject: [PATCH] spi/ath79: use gpio_request_one
5
6 commit 95d79419feffb326a3d5cb50e2248129dec06bb0 upstream.
7
8 Use gpio_request_one() instead of multiple gpiolib calls.
9
10 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
11 Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
12 ---
13 drivers/spi/spi-ath79.c | 22 +++++++++++-----------
14 1 file changed, 11 insertions(+), 11 deletions(-)
15
16 --- a/drivers/spi/spi-ath79.c
17 +++ b/drivers/spi/spi-ath79.c
18 @@ -100,6 +100,7 @@ static int ath79_spi_setup_cs(struct spi
19 {
20 struct ath79_spi *sp = ath79_spidev_to_sp(spi);
21 struct ath79_spi_controller_data *cdata;
22 + int status;
23
24 cdata = spi->controller_data;
25 if (spi->chip_select && !cdata)
26 @@ -115,22 +116,21 @@ static int ath79_spi_setup_cs(struct spi
27 /* TODO: setup speed? */
28 ath79_spi_wr(sp, AR71XX_SPI_REG_CTRL, 0x43);
29
30 + status = 0;
31 if (spi->chip_select) {
32 - int status = 0;
33 + unsigned long flags;
34
35 - status = gpio_request(cdata->gpio, dev_name(&spi->dev));
36 - if (status)
37 - return status;
38 -
39 - status = gpio_direction_output(cdata->gpio,
40 - spi->mode & SPI_CS_HIGH);
41 - if (status) {
42 - gpio_free(cdata->gpio);
43 - return status;
44 - }
45 + flags = GPIOF_DIR_OUT;
46 + if (spi->mode & SPI_CS_HIGH)
47 + flags |= GPIOF_INIT_HIGH;
48 + else
49 + flags |= GPIOF_INIT_LOW;
50 +
51 + status = gpio_request_one(cdata->gpio, flags,
52 + dev_name(&spi->dev));
53 }
54
55 - return 0;
56 + return status;
57 }
58
59 static void ath79_spi_cleanup_cs(struct spi_device *spi)