1 From c5bfb0c760a5d8de7ffc3a6acfb8c782be6af1a5 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Mon, 9 Jan 2012 15:04:21 +0100
4 Subject: [PATCH 4/7] spi/ath79: use gpio_request_one
6 Use gpio_request_one() instead of multiple gpiolib calls.
8 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
10 drivers/spi/spi-ath79.c | 26 +++++++++++++-------------
11 1 files changed, 13 insertions(+), 13 deletions(-)
13 --- a/drivers/spi/spi-ath79.c
14 +++ b/drivers/spi/spi-ath79.c
15 @@ -93,6 +93,7 @@ static int ath79_spi_setup_cs(struct spi
17 struct ath79_spi *sp = ath79_spidev_to_sp(spi);
18 struct ath79_spi_controller_data *cdata;
21 cdata = spi->controller_data;
22 if (spi->chip_select && !cdata)
23 @@ -108,22 +109,21 @@ static int ath79_spi_setup_cs(struct spi
24 /* TODO: setup speed? */
25 ath79_spi_wr(sp, AR71XX_SPI_REG_CTRL, 0x43);
28 if (spi->chip_select) {
30 + unsigned long flags;
32 - status = gpio_request(cdata->gpio, dev_name(&spi->dev));
35 + flags = GPIOF_DIR_OUT;
36 + if (spi->mode & SPI_CS_HIGH)
37 + flags |= GPIOF_INIT_HIGH;
39 + flags |= GPIOF_INIT_LOW;
41 - status = gpio_direction_output(cdata->gpio,
42 - spi->mode & SPI_CS_HIGH);
44 - gpio_free(cdata->gpio);
47 + status = gpio_request_one(cdata->gpio, flags,
48 + dev_name(&spi->dev));
55 static void ath79_spi_cleanup_cs(struct spi_device *spi)