* [PATCH] spi: use gpio_request_one() instead of spi_gpio_alloc() helper function
@ 2011-12-05 7:50 Axel Lin
2011-12-06 1:27 ` Denis Kuzmenko
2011-12-07 21:21 ` Wolfram Sang
0 siblings, 2 replies; 5+ messages in thread
From: Axel Lin @ 2011-12-05 7:50 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Linus Walleij
Signed-off-by: Axel Lin <axel.lin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/spi/spi-gpio.c | 21 ++++-----------------
1 files changed, 4 insertions(+), 17 deletions(-)
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index e093d3e..85c2eca 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -256,20 +256,6 @@ static void spi_gpio_cleanup(struct spi_device *spi)
spi_bitbang_cleanup(spi);
}
-static int __init spi_gpio_alloc(unsigned pin, const char *label, bool is_in)
-{
- int value;
-
- value = gpio_request(pin, label);
- if (value == 0) {
- if (is_in)
- value = gpio_direction_input(pin);
- else
- value = gpio_direction_output(pin, 0);
- }
- return value;
-}
-
static int __init
spi_gpio_request(struct spi_gpio_platform_data *pdata, const char *label,
u16 *res_flags)
@@ -279,7 +265,8 @@ spi_gpio_request(struct spi_gpio_platform_data *pdata, const char *label,
/* NOTE: SPI_*_GPIO symbols may reference "pdata" */
if (SPI_MOSI_GPIO != SPI_GPIO_NO_MOSI) {
- value = spi_gpio_alloc(SPI_MOSI_GPIO, label, false);
+ value = gpio_request_one(SPI_MOSI_GPIO, GPIOF_OUT_INIT_LOW,
+ label);
if (value)
goto done;
} else {
@@ -288,7 +275,7 @@ spi_gpio_request(struct spi_gpio_platform_data *pdata, const char *label,
}
if (SPI_MISO_GPIO != SPI_GPIO_NO_MISO) {
- value = spi_gpio_alloc(SPI_MISO_GPIO, label, true);
+ value = gpio_request_one(SPI_MISO_GPIO, GPIOF_IN, label);
if (value)
goto free_mosi;
} else {
@@ -296,7 +283,7 @@ spi_gpio_request(struct spi_gpio_platform_data *pdata, const char *label,
*res_flags |= SPI_MASTER_NO_RX;
}
- value = spi_gpio_alloc(SPI_SCK_GPIO, label, false);
+ value = gpio_request_one(SPI_SCK_GPIO, GPIOF_OUT_INIT_LOW, label);
if (value)
goto free_miso;
--
1.7.5.4
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] spi: use gpio_request_one() instead of spi_gpio_alloc() helper function
2011-12-05 7:50 [PATCH] spi: use gpio_request_one() instead of spi_gpio_alloc() helper function Axel Lin
@ 2011-12-06 1:27 ` Denis Kuzmenko
2011-12-07 21:21 ` Wolfram Sang
1 sibling, 0 replies; 5+ messages in thread
From: Denis Kuzmenko @ 2011-12-06 1:27 UTC (permalink / raw)
To: Axel Lin
Cc: linux-kernel, Wolfram Sang, Linus Walleij, Grant Likely,
spi-devel-general
On 12/05/2011 09:50 AM, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> drivers/spi/spi-gpio.c | 21 ++++-----------------
> 1 files changed, 4 insertions(+), 17 deletions(-)
Acked-by: Denis Kuzmenko <linux@solonet.org.ua>
--
Best regards, Denis Kuzmenko.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] spi: use gpio_request_one() instead of spi_gpio_alloc() helper function
2011-12-05 7:50 [PATCH] spi: use gpio_request_one() instead of spi_gpio_alloc() helper function Axel Lin
2011-12-06 1:27 ` Denis Kuzmenko
@ 2011-12-07 21:21 ` Wolfram Sang
2011-12-08 1:36 ` Axel Lin
1 sibling, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2011-12-07 21:21 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, spi-devel-general, Linus Walleij
[-- Attachment #1: Type: text/plain, Size: 453 bytes --]
On Mon, Dec 05, 2011 at 03:50:47PM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
This will make the driver depend on GPIOLIB, currently it depends only
on GENERIC_GPIO. That needs to be addressed and made sure it won't cause
a regression for the in-kernel users.
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] spi: use gpio_request_one() instead of spi_gpio_alloc() helper function
2011-12-07 21:21 ` Wolfram Sang
@ 2011-12-08 1:36 ` Axel Lin
2011-12-08 8:46 ` Wolfram Sang
0 siblings, 1 reply; 5+ messages in thread
From: Axel Lin @ 2011-12-08 1:36 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-kernel, spi-devel-general, Linus Walleij
2011/12/8 Wolfram Sang <w.sang@pengutronix.de>:
> On Mon, Dec 05, 2011 at 03:50:47PM +0800, Axel Lin wrote:
>> Signed-off-by: Axel Lin <axel.lin@gmail.com>
>
> This will make the driver depend on GPIOLIB, currently it depends only
> on GENERIC_GPIO. That needs to be addressed and made sure it won't cause
> a regression for the in-kernel users.
>
Ah. You are right.
GPIOLIB can be optional or not available at all in some
architecture/configurations.
Thanks for your review.
Axel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] spi: use gpio_request_one() instead of spi_gpio_alloc() helper function
2011-12-08 1:36 ` Axel Lin
@ 2011-12-08 8:46 ` Wolfram Sang
0 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2011-12-08 8:46 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, spi-devel-general, Linus Walleij
[-- Attachment #1: Type: text/plain, Size: 812 bytes --]
On Thu, Dec 08, 2011 at 09:36:23AM +0800, Axel Lin wrote:
> 2011/12/8 Wolfram Sang <w.sang@pengutronix.de>:
> > On Mon, Dec 05, 2011 at 03:50:47PM +0800, Axel Lin wrote:
> >> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> >
> > This will make the driver depend on GPIOLIB, currently it depends only
> > on GENERIC_GPIO. That needs to be addressed and made sure it won't cause
> > a regression for the in-kernel users.
> >
> Ah. You are right.
> GPIOLIB can be optional or not available at all in some
> architecture/configurations.
> Thanks for your review.
Note that there are plans to make GPIOLIB mandatory, but we are not there yet.
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-12-08 8:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-05 7:50 [PATCH] spi: use gpio_request_one() instead of spi_gpio_alloc() helper function Axel Lin
2011-12-06 1:27 ` Denis Kuzmenko
2011-12-07 21:21 ` Wolfram Sang
2011-12-08 1:36 ` Axel Lin
2011-12-08 8:46 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).