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
6 commit 95d79419feffb326a3d5cb50e2248129dec06bb0 upstream.
8 Use gpio_request_one() instead of multiple gpiolib calls.
10 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
11 Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
13 drivers/spi/spi-ath79.c | 22 +++++++++++-----------
14 1 file changed, 11 insertions(+), 11 deletions(-)
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
20 struct ath79_spi *sp = ath79_spidev_to_sp(spi);
21 struct ath79_spi_controller_data *cdata;
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);
31 if (spi->chip_select) {
33 + unsigned long flags;
35 - status = gpio_request(cdata->gpio, dev_name(&spi->dev));
39 - status = gpio_direction_output(cdata->gpio,
40 - spi->mode & SPI_CS_HIGH);
42 - gpio_free(cdata->gpio);
45 + flags = GPIOF_DIR_OUT;
46 + if (spi->mode & SPI_CS_HIGH)
47 + flags |= GPIOF_INIT_HIGH;
49 + flags |= GPIOF_INIT_LOW;
51 + status = gpio_request_one(cdata->gpio, flags,
52 + dev_name(&spi->dev));
59 static void ath79_spi_cleanup_cs(struct spi_device *spi)