linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: mx5/babbage: Remove unneeded gpio_set_value call
@ 2011-03-14 18:21 Fabio Estevam
  2011-03-14 18:21 ` [PATCH 2/2] ARM: mx5/mx53_evk: " Fabio Estevam
  0 siblings, 1 reply; 20+ messages in thread
From: Fabio Estevam @ 2011-03-14 18:21 UTC (permalink / raw)
  To: linux-arm-kernel

gpio_direction_output has already set the port at low logical level, so it is not needed
to call gpio_set_value to set the port to 0 again.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 arch/arm/mach-mx5/board-mx51_babbage.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index b2ecd19..9b6c868 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -234,7 +234,6 @@ static inline void babbage_fec_reset(void)
 		return;
 	}
 	gpio_direction_output(BABBAGE_FEC_PHY_RESET, 0);
-	gpio_set_value(BABBAGE_FEC_PHY_RESET, 0);
 	msleep(1);
 	gpio_set_value(BABBAGE_FEC_PHY_RESET, 1);
 }
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-14 18:21 [PATCH 1/2] ARM: mx5/babbage: Remove unneeded gpio_set_value call Fabio Estevam
@ 2011-03-14 18:21 ` Fabio Estevam
  2011-03-15  9:06   ` Uwe Kleine-König
  0 siblings, 1 reply; 20+ messages in thread
From: Fabio Estevam @ 2011-03-14 18:21 UTC (permalink / raw)
  To: linux-arm-kernel

gpio_direction_output has already set the port at low logical level, so it is not needed
to call gpio_set_value to set the port to 0 again.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 arch/arm/mach-mx5/board-mx53_evk.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c
index 652e1e0..78abce6 100644
--- a/arch/arm/mach-mx5/board-mx53_evk.c
+++ b/arch/arm/mach-mx5/board-mx53_evk.c
@@ -90,7 +90,6 @@ static inline void mx53_evk_fec_reset(void)
 		return;
 	}
 	gpio_direction_output(SMD_FEC_PHY_RST, 0);
-	gpio_set_value(SMD_FEC_PHY_RST, 0);
 	msleep(1);
 	gpio_set_value(SMD_FEC_PHY_RST, 1);
 }
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-14 18:21 ` [PATCH 2/2] ARM: mx5/mx53_evk: " Fabio Estevam
@ 2011-03-15  9:06   ` Uwe Kleine-König
  2011-03-15  9:41     ` Julia Lawall
  0 siblings, 1 reply; 20+ messages in thread
From: Uwe Kleine-König @ 2011-03-15  9:06 UTC (permalink / raw)
  To: linux-arm-kernel

[added Julia Lawall to Cc:]

Hello Fabio,

ack for both.

Julia: Maybe coccinelle can find more of these?

Best regards
Uwe

On Mon, Mar 14, 2011 at 03:21:09PM -0300, Fabio Estevam wrote:
> gpio_direction_output has already set the port at low logical level, so it is not needed
> to call gpio_set_value to set the port to 0 again.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  arch/arm/mach-mx5/board-mx53_evk.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c
> index 652e1e0..78abce6 100644
> --- a/arch/arm/mach-mx5/board-mx53_evk.c
> +++ b/arch/arm/mach-mx5/board-mx53_evk.c
> @@ -90,7 +90,6 @@ static inline void mx53_evk_fec_reset(void)
>  		return;
>  	}
>  	gpio_direction_output(SMD_FEC_PHY_RST, 0);
> -	gpio_set_value(SMD_FEC_PHY_RST, 0);
>  	msleep(1);
>  	gpio_set_value(SMD_FEC_PHY_RST, 1);
>  }
> -- 
> 1.6.0.4

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-15  9:06   ` Uwe Kleine-König
@ 2011-03-15  9:41     ` Julia Lawall
  2011-03-15  9:49       ` Uwe Kleine-König
  0 siblings, 1 reply; 20+ messages in thread
From: Julia Lawall @ 2011-03-15  9:41 UTC (permalink / raw)
  To: linux-arm-kernel

I tried the following

@@
expression E1,E2;
@@

      gpio_direction_output(E1,E2);
      ...
-     gpio_set_value(E1,E2);

and found occurrences in 15 files.  In some cases there seems to be some 
delay before the call to gpio_set_value.  Does that have any impacton 
whether it is needed?

julia



On Tue, 15 Mar 2011, Uwe Kleine-K?nig wrote:

> [added Julia Lawall to Cc:]
> 
> Hello Fabio,
> 
> ack for both.
> 
> Julia: Maybe coccinelle can find more of these?
> 
> Best regards
> Uwe
> 
> On Mon, Mar 14, 2011 at 03:21:09PM -0300, Fabio Estevam wrote:
> > gpio_direction_output has already set the port at low logical level, so it is not needed
> > to call gpio_set_value to set the port to 0 again.
> > 
> > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> > ---
> >  arch/arm/mach-mx5/board-mx53_evk.c |    1 -
> >  1 files changed, 0 insertions(+), 1 deletions(-)
> > 
> > diff --git a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c
> > index 652e1e0..78abce6 100644
> > --- a/arch/arm/mach-mx5/board-mx53_evk.c
> > +++ b/arch/arm/mach-mx5/board-mx53_evk.c
> > @@ -90,7 +90,6 @@ static inline void mx53_evk_fec_reset(void)
> >  		return;
> >  	}
> >  	gpio_direction_output(SMD_FEC_PHY_RST, 0);
> > -	gpio_set_value(SMD_FEC_PHY_RST, 0);
> >  	msleep(1);
> >  	gpio_set_value(SMD_FEC_PHY_RST, 1);
> >  }
> > -- 
> > 1.6.0.4
> 
> -- 
> Pengutronix e.K.                           | Uwe Kleine-K?nig            |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-15  9:41     ` Julia Lawall
@ 2011-03-15  9:49       ` Uwe Kleine-König
  2011-03-15 10:19         ` Julia Lawall
  0 siblings, 1 reply; 20+ messages in thread
From: Uwe Kleine-König @ 2011-03-15  9:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 15, 2011 at 10:41:37AM +0100, Julia Lawall wrote:
> I tried the following
> 
> @@
> expression E1,E2;
> @@
> 
>       gpio_direction_output(E1,E2);
>       ...
> -     gpio_set_value(E1,E2);
> 
> and found occurrences in 15 files.  In some cases there seems to be some 
> delay before the call to gpio_set_value.  Does that have any impacton 
> whether it is needed?
gpio_direction_output(E1,E2) implies gpio_set_value(E1,E2), so unless
there is a gpio_set_value(E1,!E2) before gpio_set_value(E1,E2) is a
noop.

I still don't know how to work with coccinelle, so if you point me to a
concrete location I can be more specific.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-15  9:49       ` Uwe Kleine-König
@ 2011-03-15 10:19         ` Julia Lawall
  2011-03-15 10:29           ` Wolfram Sang
                             ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Julia Lawall @ 2011-03-15 10:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 15 Mar 2011, Uwe Kleine-K?nig wrote:

> On Tue, Mar 15, 2011 at 10:41:37AM +0100, Julia Lawall wrote:
> > I tried the following
> > 
> > @@
> > expression E1,E2;
> > @@
> > 
> >       gpio_direction_output(E1,E2);
> >       ...
> > -     gpio_set_value(E1,E2);
> > 
> > and found occurrences in 15 files.  In some cases there seems to be some 
> > delay before the call to gpio_set_value.  Does that have any impacton 
> > whether it is needed?
> gpio_direction_output(E1,E2) implies gpio_set_value(E1,E2), so unless
> there is a gpio_set_value(E1,!E2) before gpio_set_value(E1,E2) is a
> noop.
> 
> I still don't know how to work with coccinelle, so if you point me to a
> concrete location I can be more specific.

OK.  I have changed the semantic patch to the following:

@@
expression E1,E2,E3;
@@

      gpio_direction_output(E1,E2);
      ... when != gpio_set_value(E1,E3)
-     gpio_set_value(E1,E2);

Now it doesn't do all the cases where there is an earlier set ofr some 
other value.  The patch I obtain is below.  This only concerns 5 files.  
I haven't checked the result at all.

julia


diff -u -p a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
--- a/arch/arm/mach-mx5/board-mx51_babbage.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c 2011-03-15 11:17:03.000000000 +0100
@@ -218,7 +218,6 @@ static inline void babbage_usbhub_reset(
 
 	/* USB HUB RESET - De-assert USB HUB RESET_N */
 	msleep(1);
-	gpio_set_value(BABBAGE_USB_HUB_RESET, 0);
 	msleep(1);
 	gpio_set_value(BABBAGE_USB_HUB_RESET, 1);
 }
@@ -234,7 +233,6 @@ static inline void babbage_fec_reset(voi
 		return;
 	}
 	gpio_direction_output(BABBAGE_FEC_PHY_RESET, 0);
-	gpio_set_value(BABBAGE_FEC_PHY_RESET, 0);
 	msleep(1);
 	gpio_set_value(BABBAGE_FEC_PHY_RESET, 1);
 }
diff -u -p a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c
--- a/arch/arm/mach-mx5/board-mx53_evk.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx53_evk.c 2011-03-15 11:17:03.000000000 +0100
@@ -88,7 +88,6 @@ static inline void mx53_evk_fec_reset(vo
 		return;
 	}
 	gpio_direction_output(SMD_FEC_PHY_RST, 0);
-	gpio_set_value(SMD_FEC_PHY_RST, 0);
 	msleep(1);
 	gpio_set_value(SMD_FEC_PHY_RST, 1);
 }
diff -u -p a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
--- a/arch/arm/mach-omap2/board-omap3evm.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-omap3evm.c 2011-03-15 11:17:04.000000000 +0100
@@ -860,7 +860,6 @@ static void __init omap3_evm_init(void)
 		omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP);
 		gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port");
 		gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0);
-		gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0);
 
 		/* setup EHCI phy reset config */
 		omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
diff -u -p a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
--- a/arch/arm/mach-omap2/board-omap4panda.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-omap4panda.c 2011-03-15 11:17:04.000000000 +0100
@@ -129,7 +129,6 @@ static void __init omap4_ehci_init(void)
 	}
 	gpio_export(GPIO_HUB_POWER, 0);
 	gpio_direction_output(GPIO_HUB_POWER, 0);
-	gpio_set_value(GPIO_HUB_POWER, 0);
 
 	/* reset phy+hub */
 	ret = gpio_request(GPIO_HUB_NRESET, "hub_nreset");
@@ -139,7 +138,6 @@ static void __init omap4_ehci_init(void)
 	}
 	gpio_export(GPIO_HUB_NRESET, 0);
 	gpio_direction_output(GPIO_HUB_NRESET, 0);
-	gpio_set_value(GPIO_HUB_NRESET, 0);
 	gpio_set_value(GPIO_HUB_NRESET, 1);
 
 	usbhs_init(&usbhs_bdata);
diff -u -p a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c
--- a/arch/arm/mach-pxa/am300epd.c 2010-03-18 09:06:45.000000000 +0100
+++ b/arch/arm/mach-pxa/am300epd.c 2011-03-15 11:17:04.000000000 +0100
@@ -150,8 +150,6 @@ static int am300_init_gpio_regs(struct b
 		gpio_direction_output(i, 0);
 
 	/* go into command mode */
-	gpio_set_value(CFG_GPIO_PIN, 1);
-	gpio_set_value(RST_GPIO_PIN, 0);
 	msleep(10);
 	gpio_set_value(RST_GPIO_PIN, 1);
 	msleep(10);

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-15 10:19         ` Julia Lawall
@ 2011-03-15 10:29           ` Wolfram Sang
  2011-03-16  8:33           ` Uwe Kleine-König
  2011-03-21  7:48           ` Grant Likely
  2 siblings, 0 replies; 20+ messages in thread
From: Wolfram Sang @ 2011-03-15 10:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 15, 2011 at 11:19:53AM +0100, Julia Lawall wrote:
> On Tue, 15 Mar 2011, Uwe Kleine-K?nig wrote:
> 
> > On Tue, Mar 15, 2011 at 10:41:37AM +0100, Julia Lawall wrote:
> > > I tried the following
> > > 
> > > @@
> > > expression E1,E2;
> > > @@
> > > 
> > >       gpio_direction_output(E1,E2);
> > >       ...
> > > -     gpio_set_value(E1,E2);
> > > 
> > > and found occurrences in 15 files.  In some cases there seems to be some 
> > > delay before the call to gpio_set_value.  Does that have any impacton 
> > > whether it is needed?
> > gpio_direction_output(E1,E2) implies gpio_set_value(E1,E2), so unless
> > there is a gpio_set_value(E1,!E2) before gpio_set_value(E1,E2) is a
> > noop.
> > 
> > I still don't know how to work with coccinelle, so if you point me to a
> > concrete location I can be more specific.
> 
> OK.  I have changed the semantic patch to the following:
> 
> @@
> expression E1,E2,E3;
> @@
> 
>       gpio_direction_output(E1,E2);
>       ... when != gpio_set_value(E1,E3)
> -     gpio_set_value(E1,E2);
> 
> Now it doesn't do all the cases where there is an earlier set ofr some 
> other value.  The patch I obtain is below.  This only concerns 5 files.  
> I haven't checked the result at all.

It should also be checked if gpio_request_one is the better solution.

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110315/cf54587d/attachment.sig>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-15 10:19         ` Julia Lawall
  2011-03-15 10:29           ` Wolfram Sang
@ 2011-03-16  8:33           ` Uwe Kleine-König
  2011-03-16  9:15             ` Julia Lawall
                               ` (2 more replies)
  2011-03-21  7:48           ` Grant Likely
  2 siblings, 3 replies; 20+ messages in thread
From: Uwe Kleine-König @ 2011-03-16  8:33 UTC (permalink / raw)
  To: linux-arm-kernel

[added some people to Cc:]

Hello Julia,

On Tue, Mar 15, 2011 at 11:19:53AM +0100, Julia Lawall wrote:
> On Tue, 15 Mar 2011, Uwe Kleine-K?nig wrote:
> 
> > On Tue, Mar 15, 2011 at 10:41:37AM +0100, Julia Lawall wrote:
> > > I tried the following
> > > 
> > > @@
> > > expression E1,E2;
> > > @@
> > > 
> > >       gpio_direction_output(E1,E2);
> > >       ...
> > > -     gpio_set_value(E1,E2);
> > > 
> > > and found occurrences in 15 files.  In some cases there seems to be some 
> > > delay before the call to gpio_set_value.  Does that have any impacton 
> > > whether it is needed?
> > gpio_direction_output(E1,E2) implies gpio_set_value(E1,E2), so unless
> > there is a gpio_set_value(E1,!E2) before gpio_set_value(E1,E2) is a
> > noop.
> > 
> > I still don't know how to work with coccinelle, so if you point me to a
> > concrete location I can be more specific.
> 
> OK.  I have changed the semantic patch to the following:
> 
> @@
> expression E1,E2,E3;
> @@
> 
>       gpio_direction_output(E1,E2);
>       ... when != gpio_set_value(E1,E3)
> -     gpio_set_value(E1,E2);
> 
> Now it doesn't do all the cases where there is an earlier set ofr some 
> other value.  The patch I obtain is below.  This only concerns 5 files.  
> I haven't checked the result at all.
Thanks. So here comes the check.

> diff -u -p a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
> --- a/arch/arm/mach-mx5/board-mx51_babbage.c 2011-02-19 08:28:51.000000000 +0100
> +++ b/arch/arm/mach-mx5/board-mx51_babbage.c 2011-03-15 11:17:03.000000000 +0100
> @@ -218,7 +218,6 @@ static inline void babbage_usbhub_reset(
>  
>  	/* USB HUB RESET - De-assert USB HUB RESET_N */
>  	msleep(1);
> -	gpio_set_value(BABBAGE_USB_HUB_RESET, 0);
>  	msleep(1);
>  	gpio_set_value(BABBAGE_USB_HUB_RESET, 1);
>  }
This function is a bit confusing:

	/* Bring USB hub out of reset */
	ret = gpio_request(BABBAGE_USB_HUB_RESET, "GPIO1_7");
	if (ret) {
		...
		return;
	}
	gpio_direction_output(BABBAGE_USB_HUB_RESET, 0);
	/* USB HUB RESET - De-assert USB HUB RESET_N */
	msleep(1);
	gpio_set_value(BABBAGE_USB_HUB_RESET, 0);
	msleep(1);
	gpio_set_value(BABBAGE_USB_HUB_RESET, 1);

IMHO the comments are misleading.  I'd suggest:

	ret = gpio_request_one(BABBAGE_USB_HUB_RESET,
			GPIOF_DIR_OUT | GPIOF_INIT_LOW, "USB hub reset#");
	if (ret) {
		pr_err("failed to request gpio for USB hub reset#: %d\n", ret);
		return;
	}
	msleep(2);
	gpio_set_value(BABBAGE_USB_HUB_RESET, 1);

Fabio?

> @@ -234,7 +233,6 @@ static inline void babbage_fec_reset(voi
>  		return;
>  	}
>  	gpio_direction_output(BABBAGE_FEC_PHY_RESET, 0);
> -	gpio_set_value(BABBAGE_FEC_PHY_RESET, 0);
>  	msleep(1);
>  	gpio_set_value(BABBAGE_FEC_PHY_RESET, 1);
>  }
should use
	gpio_request_one(BABBAGE_FEC_PHY_RESET,
		GPIOF_DIR_OUT | GPIOF_INIT_LOW, "fec-phy-reset");

> diff -u -p a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c
> --- a/arch/arm/mach-mx5/board-mx53_evk.c 2011-03-14 17:19:13.000000000 +0100
> +++ b/arch/arm/mach-mx5/board-mx53_evk.c 2011-03-15 11:17:03.000000000 +0100
> @@ -88,7 +88,6 @@ static inline void mx53_evk_fec_reset(vo
>  		return;
>  	}
>  	gpio_direction_output(SMD_FEC_PHY_RST, 0);
> -	gpio_set_value(SMD_FEC_PHY_RST, 0);
>  	msleep(1);
>  	gpio_set_value(SMD_FEC_PHY_RST, 1);
>  }
ditto

> diff -u -p a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
> --- a/arch/arm/mach-omap2/board-omap3evm.c 2011-03-14 17:19:13.000000000 +0100
> +++ b/arch/arm/mach-omap2/board-omap3evm.c 2011-03-15 11:17:04.000000000 +0100
> @@ -860,7 +860,6 @@ static void __init omap3_evm_init(void)
>  		omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP);
>  		gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port");
>  		gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0);
> -		gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0);
>  
>  		/* setup EHCI phy reset config */
>  		omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
ditto

> diff -u -p a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
> --- a/arch/arm/mach-omap2/board-omap4panda.c 2011-03-14 17:19:13.000000000 +0100
> +++ b/arch/arm/mach-omap2/board-omap4panda.c 2011-03-15 11:17:04.000000000 +0100
> @@ -129,7 +129,6 @@ static void __init omap4_ehci_init(void)
>  	}
>  	gpio_export(GPIO_HUB_POWER, 0);
>  	gpio_direction_output(GPIO_HUB_POWER, 0);
> -	gpio_set_value(GPIO_HUB_POWER, 0);
Should use gpio_request_one, too. And IMHO gpio_export should only be
called after the direction is set (which is an obsolete comment when
gpio_request_one is used).
  
>  	/* reset phy+hub */
>  	ret = gpio_request(GPIO_HUB_NRESET, "hub_nreset");
> @@ -139,7 +138,6 @@ static void __init omap4_ehci_init(void)
>  	}
>  	gpio_export(GPIO_HUB_NRESET, 0);
>  	gpio_direction_output(GPIO_HUB_NRESET, 0);
> -	gpio_set_value(GPIO_HUB_NRESET, 0);
>  	gpio_set_value(GPIO_HUB_NRESET, 1);
>  
>  	usbhs_init(&usbhs_bdata);
ditto

> diff -u -p a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c
> --- a/arch/arm/mach-pxa/am300epd.c 2010-03-18 09:06:45.000000000 +0100
> +++ b/arch/arm/mach-pxa/am300epd.c 2011-03-15 11:17:04.000000000 +0100
> @@ -150,8 +150,6 @@ static int am300_init_gpio_regs(struct b
>  		gpio_direction_output(i, 0);
>  
>  	/* go into command mode */
> -	gpio_set_value(CFG_GPIO_PIN, 1);
> -	gpio_set_value(RST_GPIO_PIN, 0);
>  	msleep(10);
>  	gpio_set_value(RST_GPIO_PIN, 1);
>  	msleep(10);
This can probably make use of gpio_request_array.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-16  8:33           ` Uwe Kleine-König
@ 2011-03-16  9:15             ` Julia Lawall
  2011-03-16 14:19             ` Fabio Estevam
  2011-03-20 17:56             ` Julia Lawall
  2 siblings, 0 replies; 20+ messages in thread
From: Julia Lawall @ 2011-03-16  9:15 UTC (permalink / raw)
  To: linux-arm-kernel

I'll see if I can incorporate the use of gpio_request_one in my rule.

julia


On Wed, 16 Mar 2011, Uwe Kleine-K?nig wrote:

> [added some people to Cc:]
> 
> Hello Julia,
> 
> On Tue, Mar 15, 2011 at 11:19:53AM +0100, Julia Lawall wrote:
> > On Tue, 15 Mar 2011, Uwe Kleine-K?nig wrote:
> > 
> > > On Tue, Mar 15, 2011 at 10:41:37AM +0100, Julia Lawall wrote:
> > > > I tried the following
> > > > 
> > > > @@
> > > > expression E1,E2;
> > > > @@
> > > > 
> > > >       gpio_direction_output(E1,E2);
> > > >       ...
> > > > -     gpio_set_value(E1,E2);
> > > > 
> > > > and found occurrences in 15 files.  In some cases there seems to be some 
> > > > delay before the call to gpio_set_value.  Does that have any impacton 
> > > > whether it is needed?
> > > gpio_direction_output(E1,E2) implies gpio_set_value(E1,E2), so unless
> > > there is a gpio_set_value(E1,!E2) before gpio_set_value(E1,E2) is a
> > > noop.
> > > 
> > > I still don't know how to work with coccinelle, so if you point me to a
> > > concrete location I can be more specific.
> > 
> > OK.  I have changed the semantic patch to the following:
> > 
> > @@
> > expression E1,E2,E3;
> > @@
> > 
> >       gpio_direction_output(E1,E2);
> >       ... when != gpio_set_value(E1,E3)
> > -     gpio_set_value(E1,E2);
> > 
> > Now it doesn't do all the cases where there is an earlier set ofr some 
> > other value.  The patch I obtain is below.  This only concerns 5 files.  
> > I haven't checked the result at all.
> Thanks. So here comes the check.
> 
> > diff -u -p a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
> > --- a/arch/arm/mach-mx5/board-mx51_babbage.c 2011-02-19 08:28:51.000000000 +0100
> > +++ b/arch/arm/mach-mx5/board-mx51_babbage.c 2011-03-15 11:17:03.000000000 +0100
> > @@ -218,7 +218,6 @@ static inline void babbage_usbhub_reset(
> >  
> >  	/* USB HUB RESET - De-assert USB HUB RESET_N */
> >  	msleep(1);
> > -	gpio_set_value(BABBAGE_USB_HUB_RESET, 0);
> >  	msleep(1);
> >  	gpio_set_value(BABBAGE_USB_HUB_RESET, 1);
> >  }
> This function is a bit confusing:
> 
> 	/* Bring USB hub out of reset */
> 	ret = gpio_request(BABBAGE_USB_HUB_RESET, "GPIO1_7");
> 	if (ret) {
> 		...
> 		return;
> 	}
> 	gpio_direction_output(BABBAGE_USB_HUB_RESET, 0);
> 	/* USB HUB RESET - De-assert USB HUB RESET_N */
> 	msleep(1);
> 	gpio_set_value(BABBAGE_USB_HUB_RESET, 0);
> 	msleep(1);
> 	gpio_set_value(BABBAGE_USB_HUB_RESET, 1);
> 
> IMHO the comments are misleading.  I'd suggest:
> 
> 	ret = gpio_request_one(BABBAGE_USB_HUB_RESET,
> 			GPIOF_DIR_OUT | GPIOF_INIT_LOW, "USB hub reset#");
> 	if (ret) {
> 		pr_err("failed to request gpio for USB hub reset#: %d\n", ret);
> 		return;
> 	}
> 	msleep(2);
> 	gpio_set_value(BABBAGE_USB_HUB_RESET, 1);
> 
> Fabio?
> 
> > @@ -234,7 +233,6 @@ static inline void babbage_fec_reset(voi
> >  		return;
> >  	}
> >  	gpio_direction_output(BABBAGE_FEC_PHY_RESET, 0);
> > -	gpio_set_value(BABBAGE_FEC_PHY_RESET, 0);
> >  	msleep(1);
> >  	gpio_set_value(BABBAGE_FEC_PHY_RESET, 1);
> >  }
> should use
> 	gpio_request_one(BABBAGE_FEC_PHY_RESET,
> 		GPIOF_DIR_OUT | GPIOF_INIT_LOW, "fec-phy-reset");
> 
> > diff -u -p a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c
> > --- a/arch/arm/mach-mx5/board-mx53_evk.c 2011-03-14 17:19:13.000000000 +0100
> > +++ b/arch/arm/mach-mx5/board-mx53_evk.c 2011-03-15 11:17:03.000000000 +0100
> > @@ -88,7 +88,6 @@ static inline void mx53_evk_fec_reset(vo
> >  		return;
> >  	}
> >  	gpio_direction_output(SMD_FEC_PHY_RST, 0);
> > -	gpio_set_value(SMD_FEC_PHY_RST, 0);
> >  	msleep(1);
> >  	gpio_set_value(SMD_FEC_PHY_RST, 1);
> >  }
> ditto
> 
> > diff -u -p a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
> > --- a/arch/arm/mach-omap2/board-omap3evm.c 2011-03-14 17:19:13.000000000 +0100
> > +++ b/arch/arm/mach-omap2/board-omap3evm.c 2011-03-15 11:17:04.000000000 +0100
> > @@ -860,7 +860,6 @@ static void __init omap3_evm_init(void)
> >  		omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP);
> >  		gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port");
> >  		gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0);
> > -		gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0);
> >  
> >  		/* setup EHCI phy reset config */
> >  		omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
> ditto
> 
> > diff -u -p a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
> > --- a/arch/arm/mach-omap2/board-omap4panda.c 2011-03-14 17:19:13.000000000 +0100
> > +++ b/arch/arm/mach-omap2/board-omap4panda.c 2011-03-15 11:17:04.000000000 +0100
> > @@ -129,7 +129,6 @@ static void __init omap4_ehci_init(void)
> >  	}
> >  	gpio_export(GPIO_HUB_POWER, 0);
> >  	gpio_direction_output(GPIO_HUB_POWER, 0);
> > -	gpio_set_value(GPIO_HUB_POWER, 0);
> Should use gpio_request_one, too. And IMHO gpio_export should only be
> called after the direction is set (which is an obsolete comment when
> gpio_request_one is used).
>   
> >  	/* reset phy+hub */
> >  	ret = gpio_request(GPIO_HUB_NRESET, "hub_nreset");
> > @@ -139,7 +138,6 @@ static void __init omap4_ehci_init(void)
> >  	}
> >  	gpio_export(GPIO_HUB_NRESET, 0);
> >  	gpio_direction_output(GPIO_HUB_NRESET, 0);
> > -	gpio_set_value(GPIO_HUB_NRESET, 0);
> >  	gpio_set_value(GPIO_HUB_NRESET, 1);
> >  
> >  	usbhs_init(&usbhs_bdata);
> ditto
> 
> > diff -u -p a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c
> > --- a/arch/arm/mach-pxa/am300epd.c 2010-03-18 09:06:45.000000000 +0100
> > +++ b/arch/arm/mach-pxa/am300epd.c 2011-03-15 11:17:04.000000000 +0100
> > @@ -150,8 +150,6 @@ static int am300_init_gpio_regs(struct b
> >  		gpio_direction_output(i, 0);
> >  
> >  	/* go into command mode */
> > -	gpio_set_value(CFG_GPIO_PIN, 1);
> > -	gpio_set_value(RST_GPIO_PIN, 0);
> >  	msleep(10);
> >  	gpio_set_value(RST_GPIO_PIN, 1);
> >  	msleep(10);
> This can probably make use of gpio_request_array.
> 
> Best regards
> Uwe
> 
> -- 
> Pengutronix e.K.                           | Uwe Kleine-K?nig            |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-16  8:33           ` Uwe Kleine-König
  2011-03-16  9:15             ` Julia Lawall
@ 2011-03-16 14:19             ` Fabio Estevam
  2011-03-20 17:56             ` Julia Lawall
  2 siblings, 0 replies; 20+ messages in thread
From: Fabio Estevam @ 2011-03-16 14:19 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Uwe,

2011/3/16 Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>:
...
> This function is a bit confusing:
>
> ? ? ? ?/* Bring USB hub out of reset */
> ? ? ? ?ret = gpio_request(BABBAGE_USB_HUB_RESET, "GPIO1_7");
> ? ? ? ?if (ret) {
> ? ? ? ? ? ? ? ?...
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
> ? ? ? ?gpio_direction_output(BABBAGE_USB_HUB_RESET, 0);
> ? ? ? ?/* USB HUB RESET - De-assert USB HUB RESET_N */
> ? ? ? ?msleep(1);
> ? ? ? ?gpio_set_value(BABBAGE_USB_HUB_RESET, 0);
> ? ? ? ?msleep(1);
> ? ? ? ?gpio_set_value(BABBAGE_USB_HUB_RESET, 1);
>
> IMHO the comments are misleading. ?I'd suggest:
>
> ? ? ? ?ret = gpio_request_one(BABBAGE_USB_HUB_RESET,
> ? ? ? ? ? ? ? ? ? ? ? ?GPIOF_DIR_OUT | GPIOF_INIT_LOW, "USB hub reset#");
> ? ? ? ?if (ret) {
> ? ? ? ? ? ? ? ?pr_err("failed to request gpio for USB hub reset#: %d\n", ret);
> ? ? ? ? ? ? ? ?return;
> ? ? ? ?}
> ? ? ? ?msleep(2);
> ? ? ? ?gpio_set_value(BABBAGE_USB_HUB_RESET, 1);
>
> Fabio?

Ok, I was not the author of this original code, but will send a new
patch for fixing it.

Thanks for the review.

Regards,

Fabio Estevam

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-16  8:33           ` Uwe Kleine-König
  2011-03-16  9:15             ` Julia Lawall
  2011-03-16 14:19             ` Fabio Estevam
@ 2011-03-20 17:56             ` Julia Lawall
  2011-03-20 19:24               ` Wolfram Sang
  2 siblings, 1 reply; 20+ messages in thread
From: Julia Lawall @ 2011-03-20 17:56 UTC (permalink / raw)
  To: linux-arm-kernel

What is the degree of interest in having gpio_request_one be used?  Right 
now, it is very little used.  But there seem to be over 900 places where 
it could be used.

One advantage of gpio_request_one is that it manages error handling.  
However a number of current calls to gpio_request and 
gpio_direction_input/output don't save or test the return value.  Are 
there cases where these operations cannot fail?

julia

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-20 17:56             ` Julia Lawall
@ 2011-03-20 19:24               ` Wolfram Sang
  2011-03-20 20:51                 ` Julia Lawall
  2011-03-20 21:04                 ` Julia Lawall
  0 siblings, 2 replies; 20+ messages in thread
From: Wolfram Sang @ 2011-03-20 19:24 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Julia,

> What is the degree of interest in having gpio_request_one be used?  Right 
> now, it is very little used.  But there seem to be over 900 places where 
> it could be used.

I have a very high interest in getting it more known/used.

> One advantage of gpio_request_one is that it manages error handling.  

Yes, that's what I like about it; checks for two errors in one call
(especially the latter one is often forgotten in current code).

> However a number of current calls to gpio_request and 
> gpio_direction_input/output don't save or test the return value.  Are 
> there cases where these operations cannot fail?

It is a mixture of pragmatism and lazyness. For board setup code, mostly
CPU-internal GPIOs are used and one can assume that they are always there
because they are often set up in the same file. I wouldn't mind the error
checks to catch the 0.00001% chance of it failing for whatever reason (most
probably a careless update); still, the error checks have to be added by hand,
because you need to know something about the board to handle the error
correctly (igonre it? stop booting?).

For device drivers, the checks really should be made because one cannot assume
anything about the GPIOs passed by platform data. The problem here is that you
cannot use gpio_request_one yet because it is not available yet with !GPIOLIB.
I have sent a patch [1] to fix it, but Grant needs some more time to review. If
he accepts it, I wanted to clean up the drivers as a first step (with
coccinelle surely involved ;)).

Regards,

   Wolfram

[1] <1297530239-7429-1-git-send-email-w.sang@pengutronix.de>

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110320/dc5e6c2e/attachment.sig>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-20 19:24               ` Wolfram Sang
@ 2011-03-20 20:51                 ` Julia Lawall
  2011-03-20 21:30                   ` Wolfram Sang
  2011-03-20 21:04                 ` Julia Lawall
  1 sibling, 1 reply; 20+ messages in thread
From: Julia Lawall @ 2011-03-20 20:51 UTC (permalink / raw)
  To: linux-arm-kernel

I guess that the !GPIOLIB issue is related to a configuration option, that 
can't very easily be detected from looking at the C file alone?

Ignoring that issue, the following semantic patch addresses the common 
case where there is no error checking for the input or output call, but 
there may be error checking for the gpio_request call.  This transforms 
over 500 occurrences.

These rules also require that the first argument to gpio_request should 
not be used at all before the direction call.  This may be too 
conservative.  For example there are some intervening references in
drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
in calls to cs5535_gpio_clear and cs5535_gpio_isset.

@@
expression E1,E2;
@@

-      gpio_request(E1,E2)
+      gpio_request_one(E1,GPIOF_IN,E2)
       ... when != E1
-      gpio_direction_input(E1);

@@
expression E1,E2;
@@

-      gpio_request(E1,E2)
+      gpio_request_one(E1,GPIOF_OUT_INIT_LOW,E2)
       ... when != E1
-      gpio_direction_output(E1,0);

@@
expression E1,E2;
@@

-      gpio_request(E1,E2)
+      gpio_request_one(E1,GPIOF_OUT_INIT_HIGH,E2)
       ... when != E1
-      gpio_direction_output(E1,1);

The results are below.

julia

diff -u -p a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
--- a/arch/arm/mach-davinci/board-da830-evm.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-davinci/board-da830-evm.c 2011-03-20 21:01:50.000000000 +0100
@@ -163,21 +163,20 @@ static __init void da830_evm_usb_init(vo
 		return;
 	}
 
-	ret = gpio_request(ON_BD_USB_DRV, "ON_BD_USB_DRV");
+	ret = gpio_request_one(ON_BD_USB_DRV, GPIOF_OUT_INIT_LOW,
+			       "ON_BD_USB_DRV");
 	if (ret) {
 		printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
 		       "power control: %d\n", __func__, ret);
 		return;
 	}
-	gpio_direction_output(ON_BD_USB_DRV, 0);
 
-	ret = gpio_request(ON_BD_USB_OVC, "ON_BD_USB_OVC");
+	ret = gpio_request_one(ON_BD_USB_OVC, GPIOF_IN, "ON_BD_USB_OVC");
 	if (ret) {
 		printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
 		       "over-current indicator: %d\n", __func__, ret);
 		return;
 	}
-	gpio_direction_input(ON_BD_USB_OVC);
 
 	ret = da8xx_register_usb11(&da830_evm_usb11_pdata);
 	if (ret)
@@ -260,21 +259,19 @@ static inline void da830_evm_init_mmc(vo
 		return;
 	}
 
-	ret = gpio_request(DA830_MMCSD_WP_PIN, "MMC WP");
+	ret = gpio_request_one(DA830_MMCSD_WP_PIN, GPIOF_IN, "MMC WP");
 	if (ret) {
 		pr_warning("da830_evm_init: can not open GPIO %d\n",
 			   DA830_MMCSD_WP_PIN);
 		return;
 	}
-	gpio_direction_input(DA830_MMCSD_WP_PIN);
 
-	ret = gpio_request(DA830_MMCSD_CD_PIN, "MMC CD\n");
+	ret = gpio_request_one(DA830_MMCSD_CD_PIN, GPIOF_IN, "MMC CD\n");
 	if (ret) {
 		pr_warning("da830_evm_init: can not open GPIO %d\n",
 			   DA830_MMCSD_CD_PIN);
 		return;
 	}
-	gpio_direction_input(DA830_MMCSD_CD_PIN);
 
 	ret = da8xx_register_mmcsd0(&da830_evm_mmc_config);
 	if (ret) {
@@ -463,10 +460,7 @@ static struct at24_platform_data da830_e
 static int __init da830_evm_ui_expander_setup(struct i2c_client *client,
 		int gpio, unsigned ngpio, void *context)
 {
-	gpio_request(gpio + 6, "UI MUX_MODE");
-
-	/* Drive mux mode low to match the default without UI card */
-	gpio_direction_output(gpio + 6, 0);
+	gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "UI MUX_MODE");
 
 	da830_evm_init_lcdc(gpio + 6);
 
diff -u -p a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
--- a/arch/arm/mach-davinci/board-da850-evm.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-davinci/board-da850-evm.c 2011-03-20 21:01:50.000000000 +0100
@@ -429,29 +429,27 @@ static int da850_evm_ui_expander_setup(s
 	sel_b = gpio + DA850_EVM_UI_EXP_SEL_B;
 	sel_c = gpio + DA850_EVM_UI_EXP_SEL_C;
 
-	ret = gpio_request(sel_a, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]);
+	ret = gpio_request_one(sel_a, GPIOF_OUT_INIT_HIGH,
+			       da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]);
 	if (ret) {
 		pr_warning("Cannot open UI expander pin %d\n", sel_a);
 		goto exp_setup_sela_fail;
 	}
 
-	ret = gpio_request(sel_b, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]);
+	ret = gpio_request_one(sel_b, GPIOF_OUT_INIT_HIGH,
+			       da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]);
 	if (ret) {
 		pr_warning("Cannot open UI expander pin %d\n", sel_b);
 		goto exp_setup_selb_fail;
 	}
 
-	ret = gpio_request(sel_c, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_C]);
+	ret = gpio_request_one(sel_c, GPIOF_OUT_INIT_HIGH,
+			       da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_C]);
 	if (ret) {
 		pr_warning("Cannot open UI expander pin %d\n", sel_c);
 		goto exp_setup_selc_fail;
 	}
 
-	/* deselect all functionalities */
-	gpio_direction_output(sel_a, 1);
-	gpio_direction_output(sel_b, 1);
-	gpio_direction_output(sel_c, 1);
-
 	da850_evm_ui_keys_init(gpio);
 	ret = platform_device_register(&da850_evm_ui_keys_device);
 	if (ret) {
@@ -774,19 +772,18 @@ static int da850_lcd_hw_init(void)
 {
 	int status;
 
-	status = gpio_request(DA850_LCD_BL_PIN, "lcd bl\n");
+	status = gpio_request_one(DA850_LCD_BL_PIN, GPIOF_OUT_INIT_LOW,
+				  "lcd bl\n");
 	if (status < 0)
 		return status;
 
-	status = gpio_request(DA850_LCD_PWR_PIN, "lcd pwr\n");
+	status = gpio_request_one(DA850_LCD_PWR_PIN, GPIOF_OUT_INIT_LOW,
+				  "lcd pwr\n");
 	if (status < 0) {
 		gpio_free(DA850_LCD_BL_PIN);
 		return status;
 	}
 
-	gpio_direction_output(DA850_LCD_BL_PIN, 0);
-	gpio_direction_output(DA850_LCD_PWR_PIN, 0);
-
 	/* Switch off panel power and backlight */
 	da850_panel_power_ctrl(0);
 
diff -u -p a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
--- a/arch/arm/mach-davinci/board-dm355-evm.c 2010-10-23 19:40:31.000000000 +0200
+++ b/arch/arm/mach-davinci/board-dm355-evm.c 2011-03-20 21:01:50.000000000 +0100
@@ -142,8 +142,7 @@ static void __init evm_init_i2c(void)
 {
 	davinci_init_i2c(&i2c_pdata);
 
-	gpio_request(5, "dm355evm_msp");
-	gpio_direction_input(5);
+	gpio_request_one(5, GPIOF_IN, "dm355evm_msp");
 	dm355evm_i2c_info[0].irq = gpio_to_irq(5);
 
 	i2c_register_board_info(1, dm355evm_i2c_info,
@@ -315,8 +314,7 @@ static __init void dm355_evm_init(void)
 {
 	struct clk *aemif;
 
-	gpio_request(1, "dm9000");
-	gpio_direction_input(1);
+	gpio_request_one(1, GPIOF_IN, "dm9000");
 	dm355evm_dm9000_rsrc[2].start = gpio_to_irq(1);
 
 	aemif = clk_get(&dm355evm_dm9000.dev, "aemif");
diff -u -p a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
--- a/arch/arm/mach-davinci/board-dm355-leopard.c 2010-10-23 19:40:31.000000000 +0200
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c 2011-03-20 21:01:50.000000000 +0100
@@ -134,8 +134,7 @@ static void __init leopard_init_i2c(void
 {
 	davinci_init_i2c(&i2c_pdata);
 
-	gpio_request(5, "dm355leopard_msp");
-	gpio_direction_input(5);
+	gpio_request_one(5, GPIOF_IN, "dm355leopard_msp");
 	dm355leopard_i2c_info[0].irq = gpio_to_irq(5);
 
 	i2c_register_board_info(1, dm355leopard_i2c_info,
@@ -237,8 +236,7 @@ static __init void dm355_leopard_init(vo
 {
 	struct clk *aemif;
 
-	gpio_request(9, "dm9000");
-	gpio_direction_input(9);
+	gpio_request_one(9, GPIOF_IN, "dm9000");
 	dm355leopard_dm9000_rsrc[2].start = gpio_to_irq(9);
 
 	aemif = clk_get(&dm355leopard_dm9000.dev, "aemif");
diff -u -p a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
--- a/arch/arm/mach-davinci/board-dm644x-evm.c 2011-03-20 18:17:22.000000000 +0100
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c 2011-03-20 21:01:56.000000000 +0100
@@ -371,14 +371,11 @@ evm_u18_setup(struct i2c_client *client,
 		sw_gpio = -EINVAL;
 
 	/* audio PLL:  48 kHz (vs 44.1 or 32), single rate (vs double) */
-	gpio_request(gpio + 3, "pll_fs2");
-	gpio_direction_output(gpio + 3, 0);
+	gpio_request_one(gpio + 3, GPIOF_OUT_INIT_LOW, "pll_fs2");
 
-	gpio_request(gpio + 2, "pll_fs1");
-	gpio_direction_output(gpio + 2, 0);
+	gpio_request_one(gpio + 2, GPIOF_OUT_INIT_LOW, "pll_fs1");
 
-	gpio_request(gpio + 1, "pll_sr");
-	gpio_direction_output(gpio + 1, 0);
+	gpio_request_one(gpio + 1, GPIOF_OUT_INIT_LOW, "pll_sr");
 
 	return 0;
 }
@@ -411,34 +408,27 @@ static int
 evm_u35_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
 {
 	/* p0 = nDRV_VBUS (initial:  don't supply it) */
-	gpio_request(gpio + 0, "nDRV_VBUS");
-	gpio_direction_output(gpio + 0, 1);
+	gpio_request_one(gpio + 0, GPIOF_OUT_INIT_HIGH, "nDRV_VBUS");
 
 	/* p1 = VDDIMX_EN */
-	gpio_request(gpio + 1, "VDDIMX_EN");
-	gpio_direction_output(gpio + 1, 1);
+	gpio_request_one(gpio + 1, GPIOF_OUT_INIT_HIGH, "VDDIMX_EN");
 
 	/* p2 = VLYNQ_EN */
-	gpio_request(gpio + 2, "VLYNQ_EN");
-	gpio_direction_output(gpio + 2, 1);
+	gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH, "VLYNQ_EN");
 
 	/* p3 = n3V3_CF_RESET (initial: stay in reset) */
-	gpio_request(gpio + 3, "nCF_RESET");
-	gpio_direction_output(gpio + 3, 0);
+	gpio_request_one(gpio + 3, GPIOF_OUT_INIT_LOW, "nCF_RESET");
 
 	/* (p4 unused) */
 
 	/* p5 = 1V8_WLAN_RESET (initial: stay in reset) */
-	gpio_request(gpio + 5, "WLAN_RESET");
-	gpio_direction_output(gpio + 5, 1);
+	gpio_request_one(gpio + 5, GPIOF_OUT_INIT_HIGH, "WLAN_RESET");
 
 	/* p6 = nATA_SEL (initial: select) */
-	gpio_request(gpio + 6, "nATA_SEL");
-	gpio_direction_output(gpio + 6, 0);
+	gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "nATA_SEL");
 
 	/* p7 = nCF_SEL (initial: deselect) */
-	gpio_request(gpio + 7, "nCF_SEL");
-	gpio_direction_output(gpio + 7, 1);
+	gpio_request_one(gpio + 7, GPIOF_OUT_INIT_HIGH, "nCF_SEL");
 
 	return 0;
 }
diff -u -p a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c
--- a/arch/arm/mach-davinci/board-tnetv107x-evm.c 2011-03-20 18:17:22.000000000 +0100
+++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c 2011-03-20 21:01:50.000000000 +0100
@@ -44,12 +44,11 @@ static int initialize_gpio(int gpio, cha
 {
 	int ret;
 
-	ret = gpio_request(gpio, desc);
+	ret = gpio_request_one(gpio, GPIOF_IN, desc);
 	if (ret < 0) {
 		pr_err_ratelimited("cannot open %s gpio\n", desc);
 		return -ENOSYS;
 	}
-	gpio_direction_input(gpio);
 	return gpio;
 }
 
diff -u -p a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
--- a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c 2011-03-20 21:01:50.000000000 +0100
@@ -251,11 +251,10 @@ static const struct imxuart_platform_dat
 
 static void __maybe_unused ads7846_dev_init(void)
 {
-	if (gpio_request(ADS7846_PENDOWN, "ADS7846 pendown") < 0) {
+	if (gpio_request_one(ADS7846_PENDOWN, GPIOF_IN, "ADS7846 pendown") < 0) {
 		printk(KERN_ERR "can't get ads746 pen down GPIO\n");
 		return;
 	}
-	gpio_direction_input(ADS7846_PENDOWN);
 }
 
 static int ads7846_get_pendown_state(void)
diff -u -p a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
--- a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c 2010-12-04 18:54:35.000000000 +0100
+++ b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c 2011-03-20 21:01:50.000000000 +0100
@@ -277,16 +277,13 @@ void __init eukrea_mbimxsd25_baseboard_i
 	imx25_add_flexcan1(NULL);
 	imx25_add_sdhci_esdhc_imx(0, NULL);
 
-	gpio_request(GPIO_LED1, "LED1");
-	gpio_direction_output(GPIO_LED1, 1);
+	gpio_request_one(GPIO_LED1, GPIOF_OUT_INIT_HIGH, "LED1");
 	gpio_free(GPIO_LED1);
 
-	gpio_request(GPIO_SWITCH1, "SWITCH1");
-	gpio_direction_input(GPIO_SWITCH1);
+	gpio_request_one(GPIO_SWITCH1, GPIOF_IN, "SWITCH1");
 	gpio_free(GPIO_SWITCH1);
 
-	gpio_request(GPIO_LCDPWR, "LCDPWR");
-	gpio_direction_output(GPIO_LCDPWR, 1);
+	gpio_request_one(GPIO_LCDPWR, GPIOF_OUT_INIT_HIGH, "LCDPWR");
 	gpio_free(GPIO_SWITCH1);
 
 	i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
diff -u -p a/arch/arm/mach-imx/mach-mx25_3ds.c b/arch/arm/mach-imx/mach-mx25_3ds.c
--- a/arch/arm/mach-imx/mach-mx25_3ds.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-imx/mach-mx25_3ds.c 2011-03-20 21:01:51.000000000 +0100
@@ -118,11 +118,12 @@ static const struct fec_platform_data mx
 
 static void __init mx25pdk_fec_reset(void)
 {
-	gpio_request(FEC_ENABLE_GPIO, "FEC PHY enable");
-	gpio_request(FEC_RESET_B_GPIO, "FEC PHY reset");
-
-	gpio_direction_output(FEC_ENABLE_GPIO, 0);  /* drop PHY power */
-	gpio_direction_output(FEC_RESET_B_GPIO, 0); /* assert reset */
+	gpio_request_one(FEC_ENABLE_GPIO, GPIOF_OUT_INIT_LOW,
+			 "FEC PHY enable");
+	gpio_request_one(FEC_RESET_B_GPIO, GPIOF_OUT_INIT_LOW,
+			 "FEC PHY reset");
+  /* drop PHY power */
+	/* assert reset */
 	udelay(2);
 
 	/* turn on PHY power and lift reset */
diff -u -p a/arch/arm/mach-imx/pcm970-baseboard.c b/arch/arm/mach-imx/pcm970-baseboard.c
--- a/arch/arm/mach-imx/pcm970-baseboard.c 2010-12-04 18:54:35.000000000 +0100
+++ b/arch/arm/mach-imx/pcm970-baseboard.c 2011-03-20 21:01:51.000000000 +0100
@@ -100,14 +100,12 @@ static int pcm970_sdhc2_init(struct devi
 	if (ret)
 		return ret;
 
-	ret = gpio_request(GPIO_PORTC + 28, "imx-mmc-ro");
+	ret = gpio_request_one(GPIO_PORTC + 28, GPIOF_IN, "imx-mmc-ro");
 	if (ret) {
 		free_irq(IRQ_GPIOC(29), data);
 		return ret;
 	}
 
-	gpio_direction_input(GPIO_PORTC + 28);
-
 	return 0;
 }
 
diff -u -p a/arch/arm/mach-kirkwood/openrd-setup.c b/arch/arm/mach-kirkwood/openrd-setup.c
--- a/arch/arm/mach-kirkwood/openrd-setup.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-kirkwood/openrd-setup.c 2011-03-20 21:01:55.000000000 +0100
@@ -115,7 +115,7 @@ static int __init uart1_mpp_config(void)
 {
 	kirkwood_mpp_conf(openrd_uart1_mpp_config);
 
-	if (gpio_request(34, "SD_UART1_SEL")) {
+	if (gpio_request_one(34, GPIOF_OUT_INIT_LOW, "SD_UART1_SEL")) {
 		printk(KERN_ERR "GPIO request failed for SD/UART1 selection"
 				", gpio: 34\n");
 		return -EIO;
@@ -128,10 +128,6 @@ static int __init uart1_mpp_config(void)
 		return -EIO;
 	}
 
-	/* Select UART1
-	 * Pin # 34: 0 => UART1, 1 => SD */
-	gpio_direction_output(34, 0);
-
 	/* Select RS232 OR RS485
 	 * Pin # 28: 0 => RS232, 1 => RS485 */
 	if (uart1 == 232)
diff -u -p a/arch/arm/mach-ks8695/board-acs5k.c b/arch/arm/mach-ks8695/board-acs5k.c
--- a/arch/arm/mach-ks8695/board-acs5k.c 2010-10-23 19:40:31.000000000 +0200
+++ b/arch/arm/mach-ks8695/board-acs5k.c 2011-03-20 21:01:55.000000000 +0100
@@ -198,10 +198,8 @@ static void __init acs5k_init_gpio(void)
 	for (i = 8; i < 16; ++i)
 		gpio_request(i, "ACS5K Unused");
 
-	gpio_request(3, "ACS5K CAN Control");
-	gpio_request(6, "ACS5K Heartbeat");
-	gpio_direction_output(3, 1); /* Default CAN_RESET high */
-	gpio_direction_output(6, 0); /* Default KS8695_ACTIVE low */
+	gpio_request_one(3, GPIOF_OUT_INIT_HIGH, "ACS5K CAN Control");
+	gpio_request_one(6, GPIOF_OUT_INIT_LOW, "ACS5K Heartbeat");/* Default CAN_RESET high *//* Default KS8695_ACTIVE low */
 	gpio_export(3, 0); /* export CAN_RESET as output only */
 	gpio_export(6, 0); /* export KS8695_ACTIVE as output only */
 }
diff -u -p a/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c
--- a/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c 2011-02-26 13:17:46.000000000 +0100
+++ b/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c 2011-03-20 21:01:55.000000000 +0100
@@ -291,16 +291,13 @@ void __init eukrea_mbimxsd35_baseboard_i
 	imx35_add_flexcan1(NULL);
 	imx35_add_sdhci_esdhc_imx(0, NULL);
 
-	gpio_request(GPIO_LED1, "LED1");
-	gpio_direction_output(GPIO_LED1, 1);
+	gpio_request_one(GPIO_LED1, GPIOF_OUT_INIT_HIGH, "LED1");
 	gpio_free(GPIO_LED1);
 
-	gpio_request(GPIO_SWITCH1, "SWITCH1");
-	gpio_direction_input(GPIO_SWITCH1);
+	gpio_request_one(GPIO_SWITCH1, GPIOF_IN, "SWITCH1");
 	gpio_free(GPIO_SWITCH1);
 
-	gpio_request(GPIO_LCDPWR, "LCDPWR");
-	gpio_direction_output(GPIO_LCDPWR, 1);
+	gpio_request_one(GPIO_LCDPWR, GPIOF_OUT_INIT_HIGH, "LCDPWR");
 	gpio_free(GPIO_LCDPWR);
 
 	i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
diff -u -p a/arch/arm/mach-mx3/mach-armadillo5x0.c b/arch/arm/mach-mx3/mach-armadillo5x0.c
--- a/arch/arm/mach-mx3/mach-armadillo5x0.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-armadillo5x0.c 2011-03-20 21:01:50.000000000 +0100
@@ -412,18 +412,14 @@ static int armadillo5x0_sdhc1_init(struc
 	gpio_det = IOMUX_TO_GPIO(MX31_PIN_ATA_DMACK);
 	gpio_wp = IOMUX_TO_GPIO(MX31_PIN_ATA_RESET_B);
 
-	ret = gpio_request(gpio_det, "sdhc-card-detect");
+	ret = gpio_request_one(gpio_det, GPIOF_IN, "sdhc-card-detect");
 	if (ret)
 		return ret;
 
-	gpio_direction_input(gpio_det);
-
-	ret = gpio_request(gpio_wp, "sdhc-write-protect");
+	ret = gpio_request_one(gpio_wp, GPIOF_IN, "sdhc-write-protect");
 	if (ret)
 		goto err_gpio_free;
 
-	gpio_direction_input(gpio_wp);
-
 	/* When supported the trigger type have to be BOTH */
 	ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_ATA_DMACK), detect_irq,
 			  IRQF_DISABLED | IRQF_TRIGGER_FALLING,
diff -u -p a/arch/arm/mach-mx3/mach-kzm_arm11_01.c b/arch/arm/mach-mx3/mach-kzm_arm11_01.c
--- a/arch/arm/mach-mx3/mach-kzm_arm11_01.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-kzm_arm11_01.c 2011-03-20 21:01:51.000000000 +0100
@@ -113,8 +113,8 @@ static int __init kzm_init_ext_uart(void
 	 * GPIO 1-1: external UART interrupt line
 	 */
 	mxc_iomux_mode(IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO));
-	gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1), "ext-uart-int");
-	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1));
+	gpio_request_one(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1), GPIOF_IN,
+			 "ext-uart-int");
 
 	/*
 	 * Unmask UART interrupt
@@ -172,8 +172,8 @@ static int __init kzm_init_smsc9118(void
 	 * GPIO 1-2: SMSC9118 interrupt line
 	 */
 	mxc_iomux_mode(IOMUX_MODE(MX31_PIN_GPIO1_2, IOMUX_CONFIG_GPIO));
-	gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2), "smsc9118-int");
-	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2));
+	gpio_request_one(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2), GPIOF_IN,
+			 "smsc9118-int");
 
 	return platform_device_register(&kzm_smsc9118_device);
 }
diff -u -p a/arch/arm/mach-mx3/mach-mx31lilly.c b/arch/arm/mach-mx3/mach-mx31lilly.c
--- a/arch/arm/mach-mx3/mach-mx31lilly.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-mx31lilly.c 2011-03-20 21:01:50.000000000 +0100
@@ -175,8 +175,8 @@ static int usbh2_init(struct platform_de
 	/* chip select */
 	mxc_iomux_alloc_pin(IOMUX_MODE(MX31_PIN_DTR_DCE1, IOMUX_CONFIG_GPIO),
 				"USBH2_CS");
-	gpio_request(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), "USBH2 CS");
-	gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), 0);
+	gpio_request_one(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1),
+			 GPIOF_OUT_INIT_LOW, "USBH2 CS");
 
 	mdelay(10);
 
diff -u -p a/arch/arm/mach-mx3/mach-mx31lite.c b/arch/arm/mach-mx3/mach-mx31lite.c
--- a/arch/arm/mach-mx3/mach-mx31lite.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-mx31lite.c 2011-03-20 21:01:50.000000000 +0100
@@ -164,8 +164,8 @@ static int usbh2_init(struct platform_de
 	/* chip select */
 	mxc_iomux_alloc_pin(IOMUX_MODE(MX31_PIN_DTR_DCE1, IOMUX_CONFIG_GPIO),
 				"USBH2_CS");
-	gpio_request(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), "USBH2 CS");
-	gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), 0);
+	gpio_request_one(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1),
+			 GPIOF_OUT_INIT_LOW, "USBH2 CS");
 
 	mdelay(10);
 
diff -u -p a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
--- a/arch/arm/mach-mx3/mach-mx31moboard.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-mx31moboard.c 2011-03-20 21:01:50.000000000 +0100
@@ -311,16 +311,13 @@ static int moboard_sdhc1_init(struct dev
 {
 	int ret;
 
-	ret = gpio_request(SDHC1_CD, "sdhc-detect");
+	ret = gpio_request_one(SDHC1_CD, GPIOF_IN, "sdhc-detect");
 	if (ret)
 		return ret;
 
-	gpio_direction_input(SDHC1_CD);
-
-	ret = gpio_request(SDHC1_WP, "sdhc-wp");
+	ret = gpio_request_one(SDHC1_WP, GPIOF_IN, "sdhc-wp");
 	if (ret)
 		goto err_gpio_free;
-	gpio_direction_input(SDHC1_WP);
 
 	ret = request_irq(gpio_to_irq(SDHC1_CD), detect_irq,
 		IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
@@ -390,13 +387,11 @@ static void usb_xcvr_reset(void)
 	mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
 	mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
 
-	gpio_request(OTG_EN_B, "usb-udc-en");
-	gpio_direction_output(OTG_EN_B, 0);
-	gpio_request(USBH2_EN_B, "usbh2-en");
-	gpio_direction_output(USBH2_EN_B, 0);
+	gpio_request_one(OTG_EN_B, GPIOF_OUT_INIT_LOW, "usb-udc-en");
+	
+	gpio_request_one(USBH2_EN_B, GPIOF_OUT_INIT_LOW, "usbh2-en");
 
-	gpio_request(USB_RESET_B, "usb-reset");
-	gpio_direction_output(USB_RESET_B, 0);
+	gpio_request_one(USB_RESET_B, GPIOF_OUT_INIT_LOW, "usb-reset");
 	mdelay(1);
 	gpio_set_value(USB_RESET_B, 1);
 	mdelay(1);
@@ -522,8 +517,8 @@ static void __init mx31moboard_init(void
 	imx31_add_spi_imx1(&moboard_spi1_pdata);
 	imx31_add_spi_imx2(&moboard_spi2_pdata);
 
-	gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq");
-	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
+	gpio_request_one(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), GPIOF_IN,
+			 "pmic-irq");
 	spi_register_board_info(moboard_spi_board_info,
 		ARRAY_SIZE(moboard_spi_board_info));
 
diff -u -p a/arch/arm/mach-mx3/mach-pcm037.c b/arch/arm/mach-mx3/mach-pcm037.c
--- a/arch/arm/mach-mx3/mach-pcm037.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-pcm037.c 2011-03-20 21:01:49.000000000 +0100
@@ -358,17 +358,14 @@ static int pcm970_sdhc1_init(struct devi
 {
 	int ret;
 
-	ret = gpio_request(SDHC1_GPIO_DET, "sdhc-detect");
+	ret = gpio_request_one(SDHC1_GPIO_DET, GPIOF_IN, "sdhc-detect");
 	if (ret)
 		return ret;
 
-	gpio_direction_input(SDHC1_GPIO_DET);
-
 #ifdef PCM970_SDHC_RW_SWITCH
-	ret = gpio_request(SDHC1_GPIO_WP, "sdhc-wp");
+	ret = gpio_request_one(SDHC1_GPIO_WP, GPIOF_IN, "sdhc-wp");
 	if (ret)
 		goto err_gpio_free;
-	gpio_direction_input(SDHC1_GPIO_WP);
 #endif
 
 	ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_SCK6), detect_irq,
diff -u -p a/arch/arm/mach-mx3/mach-pcm043.c b/arch/arm/mach-mx3/mach-pcm043.c
--- a/arch/arm/mach-mx3/mach-pcm043.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-pcm043.c 2011-03-20 21:01:49.000000000 +0100
@@ -229,7 +229,7 @@ static void pcm043_ac97_warm_reset(struc
 	iomux_v3_cfg_t txfs = MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS;
 	int ret;
 
-	ret = gpio_request(AC97_GPIO_TXFS, "SSI");
+	ret = gpio_request_one(AC97_GPIO_TXFS, GPIOF_OUT_INIT_HIGH, "SSI");
 	if (ret) {
 		printk("failed to get GPIO_TXFS: %d\n", ret);
 		return;
@@ -238,7 +238,6 @@ static void pcm043_ac97_warm_reset(struc
 	mxc_iomux_v3_setup_pad(txfs_gpio);
 
 	/* warm reset */
-	gpio_direction_output(AC97_GPIO_TXFS, 1);
 	udelay(2);
 	gpio_set_value(AC97_GPIO_TXFS, 0);
 
@@ -255,15 +254,15 @@ static void pcm043_ac97_cold_reset(struc
 	iomux_v3_cfg_t reset_gpio = MX35_PAD_SD2_CMD__GPIO2_0;
 	int ret;
 
-	ret = gpio_request(AC97_GPIO_TXFS, "SSI");
+	ret = gpio_request_one(AC97_GPIO_TXFS, GPIOF_OUT_INIT_LOW, "SSI");
 	if (ret)
 		goto err1;
 
-	ret = gpio_request(AC97_GPIO_TXD, "SSI");
+	ret = gpio_request_one(AC97_GPIO_TXD, GPIOF_OUT_INIT_LOW, "SSI");
 	if (ret)
 		goto err2;
 
-	ret = gpio_request(AC97_GPIO_RESET, "SSI");
+	ret = gpio_request_one(AC97_GPIO_RESET, GPIOF_OUT_INIT_LOW, "SSI");
 	if (ret)
 		goto err3;
 
@@ -271,11 +270,8 @@ static void pcm043_ac97_cold_reset(struc
 	mxc_iomux_v3_setup_pad(txd_gpio);
 	mxc_iomux_v3_setup_pad(reset_gpio);
 
-	gpio_direction_output(AC97_GPIO_TXFS, 0);
-	gpio_direction_output(AC97_GPIO_TXD, 0);
-
 	/* cold reset */
-	gpio_direction_output(AC97_GPIO_RESET, 0);
+	
 	udelay(10);
 	gpio_direction_output(AC97_GPIO_RESET, 1);
 
diff -u -p a/arch/arm/mach-mx3/mx31lilly-db.c b/arch/arm/mach-mx3/mx31lilly-db.c
--- a/arch/arm/mach-mx3/mx31lilly-db.c 2010-12-04 18:54:35.000000000 +0100
+++ b/arch/arm/mach-mx3/mx31lilly-db.c 2011-03-20 21:01:55.000000000 +0100
@@ -122,17 +122,14 @@ static int mxc_mmc1_init(struct device *
 	mxc_iomux_set_pad(MX31_PIN_SD1_CLK, MMC_PAD_CFG);
 	mxc_iomux_set_pad(MX31_PIN_SD1_CMD, MMC_PAD_CFG);
 
-	ret = gpio_request(gpio_det, "MMC detect");
+	ret = gpio_request_one(gpio_det, GPIOF_IN, "MMC detect");
 	if (ret)
 		return ret;
 
-	ret = gpio_request(gpio_wp, "MMC w/p");
+	ret = gpio_request_one(gpio_wp, GPIOF_IN, "MMC w/p");
 	if (ret)
 		goto exit_free_det;
 
-	gpio_direction_input(gpio_det);
-	gpio_direction_input(gpio_wp);
-
 	ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_GPIO1_1), detect_irq,
 			  IRQF_DISABLED | IRQF_TRIGGER_FALLING,
 			  "MMC detect", data);
@@ -197,14 +194,14 @@ static struct mx3fb_platform_data fb_pda
 
 static void __init mx31lilly_init_fb(void)
 {
-	if (gpio_request(LCD_VCC_EN_GPIO, "LCD enable") != 0) {
+	if (gpio_request_one(LCD_VCC_EN_GPIO, GPIOF_OUT_INIT_HIGH,
+			     "LCD enable") != 0) {
 		printk(KERN_WARNING "unable to request LCD_VCC_EN pin.\n");
 		return;
 	}
 
 	mxc_register_device(&mx3_ipu, &ipu_data);
 	mxc_register_device(&mx3_fb, &fb_pdata);
-	gpio_direction_output(LCD_VCC_EN_GPIO, 1);
 }
 
 void __init mx31lilly_db_init(void)
diff -u -p a/arch/arm/mach-mx3/mx31lite-db.c b/arch/arm/mach-mx3/mx31lite-db.c
--- a/arch/arm/mach-mx3/mx31lite-db.c 2010-12-04 18:54:35.000000000 +0100
+++ b/arch/arm/mach-mx3/mx31lite-db.c 2011-03-20 21:01:51.000000000 +0100
@@ -106,17 +106,14 @@ static int mxc_mmc1_init(struct device *
 			  MMC_PAD_CFG | PAD_CTL_PUE_PUD | PAD_CTL_100K_PU);
 	mxc_iomux_set_pad(MX31_PIN_SD1_CLK, MMC_PAD_CFG);
 
-	ret = gpio_request(gpio_det, "MMC detect");
+	ret = gpio_request_one(gpio_det, GPIOF_IN, "MMC detect");
 	if (ret)
 		return ret;
 
-	ret = gpio_request(gpio_wp, "MMC w/p");
+	ret = gpio_request_one(gpio_wp, GPIOF_IN, "MMC w/p");
 	if (ret)
 		goto exit_free_det;
 
-	gpio_direction_input(gpio_det);
-	gpio_direction_input(gpio_wp);
-
 	ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_DCD_DCE1), detect_irq,
 			  IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
 			  "MMC detect", data);
diff -u -p a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
--- a/arch/arm/mach-mx3/mx31moboard-devboard.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-mx3/mx31moboard-devboard.c 2011-03-20 21:01:50.000000000 +0100
@@ -67,16 +67,13 @@ static int devboard_sdhc2_init(struct de
 {
 	int ret;
 
-	ret = gpio_request(SDHC2_CD, "sdhc-detect");
+	ret = gpio_request_one(SDHC2_CD, GPIOF_IN, "sdhc-detect");
 	if (ret)
 		return ret;
 
-	gpio_direction_input(SDHC2_CD);
-
-	ret = gpio_request(SDHC2_WP, "sdhc-wp");
+	ret = gpio_request_one(SDHC2_WP, GPIOF_IN, "sdhc-wp");
 	if (ret)
 		goto err_gpio_free;
-	gpio_direction_input(SDHC2_WP);
 
 	ret = request_irq(gpio_to_irq(SDHC2_CD), detect_irq,
 		IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
@@ -161,18 +158,17 @@ static int devboard_usbh1_hw_init(struct
 
 static int devboard_isp1105_init(struct otg_transceiver *otg)
 {
-	int ret = gpio_request(USBH1_MODE, "usbh1-mode");
+	int ret = gpio_request_one(USBH1_MODE, GPIOF_OUT_INIT_LOW,
+				   "usbh1-mode");
 	if (ret)
 		return ret;
-	/* single ended */
-	gpio_direction_output(USBH1_MODE, 0);
 
-	ret = gpio_request(USBH1_VBUSEN_B, "usbh1-vbusen");
+	ret = gpio_request_one(USBH1_VBUSEN_B, GPIOF_OUT_INIT_HIGH,
+			       "usbh1-vbusen");
 	if (ret) {
 		gpio_free(USBH1_MODE);
 		return ret;
 	}
-	gpio_direction_output(USBH1_VBUSEN_B, 1);
 
 	return 0;
 }
diff -u -p a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c 2011-03-20 21:01:51.000000000 +0100
@@ -80,16 +80,13 @@ static int marxbot_sdhc2_init(struct dev
 {
 	int ret;
 
-	ret = gpio_request(SDHC2_CD, "sdhc-detect");
+	ret = gpio_request_one(SDHC2_CD, GPIOF_IN, "sdhc-detect");
 	if (ret)
 		return ret;
 
-	gpio_direction_input(SDHC2_CD);
-
-	ret = gpio_request(SDHC2_WP, "sdhc-wp");
+	ret = gpio_request_one(SDHC2_WP, GPIOF_IN, "sdhc-wp");
 	if (ret)
 		goto err_gpio_free;
-	gpio_direction_input(SDHC2_WP);
 
 	ret = request_irq(gpio_to_irq(SDHC2_CD), detect_irq,
 		IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
@@ -195,28 +192,28 @@ static struct platform_device *marxbot_c
 
 static int __init marxbot_cam_init(void)
 {
-	int ret = gpio_request(CAM_CHOICE, "cam-choice");
+	int ret = gpio_request_one(CAM_CHOICE, GPIOF_OUT_INIT_LOW,
+				   "cam-choice");
 	if (ret)
 		return ret;
-	gpio_direction_output(CAM_CHOICE, 0);
 
-	ret = gpio_request(BASECAM_RST_B, "basecam-reset");
+	ret = gpio_request_one(BASECAM_RST_B, GPIOF_OUT_INIT_HIGH,
+			       "basecam-reset");
 	if (ret)
 		return ret;
-	gpio_direction_output(BASECAM_RST_B, 1);
-	ret = gpio_request(BASECAM_POWER, "basecam-standby");
+	ret = gpio_request_one(BASECAM_POWER, GPIOF_OUT_INIT_LOW,
+			       "basecam-standby");
 	if (ret)
 		return ret;
-	gpio_direction_output(BASECAM_POWER, 0);
 
-	ret = gpio_request(TURRETCAM_RST_B, "turretcam-reset");
+	ret = gpio_request_one(TURRETCAM_RST_B, GPIOF_OUT_INIT_HIGH,
+			       "turretcam-reset");
 	if (ret)
 		return ret;
-	gpio_direction_output(TURRETCAM_RST_B, 1);
-	ret = gpio_request(TURRETCAM_POWER, "turretcam-standby");
+	ret = gpio_request_one(TURRETCAM_POWER, GPIOF_OUT_INIT_LOW,
+			       "turretcam-standby");
 	if (ret)
 		return ret;
-	gpio_direction_output(TURRETCAM_POWER, 0);
 
 	return 0;
 }
@@ -276,18 +273,17 @@ static int marxbot_usbh1_hw_init(struct 
 
 static int marxbot_isp1105_init(struct otg_transceiver *otg)
 {
-	int ret = gpio_request(USBH1_MODE, "usbh1-mode");
+	int ret = gpio_request_one(USBH1_MODE, GPIOF_OUT_INIT_LOW,
+				   "usbh1-mode");
 	if (ret)
 		return ret;
-	/* single ended */
-	gpio_direction_output(USBH1_MODE, 0);
 
-	ret = gpio_request(USBH1_VBUSEN_B, "usbh1-vbusen");
+	ret = gpio_request_one(USBH1_VBUSEN_B, GPIOF_OUT_INIT_HIGH,
+			       "usbh1-vbusen");
 	if (ret) {
 		gpio_free(USBH1_MODE);
 		return ret;
 	}
-	gpio_direction_output(USBH1_VBUSEN_B, 1);
 
 	return 0;
 }
@@ -358,8 +354,8 @@ void __init mx31moboard_marxbot_init(voi
 	platform_add_devices(marxbot_cameras, ARRAY_SIZE(marxbot_cameras));
 
 	/* battery present pin */
-	gpio_request(IOMUX_TO_GPIO(MX31_PIN_LCS0), "bat-present");
-	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0));
+	gpio_request_one(IOMUX_TO_GPIO(MX31_PIN_LCS0), GPIOF_IN,
+			 "bat-present");
 	gpio_export(IOMUX_TO_GPIO(MX31_PIN_LCS0), false);
 
 	imx31_add_fsl_usb2_udc(&usb_pdata);
diff -u -p a/arch/arm/mach-mx3/mx31moboard-smartbot.c b/arch/arm/mach-mx3/mx31moboard-smartbot.c
--- a/arch/arm/mach-mx3/mx31moboard-smartbot.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mx31moboard-smartbot.c 2011-03-20 21:01:51.000000000 +0100
@@ -104,14 +104,13 @@ static struct platform_device *smartbot_
 
 static int __init smartbot_cam_init(void)
 {
-	int ret = gpio_request(CAM_RST_B, "cam-reset");
+	int ret = gpio_request_one(CAM_RST_B, GPIOF_OUT_INIT_HIGH,
+				   "cam-reset");
 	if (ret)
 		return ret;
-	gpio_direction_output(CAM_RST_B, 1);
-	ret = gpio_request(CAM_POWER, "cam-standby");
+	ret = gpio_request_one(CAM_POWER, GPIOF_OUT_INIT_LOW, "cam-standby");
 	if (ret)
 		return ret;
-	gpio_direction_output(CAM_POWER, 0);
 
 	return 0;
 }
diff -u -p a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c
--- a/arch/arm/mach-mx5/board-cpuimx51.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-mx5/board-cpuimx51.c 2011-03-20 21:01:53.000000000 +0100
@@ -253,17 +253,13 @@ static void __init eukrea_cpuimx51_init(
 	imx51_add_imx_uart(0, &uart_pdata);
 	imx51_add_mxc_nand(&eukrea_cpuimx51_nand_board_info);
 
-	gpio_request(CPUIMX51_QUARTA_GPIO, "quarta_irq");
-	gpio_direction_input(CPUIMX51_QUARTA_GPIO);
+	gpio_request_one(CPUIMX51_QUARTA_GPIO, GPIOF_IN, "quarta_irq");
 	gpio_free(CPUIMX51_QUARTA_GPIO);
-	gpio_request(CPUIMX51_QUARTB_GPIO, "quartb_irq");
-	gpio_direction_input(CPUIMX51_QUARTB_GPIO);
+	gpio_request_one(CPUIMX51_QUARTB_GPIO, GPIOF_IN, "quartb_irq");
 	gpio_free(CPUIMX51_QUARTB_GPIO);
-	gpio_request(CPUIMX51_QUARTC_GPIO, "quartc_irq");
-	gpio_direction_input(CPUIMX51_QUARTC_GPIO);
+	gpio_request_one(CPUIMX51_QUARTC_GPIO, GPIOF_IN, "quartc_irq");
 	gpio_free(CPUIMX51_QUARTC_GPIO);
-	gpio_request(CPUIMX51_QUARTD_GPIO, "quartd_irq");
-	gpio_direction_input(CPUIMX51_QUARTD_GPIO);
+	gpio_request_one(CPUIMX51_QUARTD_GPIO, GPIOF_IN, "quartd_irq");
 	gpio_free(CPUIMX51_QUARTD_GPIO);
 
 	imx51_add_fec(NULL);
diff -u -p a/arch/arm/mach-mx5/board-cpuimx51sd.c b/arch/arm/mach-mx5/board-cpuimx51sd.c
--- a/arch/arm/mach-mx5/board-cpuimx51sd.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx5/board-cpuimx51sd.c 2011-03-20 21:01:53.000000000 +0100
@@ -280,22 +280,18 @@ static void __init eukrea_cpuimx51sd_ini
 	gpio_set_value(ETH_RST, 1);
 	imx51_add_fec(NULL);
 
-	gpio_request(CAN_IRQGPIO, "can_irq");
-	gpio_direction_input(CAN_IRQGPIO);
+	gpio_request_one(CAN_IRQGPIO, GPIOF_IN, "can_irq");
 	gpio_free(CAN_IRQGPIO);
-	gpio_request(CAN_NCS, "can_ncs");
-	gpio_direction_output(CAN_NCS, 1);
+	gpio_request_one(CAN_NCS, GPIOF_OUT_INIT_HIGH, "can_ncs");
 	gpio_free(CAN_NCS);
-	gpio_request(CAN_RST, "can_rst");
-	gpio_direction_output(CAN_RST, 0);
+	gpio_request_one(CAN_RST, GPIOF_OUT_INIT_LOW, "can_rst");
 	msleep(20);
 	gpio_set_value(CAN_RST, 1);
 	imx51_add_ecspi(0, &cpuimx51sd_ecspi1_pdata);
 	spi_register_board_info(cpuimx51sd_spi_device,
 				ARRAY_SIZE(cpuimx51sd_spi_device));
 
-	gpio_request(TSC2007_IRQGPIO, "tsc2007_irq");
-	gpio_direction_input(TSC2007_IRQGPIO);
+	gpio_request_one(TSC2007_IRQGPIO, GPIOF_IN, "tsc2007_irq");
 	gpio_free(TSC2007_IRQGPIO);
 
 	i2c_register_board_info(0, eukrea_cpuimx51sd_i2c_devices,
@@ -309,8 +305,7 @@ static void __init eukrea_cpuimx51sd_ini
 		mxc_register_device(&mxc_usbdr_udc_device, &usb_pdata);
 	}
 
-	gpio_request(USBH1_RST, "usb_rst");
-	gpio_direction_output(USBH1_RST, 0);
+	gpio_request_one(USBH1_RST, GPIOF_OUT_INIT_LOW, "usb_rst");
 	msleep(20);
 	gpio_set_value(USBH1_RST, 1);
 	mxc_register_device(&mxc_usbh1_device, &usbh1_config);
diff -u -p a/arch/arm/mach-mx5/board-mx50_rdp.c b/arch/arm/mach-mx5/board-mx50_rdp.c
--- a/arch/arm/mach-mx5/board-mx50_rdp.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx50_rdp.c 2011-03-20 21:01:50.000000000 +0100
@@ -176,10 +176,9 @@ static const struct fec_platform_data fe
 
 static inline void mx50_rdp_fec_reset(void)
 {
-	gpio_request(FEC_EN, "fec-en");
-	gpio_direction_output(FEC_EN, 0);
-	gpio_request(FEC_RESET_B, "fec-reset_b");
-	gpio_direction_output(FEC_RESET_B, 0);
+	gpio_request_one(FEC_EN, GPIOF_OUT_INIT_LOW, "fec-en");
+	
+	gpio_request_one(FEC_RESET_B, GPIOF_OUT_INIT_LOW, "fec-reset_b");
 	msleep(1);
 	gpio_set_value(FEC_RESET_B, 1);
 }
diff -u -p a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
--- a/arch/arm/mach-mx5/board-mx51_babbage.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c 2011-03-20 21:01:50.000000000 +0100
@@ -181,26 +181,26 @@ static int gpio_usbh1_active(void)
 
 	/* Set USBH1_STP to GPIO and toggle it */
 	mxc_iomux_v3_setup_pad(usbh1stp_gpio);
-	ret = gpio_request(BABBAGE_USBH1_STP, "usbh1_stp");
+	ret = gpio_request_one(BABBAGE_USBH1_STP, GPIOF_OUT_INIT_LOW,
+			       "usbh1_stp");
 
 	if (ret) {
 		pr_debug("failed to get MX51_PAD_USBH1_STP__GPIO_1_27: %d\n", ret);
 		return ret;
 	}
-	gpio_direction_output(BABBAGE_USBH1_STP, 0);
 	gpio_set_value(BABBAGE_USBH1_STP, 1);
 	msleep(100);
 	gpio_free(BABBAGE_USBH1_STP);
 
 	/* De-assert USB PHY RESETB */
 	mxc_iomux_v3_setup_pad(phyreset_gpio);
-	ret = gpio_request(BABBAGE_PHY_RESET, "phy_reset");
+	ret = gpio_request_one(BABBAGE_PHY_RESET, GPIOF_OUT_INIT_HIGH,
+			       "phy_reset");
 
 	if (ret) {
 		pr_debug("failed to get MX51_PAD_EIM_D21__GPIO_2_5: %d\n", ret);
 		return ret;
 	}
-	gpio_direction_output(BABBAGE_PHY_RESET, 1);
 	return 0;
 }
 
@@ -209,12 +209,12 @@ static inline void babbage_usbhub_reset(
 	int ret;
 
 	/* Bring USB hub out of reset */
-	ret = gpio_request(BABBAGE_USB_HUB_RESET, "GPIO1_7");
+	ret = gpio_request_one(BABBAGE_USB_HUB_RESET, GPIOF_OUT_INIT_LOW,
+			       "GPIO1_7");
 	if (ret) {
 		printk(KERN_ERR"failed to get GPIO_USB_HUB_RESET: %d\n", ret);
 		return;
 	}
-	gpio_direction_output(BABBAGE_USB_HUB_RESET, 0);
 
 	/* USB HUB RESET - De-assert USB HUB RESET_N */
 	msleep(1);
@@ -228,12 +228,12 @@ static inline void babbage_fec_reset(voi
 	int ret;
 
 	/* reset FEC PHY */
-	ret = gpio_request(BABBAGE_FEC_PHY_RESET, "fec-phy-reset");
+	ret = gpio_request_one(BABBAGE_FEC_PHY_RESET, GPIOF_OUT_INIT_LOW,
+			       "fec-phy-reset");
 	if (ret) {
 		printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
 		return;
 	}
-	gpio_direction_output(BABBAGE_FEC_PHY_RESET, 0);
 	gpio_set_value(BABBAGE_FEC_PHY_RESET, 0);
 	msleep(1);
 	gpio_set_value(BABBAGE_FEC_PHY_RESET, 1);
diff -u -p a/arch/arm/mach-mx5/board-mx51_efikamx.c b/arch/arm/mach-mx5/board-mx51_efikamx.c
--- a/arch/arm/mach-mx5/board-mx51_efikamx.c 2011-02-26 13:17:46.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx51_efikamx.c 2011-03-20 21:01:54.000000000 +0100
@@ -104,12 +104,11 @@ static void __init mx51_efikamx_board_id
 	/* things are taking time to settle */
 	msleep(150);
 
-	gpio_request(EFIKAMX_PCBID0, "pcbid0");
-	gpio_direction_input(EFIKAMX_PCBID0);
-	gpio_request(EFIKAMX_PCBID1, "pcbid1");
-	gpio_direction_input(EFIKAMX_PCBID1);
-	gpio_request(EFIKAMX_PCBID2, "pcbid2");
-	gpio_direction_input(EFIKAMX_PCBID2);
+	gpio_request_one(EFIKAMX_PCBID0, GPIOF_IN, "pcbid0");
+	
+	gpio_request_one(EFIKAMX_PCBID1, GPIOF_IN, "pcbid1");
+	
+	gpio_request_one(EFIKAMX_PCBID2, GPIOF_IN, "pcbid2");
 
 	id = gpio_get_value(EFIKAMX_PCBID0);
 	id |= gpio_get_value(EFIKAMX_PCBID1) << 1;
@@ -255,11 +254,10 @@ static void __init mx51_efikamx_init(voi
 	imx51_add_gpio_keys(&mx51_efikamx_powerkey_data);
 
 	if (system_rev == 0x11) {
-		gpio_request(EFIKAMX_RESET1_1, "reset");
-		gpio_direction_output(EFIKAMX_RESET1_1, 1);
+		gpio_request_one(EFIKAMX_RESET1_1, GPIOF_OUT_INIT_HIGH,
+				 "reset");
 	} else {
-		gpio_request(EFIKAMX_RESET, "reset");
-		gpio_direction_output(EFIKAMX_RESET, 1);
+		gpio_request_one(EFIKAMX_RESET, GPIOF_OUT_INIT_HIGH, "reset");
 	}
 
 	/*
@@ -267,12 +265,10 @@ static void __init mx51_efikamx_init(voi
 	 * sb and mx have same wlan pin but the value to enable it are
 	 * different :/
 	 */
-	gpio_request(EFIKA_WLAN_EN, "wlan_en");
-	gpio_direction_output(EFIKA_WLAN_EN, 0);
+	gpio_request_one(EFIKA_WLAN_EN, GPIOF_OUT_INIT_LOW, "wlan_en");
 	msleep(10);
 
-	gpio_request(EFIKA_WLAN_RESET, "wlan_rst");
-	gpio_direction_output(EFIKA_WLAN_RESET, 0);
+	gpio_request_one(EFIKA_WLAN_RESET, GPIOF_OUT_INIT_LOW, "wlan_rst");
 	msleep(10);
 	gpio_set_value(EFIKA_WLAN_RESET, 1);
 }
diff -u -p a/arch/arm/mach-mx5/board-mx51_efikasb.c b/arch/arm/mach-mx5/board-mx51_efikasb.c
--- a/arch/arm/mach-mx5/board-mx51_efikasb.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx51_efikasb.c 2011-03-20 21:01:54.000000000 +0100
@@ -108,8 +108,7 @@ static int initialize_usbh2_port(struct 
 	iomux_v3_cfg_t usbh2gpio = MX51_PAD_EIM_A26__GPIO2_20;
 
 	mxc_iomux_v3_setup_pad(usbh2gpio);
-	gpio_request(EFIKASB_USBH2_STP, "usbh2_stp");
-	gpio_direction_output(EFIKASB_USBH2_STP, 0);
+	gpio_request_one(EFIKASB_USBH2_STP, GPIOF_OUT_INIT_LOW, "usbh2_stp");
 	msleep(1);
 	gpio_set_value(EFIKASB_USBH2_STP, 1);
 	msleep(1);
@@ -229,10 +228,9 @@ static void __init mx51_efikasb_board_id
 {
 	int id;
 
-	gpio_request(EFIKASB_PCBID0, "pcb id0");
-	gpio_direction_input(EFIKASB_PCBID0);
-	gpio_request(EFIKASB_PCBID1, "pcb id1");
-	gpio_direction_input(EFIKASB_PCBID1);
+	gpio_request_one(EFIKASB_PCBID0, GPIOF_IN, "pcb id0");
+	
+	gpio_request_one(EFIKASB_PCBID1, GPIOF_IN, "pcb id1");
 
 	id = gpio_get_value(EFIKASB_PCBID0);
 	id |= gpio_get_value(EFIKASB_PCBID1) << 1;
diff -u -p a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c
--- a/arch/arm/mach-mx5/board-mx53_evk.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx53_evk.c 2011-03-20 21:01:50.000000000 +0100
@@ -82,12 +82,12 @@ static inline void mx53_evk_fec_reset(vo
 	int ret;
 
 	/* reset FEC PHY */
-	ret = gpio_request(SMD_FEC_PHY_RST, "fec-phy-reset");
+	ret = gpio_request_one(SMD_FEC_PHY_RST, GPIOF_OUT_INIT_LOW,
+			       "fec-phy-reset");
 	if (ret) {
 		printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
 		return;
 	}
-	gpio_direction_output(SMD_FEC_PHY_RST, 0);
 	gpio_set_value(SMD_FEC_PHY_RST, 0);
 	msleep(1);
 	gpio_set_value(SMD_FEC_PHY_RST, 1);
diff -u -p a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c
--- a/arch/arm/mach-mx5/board-mx53_loco.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx53_loco.c 2011-03-20 21:01:49.000000000 +0100
@@ -185,12 +185,12 @@ static inline void mx53_loco_fec_reset(v
 	int ret;
 
 	/* reset FEC PHY */
-	ret = gpio_request(LOCO_FEC_PHY_RST, "fec-phy-reset");
+	ret = gpio_request_one(LOCO_FEC_PHY_RST, GPIOF_OUT_INIT_LOW,
+			       "fec-phy-reset");
 	if (ret) {
 		printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
 		return;
 	}
-	gpio_direction_output(LOCO_FEC_PHY_RST, 0);
 	msleep(1);
 	gpio_set_value(LOCO_FEC_PHY_RST, 1);
 }
diff -u -p a/arch/arm/mach-mx5/board-mx53_smd.c b/arch/arm/mach-mx5/board-mx53_smd.c
--- a/arch/arm/mach-mx5/board-mx53_smd.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx53_smd.c 2011-03-20 21:01:53.000000000 +0100
@@ -70,12 +70,12 @@ static inline void mx53_smd_fec_reset(vo
 	int ret;
 
 	/* reset FEC PHY */
-	ret = gpio_request(SMD_FEC_PHY_RST, "fec-phy-reset");
+	ret = gpio_request_one(SMD_FEC_PHY_RST, GPIOF_OUT_INIT_LOW,
+			       "fec-phy-reset");
 	if (ret) {
 		printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
 		return;
 	}
-	gpio_direction_output(SMD_FEC_PHY_RST, 0);
 	msleep(1);
 	gpio_set_value(SMD_FEC_PHY_RST, 1);
 }
diff -u -p a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
--- a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c 2011-03-20 21:01:49.000000000 +0100
@@ -193,25 +193,20 @@ void __init eukrea_mbimx51_baseboard_ini
 	imx51_add_imx_uart(1, NULL);
 	imx51_add_imx_uart(2, &uart_pdata);
 
-	gpio_request(MBIMX51_LED0, "LED0");
-	gpio_direction_output(MBIMX51_LED0, 1);
+	gpio_request_one(MBIMX51_LED0, GPIOF_OUT_INIT_HIGH, "LED0");
 	gpio_free(MBIMX51_LED0);
-	gpio_request(MBIMX51_LED1, "LED1");
-	gpio_direction_output(MBIMX51_LED1, 1);
+	gpio_request_one(MBIMX51_LED1, GPIOF_OUT_INIT_HIGH, "LED1");
 	gpio_free(MBIMX51_LED1);
-	gpio_request(MBIMX51_LED2, "LED2");
-	gpio_direction_output(MBIMX51_LED2, 1);
+	gpio_request_one(MBIMX51_LED2, GPIOF_OUT_INIT_HIGH, "LED2");
 	gpio_free(MBIMX51_LED2);
-	gpio_request(MBIMX51_LED3, "LED3");
-	gpio_direction_output(MBIMX51_LED3, 1);
+	gpio_request_one(MBIMX51_LED3, GPIOF_OUT_INIT_HIGH, "LED3");
 	gpio_free(MBIMX51_LED3);
 
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 
 	imx51_add_imx_keypad(&mbimx51_map_data);
 
-	gpio_request(MBIMX51_TSC2007_GPIO, "tsc2007_irq");
-	gpio_direction_input(MBIMX51_TSC2007_GPIO);
+	gpio_request_one(MBIMX51_TSC2007_GPIO, GPIOF_IN, "tsc2007_irq");
 	set_irq_type(MBIMX51_TSC2007_IRQ, IRQF_TRIGGER_FALLING);
 	i2c_register_board_info(1, mbimx51_i2c_devices,
 				ARRAY_SIZE(mbimx51_i2c_devices));
diff -u -p a/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c
--- a/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c 2011-01-09 09:32:57.000000000 +0100
+++ b/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c 2011-03-20 21:01:53.000000000 +0100
@@ -150,12 +150,10 @@ void __init eukrea_mbimxsd51_baseboard_i
 
 	imx51_add_sdhci_esdhc_imx(0, NULL);
 
-	gpio_request(GPIO_LED1, "LED1");
-	gpio_direction_output(GPIO_LED1, 1);
+	gpio_request_one(GPIO_LED1, GPIOF_OUT_INIT_HIGH, "LED1");
 	gpio_free(GPIO_LED1);
 
-	gpio_request(GPIO_SWITCH1, "SWITCH1");
-	gpio_direction_input(GPIO_SWITCH1);
+	gpio_request_one(GPIO_SWITCH1, GPIOF_IN, "SWITCH1");
 	gpio_free(GPIO_SWITCH1);
 
 	i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
diff -u -p a/arch/arm/mach-mx5/mx51_efika.c b/arch/arm/mach-mx5/mx51_efika.c
--- a/arch/arm/mach-mx5/mx51_efika.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx5/mx51_efika.c 2011-03-20 21:01:53.000000000 +0100
@@ -168,8 +168,7 @@ static int initialize_usbh1_port(struct 
 	void __iomem *socregs_base;
 
 	mxc_iomux_v3_setup_pad(usbh1gpio);
-	gpio_request(EFIKAMX_USBH1_STP, "usbh1_stp");
-	gpio_direction_output(EFIKAMX_USBH1_STP, 0);
+	gpio_request_one(EFIKAMX_USBH1_STP, GPIOF_OUT_INIT_LOW, "usbh1_stp");
 	msleep(1);
 	gpio_set_value(EFIKAMX_USBH1_STP, 1);
 	msleep(1);
@@ -200,8 +199,8 @@ static struct mxc_usbh_platform_data usb
 
 static void mx51_efika_hubreset(void)
 {
-	gpio_request(EFIKAMX_USB_HUB_RESET, "usb_hub_rst");
-	gpio_direction_output(EFIKAMX_USB_HUB_RESET, 1);
+	gpio_request_one(EFIKAMX_USB_HUB_RESET, GPIOF_OUT_INIT_HIGH,
+			 "usb_hub_rst");
 	msleep(1);
 	gpio_set_value(EFIKAMX_USB_HUB_RESET, 0);
 	msleep(1);
@@ -213,8 +212,8 @@ static void __init mx51_efika_usb(void)
 	mx51_efika_hubreset();
 
 	/* pulling it low, means no USB at all... */
-	gpio_request(EFIKA_USB_PHY_RESET, "usb_phy_reset");
-	gpio_direction_output(EFIKA_USB_PHY_RESET, 0);
+	gpio_request_one(EFIKA_USB_PHY_RESET, GPIOF_OUT_INIT_LOW,
+			 "usb_phy_reset");
 	msleep(1);
 	gpio_set_value(EFIKA_USB_PHY_RESET, 1);
 
@@ -623,8 +622,7 @@ void __init efika_board_common_init(void
 	if (machine_is_mx51_efikasb())
 		vgen1_init.constraints.max_uV = 1200000;
 
-	gpio_request(EFIKAMX_PMIC, "pmic irq");
-	gpio_direction_input(EFIKAMX_PMIC);
+	gpio_request_one(EFIKAMX_PMIC, GPIOF_IN, "pmic irq");
 	spi_register_board_info(mx51_efika_spi_board_info,
 		ARRAY_SIZE(mx51_efika_spi_board_info));
 	imx51_add_ecspi(0, &mx51_efika_spi_pdata);
diff -u -p a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
--- a/arch/arm/mach-mxs/mach-mx28evk.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mxs/mach-mx28evk.c 2011-03-20 21:01:53.000000000 +0100
@@ -142,13 +142,13 @@ static void __init mx28evk_fec_reset(voi
 	}
 
 	/* Reset fec phy */
-	ret = gpio_request(MX28EVK_FEC_PHY_RESET, "fec-phy-reset");
+	ret = gpio_request_one(MX28EVK_FEC_PHY_RESET, GPIOF_OUT_INIT_LOW,
+			       "fec-phy-reset");
 	if (ret) {
 		pr_err("Failed to request gpio fec-phy-%s: %d\n", "reset", ret);
 		return;
 	}
 
-	gpio_direction_output(MX28EVK_FEC_PHY_RESET, 0);
 	if (ret) {
 		pr_err("Failed to drive gpio fec-phy-%s: %d\n", "reset", ret);
 		return;
diff -u -p a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
--- a/arch/arm/mach-omap1/board-ams-delta.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-omap1/board-ams-delta.c 2011-03-20 21:01:51.000000000 +0100
@@ -364,12 +364,12 @@ static int __init ams_delta_modem_init(v
 	ams_delta_modem_ports[0].irq =
 			gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
 
-	err = gpio_request(AMS_DELTA_GPIO_PIN_MODEM_IRQ, "modem");
+	err = gpio_request_one(AMS_DELTA_GPIO_PIN_MODEM_IRQ, GPIOF_IN,
+			       "modem");
 	if (err) {
 		pr_err("Couldn't request gpio pin for modem\n");
 		return err;
 	}
-	gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
 
 	ams_delta_latch2_write(
 		AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC,
diff -u -p a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
--- a/arch/arm/mach-omap1/board-fsample.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-omap1/board-fsample.c 2011-03-20 21:01:52.000000000 +0100
@@ -299,9 +299,8 @@ static void __init omap_fsample_init(voi
 {
 	fsample_init_smc91x();
 
-	if (gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0)
+	if (gpio_request_one(FSAMPLE_NAND_RB_GPIO_PIN, GPIOF_IN, "NAND ready") < 0)
 		BUG();
-	gpio_direction_input(FSAMPLE_NAND_RB_GPIO_PIN);
 
 	omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
 	omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
diff -u -p a/arch/arm/mach-omap1/board-h2-mmc.c b/arch/arm/mach-omap1/board-h2-mmc.c
--- a/arch/arm/mach-omap1/board-h2-mmc.c 2010-10-04 07:26:41.000000000 +0200
+++ b/arch/arm/mach-omap1/board-h2-mmc.c 2011-03-20 21:01:52.000000000 +0100
@@ -32,12 +32,11 @@ static int mmc_set_power(struct device *
 
 static int mmc_late_init(struct device *dev)
 {
-	int ret = gpio_request(H2_TPS_GPIO_MMC_PWR_EN, "MMC power");
+	int ret = gpio_request_one(H2_TPS_GPIO_MMC_PWR_EN,
+				   GPIOF_OUT_INIT_LOW, "MMC power");
 	if (ret < 0)
 		return ret;
 
-	gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 0);
-
 	return ret;
 }
 
diff -u -p a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
--- a/arch/arm/mach-omap1/board-h2.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-omap1/board-h2.c 2011-03-20 21:01:52.000000000 +0100
@@ -420,9 +420,8 @@ static void __init h2_init(void)
 
 	h2_nand_resource.end = h2_nand_resource.start = OMAP_CS2B_PHYS;
 	h2_nand_resource.end += SZ_4K - 1;
-	if (gpio_request(H2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
+	if (gpio_request_one(H2_NAND_RB_GPIO_PIN, GPIOF_IN, "NAND ready") < 0)
 		BUG();
-	gpio_direction_input(H2_NAND_RB_GPIO_PIN);
 
 	omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
 	omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
diff -u -p a/arch/arm/mach-omap1/board-h3-mmc.c b/arch/arm/mach-omap1/board-h3-mmc.c
--- a/arch/arm/mach-omap1/board-h3-mmc.c 2010-10-04 07:26:41.000000000 +0200
+++ b/arch/arm/mach-omap1/board-h3-mmc.c 2011-03-20 21:01:52.000000000 +0100
@@ -51,10 +51,10 @@ void __init h3_mmc_init(void)
 {
 	int ret;
 
-	ret = gpio_request(H3_TPS_GPIO_MMC_PWR_EN, "MMC power");
+	ret = gpio_request_one(H3_TPS_GPIO_MMC_PWR_EN, GPIOF_OUT_INIT_LOW,
+			       "MMC power");
 	if (ret < 0)
 		return;
-	gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 0);
 
 	mmc_data[0] = &mmc1_data;
 	omap1_init_mmc(mmc_data, OMAP16XX_NR_MMC);
diff -u -p a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
--- a/arch/arm/mach-omap1/board-h3.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-omap1/board-h3.c 2011-03-20 21:01:52.000000000 +0100
@@ -403,9 +403,8 @@ static void __init h3_init(void)
 
 	nand_resource.end = nand_resource.start = OMAP_CS2B_PHYS;
 	nand_resource.end += SZ_4K - 1;
-	if (gpio_request(H3_NAND_RB_GPIO_PIN, "NAND ready") < 0)
+	if (gpio_request_one(H3_NAND_RB_GPIO_PIN, GPIOF_IN, "NAND ready") < 0)
 		BUG();
-	gpio_direction_input(H3_NAND_RB_GPIO_PIN);
 
 	/* GPIO10 Func_MUX_CTRL reg bit 29:27, Configure V2 to mode1 as GPIO */
 	/* GPIO10 pullup/down register, Enable pullup on GPIO10 */
diff -u -p a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
--- a/arch/arm/mach-omap1/board-htcherald.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-omap1/board-htcherald.c 2011-03-20 21:01:51.000000000 +0100
@@ -536,31 +536,29 @@ static void __init htcherald_usb_enable(
 	unsigned int value = 0;
 
 	/* Request the GPIOs we need to control here */
-	if (gpio_request(HTCHERALD_GPIO_USB_EN1, "herald_usb") < 0)
+	if (gpio_request_one(HTCHERALD_GPIO_USB_EN1, GPIOF_OUT_INIT_LOW,
+			     "herald_usb") < 0)
 		goto err1;
 
-	if (gpio_request(HTCHERALD_GPIO_USB_EN2, "herald_usb") < 0)
+	if (gpio_request_one(HTCHERALD_GPIO_USB_EN2, GPIOF_OUT_INIT_LOW,
+			     "herald_usb") < 0)
 		goto err2;
 
-	if (gpio_request(HTCHERALD_GPIO_USB_DM, "herald_usb") < 0)
+	if (gpio_request_one(HTCHERALD_GPIO_USB_DM, GPIOF_IN, "herald_usb") < 0)
 		goto err3;
 
-	if (gpio_request(HTCHERALD_GPIO_USB_DP, "herald_usb") < 0)
+	if (gpio_request_one(HTCHERALD_GPIO_USB_DP, GPIOF_IN, "herald_usb") < 0)
 		goto err4;
 
 	/* force USB_EN GPIO to 0 */
 	do {
-		/* output low */
-		gpio_direction_output(HTCHERALD_GPIO_USB_EN1, 0);
 	} while ((value = gpio_get_value(HTCHERALD_GPIO_USB_EN1)) == 1 &&
 			--tries);
 
 	if (value == 1)
 		printk(KERN_WARNING "Unable to reset USB, trying to continue\n");
-
-	gpio_direction_output(HTCHERALD_GPIO_USB_EN2, 0); /* output low */
-	gpio_direction_input(HTCHERALD_GPIO_USB_DM); /* input */
-	gpio_direction_input(HTCHERALD_GPIO_USB_DP); /* input */
+/* output low */ /* input */
+	/* input */
 
 	goto done;
 
diff -u -p a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
--- a/arch/arm/mach-omap1/board-nokia770.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-omap1/board-nokia770.c 2011-03-20 21:01:52.000000000 +0100
@@ -221,17 +221,17 @@ static void __init nokia770_mmc_init(voi
 {
 	int ret;
 
-	ret = gpio_request(NOKIA770_GPIO_MMC_POWER, "MMC power");
+	ret = gpio_request_one(NOKIA770_GPIO_MMC_POWER, GPIOF_OUT_INIT_LOW,
+			       "MMC power");
 	if (ret < 0)
 		return;
-	gpio_direction_output(NOKIA770_GPIO_MMC_POWER, 0);
 
-	ret = gpio_request(NOKIA770_GPIO_MMC_SWITCH, "MMC cover");
+	ret = gpio_request_one(NOKIA770_GPIO_MMC_SWITCH, GPIOF_IN,
+			       "MMC cover");
 	if (ret < 0) {
 		gpio_free(NOKIA770_GPIO_MMC_POWER);
 		return;
 	}
-	gpio_direction_input(NOKIA770_GPIO_MMC_SWITCH);
 
 	/* Only the second MMC controller is used */
 	nokia770_mmc_data[1] = &nokia770_mmc2_data;
diff -u -p a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
--- a/arch/arm/mach-omap1/board-osk.c 2010-12-28 18:26:02.000000000 +0100
+++ b/arch/arm/mach-omap1/board-osk.c 2011-03-20 21:01:52.000000000 +0100
@@ -197,19 +197,19 @@ static int osk_tps_setup(struct i2c_clie
 	/* Set GPIO 1 HIGH to disable VBUS power supply;
 	 * OHCI driver powers it up/down as needed.
 	 */
-	gpio_request(OSK_TPS_GPIO_USB_PWR_EN, "n_vbus_en");
-	gpio_direction_output(OSK_TPS_GPIO_USB_PWR_EN, 1);
+	gpio_request_one(OSK_TPS_GPIO_USB_PWR_EN, GPIOF_OUT_INIT_HIGH,
+			 "n_vbus_en");
 
 	/* Set GPIO 2 high so LED D3 is off by default */
 	tps65010_set_gpio_out_value(GPIO2, HIGH);
 
 	/* Set GPIO 3 low to take ethernet out of reset */
-	gpio_request(OSK_TPS_GPIO_LAN_RESET, "smc_reset");
-	gpio_direction_output(OSK_TPS_GPIO_LAN_RESET, 0);
+	gpio_request_one(OSK_TPS_GPIO_LAN_RESET, GPIOF_OUT_INIT_LOW,
+			 "smc_reset");
 
 	/* GPIO4 is VDD_DSP */
-	gpio_request(OSK_TPS_GPIO_DSP_PWR_EN, "dsp_power");
-	gpio_direction_output(OSK_TPS_GPIO_DSP_PWR_EN, 1);
+	gpio_request_one(OSK_TPS_GPIO_DSP_PWR_EN, GPIOF_OUT_INIT_HIGH,
+			 "dsp_power");
 	/* REVISIT if DSP support isn't configured, power it off ... */
 
 	/* Let LED1 (D9) blink; leds-gpio may override it */
@@ -476,12 +476,10 @@ static void __init osk_mistral_init(void
 
 
 	/* omap_cfg_reg(P19_1610_GPIO6); */	/* BUSY */
-	gpio_request(6, "ts_busy");
-	gpio_direction_input(6);
+	gpio_request_one(6, GPIOF_IN, "ts_busy");
 
 	omap_cfg_reg(P20_1610_GPIO4);	/* PENIRQ */
-	gpio_request(4, "ts_int");
-	gpio_direction_input(4);
+	gpio_request_one(4, GPIOF_IN, "ts_int");
 	set_irq_type(gpio_to_irq(4), IRQ_TYPE_EDGE_FALLING);
 
 	spi_register_board_info(mistral_boardinfo,
diff -u -p a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
--- a/arch/arm/mach-omap1/board-palmte.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-omap1/board-palmte.c 2011-03-20 21:01:52.000000000 +0100
@@ -233,18 +233,16 @@ static struct spi_board_info palmte_spi_
 static void __init palmte_misc_gpio_setup(void)
 {
 	/* Set TSC2102 PINTDAV pin as input (used by TSC2102 driver) */
-	if (gpio_request(PALMTE_PINTDAV_GPIO, "TSC2102 PINTDAV") < 0) {
+	if (gpio_request_one(PALMTE_PINTDAV_GPIO, GPIOF_IN, "TSC2102 PINTDAV") < 0) {
 		printk(KERN_ERR "Could not reserve PINTDAV GPIO!\n");
 		return;
 	}
-	gpio_direction_input(PALMTE_PINTDAV_GPIO);
 
 	/* Set USB-or-DC-IN pin as input (unused) */
-	if (gpio_request(PALMTE_USB_OR_DC_GPIO, "USB/DC-IN") < 0) {
+	if (gpio_request_one(PALMTE_USB_OR_DC_GPIO, GPIOF_IN, "USB/DC-IN") < 0) {
 		printk(KERN_ERR "Could not reserve cable signal GPIO!\n");
 		return;
 	}
-	gpio_direction_input(PALMTE_USB_OR_DC_GPIO);
 }
 
 static void __init omap_palmte_init(void)
diff -u -p a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
--- a/arch/arm/mach-omap1/board-palmz71.c 2010-12-28 18:26:02.000000000 +0100
+++ b/arch/arm/mach-omap1/board-palmz71.c 2011-03-20 21:01:51.000000000 +0100
@@ -285,19 +285,18 @@ palmz71_gpio_setup(int early)
 		gpio_direction_output(1, 1);
 	} else {
 		/* Set MMC/SD host WP pin as input */
-		if (gpio_request(PALMZ71_MMC_WP_GPIO, "MMC WP") < 0) {
+		if (gpio_request_one(PALMZ71_MMC_WP_GPIO, GPIOF_IN, "MMC WP") < 0) {
 			printk(KERN_ERR "Could not reserve WP GPIO!\n");
 			return;
 		}
-		gpio_direction_input(PALMZ71_MMC_WP_GPIO);
 
 		/* Monitor the Power-cable-connected signal */
-		if (gpio_request(PALMZ71_USBDETECT_GPIO, "USB detect") < 0) {
+		if (gpio_request_one(PALMZ71_USBDETECT_GPIO, GPIOF_IN,
+				     "USB detect") < 0) {
 			printk(KERN_ERR
 				"Could not reserve cable signal GPIO!\n");
 			return;
 		}
-		gpio_direction_input(PALMZ71_USBDETECT_GPIO);
 		if (request_irq(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
 				palmz71_powercable, IRQF_SAMPLE_RANDOM,
 				"palmz71-cable", 0))
diff -u -p a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
--- a/arch/arm/mach-omap1/board-perseus2.c 2010-12-28 18:26:02.000000000 +0100
+++ b/arch/arm/mach-omap1/board-perseus2.c 2011-03-20 21:01:51.000000000 +0100
@@ -267,9 +267,8 @@ static void __init omap_perseus2_init(vo
 {
 	perseus2_init_smc91x();
 
-	if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
+	if (gpio_request_one(P2_NAND_RB_GPIO_PIN, GPIOF_IN, "NAND ready") < 0)
 		BUG();
-	gpio_direction_input(P2_NAND_RB_GPIO_PIN);
 
 	omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
 	omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
diff -u -p a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
--- a/arch/arm/mach-omap1/board-sx1.c 2010-12-28 18:26:02.000000000 +0100
+++ b/arch/arm/mach-omap1/board-sx1.c 2011-03-20 21:01:52.000000000 +0100
@@ -400,12 +400,10 @@ static void __init omap_sx1_init(void)
 
 	/* turn on USB power */
 	/* sx1_setusbpower(1); cant do it here because i2c is not ready */
-	gpio_request(1, "A_IRDA_OFF");
-	gpio_request(11, "A_SWITCH");
-	gpio_request(15, "A_USB_ON");
-	gpio_direction_output(1, 1);	/*A_IRDA_OFF = 1 */
-	gpio_direction_output(11, 0);	/*A_SWITCH = 0 */
-	gpio_direction_output(15, 0);	/*A_USB_ON = 0 */
+	gpio_request_one(1, GPIOF_OUT_INIT_HIGH, "A_IRDA_OFF");
+	gpio_request_one(11, GPIOF_OUT_INIT_LOW, "A_SWITCH");
+	gpio_request_one(15, GPIOF_OUT_INIT_LOW, "A_USB_ON");/*A_IRDA_OFF = 1 */	/*A_SWITCH = 0 */
+	/*A_USB_ON = 0 */
 }
 /*----------------------------------------*/
 static void __init omap_sx1_init_irq(void)
diff -u -p a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
--- a/arch/arm/mach-omap1/board-voiceblue.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-omap1/board-voiceblue.c 2011-03-20 21:01:53.000000000 +0100
@@ -264,16 +264,14 @@ static void __init voiceblue_init(void)
 	/* Watchdog */
 	gpio_request(0, "Watchdog");
 	/* smc91x reset */
-	gpio_request(7, "SMC91x reset");
-	gpio_direction_output(7, 1);
+	gpio_request_one(7, GPIOF_OUT_INIT_HIGH, "SMC91x reset");
 	udelay(2);	/* wait@least 100ns */
 	gpio_set_value(7, 0);
 	mdelay(50);	/* 50ms until PHY ready */
 	/* smc91x interrupt pin */
 	gpio_request(8, "SMC91x irq");
 	/* 16C554 reset*/
-	gpio_request(6, "16C554 reset");
-	gpio_direction_output(6, 0);
+	gpio_request_one(6, GPIOF_OUT_INIT_LOW, "16C554 reset");
 	/* 16C554 interrupt pins */
 	gpio_request(12, "16C554 irq");
 	gpio_request(13, "16C554 irq");
diff -u -p a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
--- a/arch/arm/mach-omap1/fpga.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/arm/mach-omap1/fpga.c 2011-03-20 21:01:52.000000000 +0100
@@ -177,12 +177,11 @@ void omap1510_fpga_init_irq(void)
 	 * NOTE: For general GPIO/MPUIO access and interrupts, please see
 	 * gpio.[ch]
 	 */
-	res = gpio_request(13, "FPGA irq");
+	res = gpio_request_one(13, GPIOF_IN, "FPGA irq");
 	if (res) {
 		pr_err("%s failed to get gpio\n", __func__);
 		return;
 	}
-	gpio_direction_input(13);
 	set_irq_type(gpio_to_irq(13), IRQ_TYPE_EDGE_RISING);
 	set_irq_chained_handler(OMAP1510_INT_FPGA, innovator_fpga_IRQ_demux);
 }
diff -u -p a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
--- a/arch/arm/mach-omap1/serial.c 2010-12-26 10:19:06.000000000 +0100
+++ b/arch/arm/mach-omap1/serial.c 2011-03-20 21:01:51.000000000 +0100
@@ -220,13 +220,12 @@ static void __init omap_serial_set_port_
 {
 	int ret;
 
-	ret = gpio_request(gpio_nr, "UART wake");
+	ret = gpio_request_one(gpio_nr, GPIOF_IN, "UART wake");
 	if (ret < 0) {
 		printk(KERN_ERR "Could not request UART wake GPIO: %i\n",
 		       gpio_nr);
 		return;
 	}
-	gpio_direction_input(gpio_nr);
 	ret = request_irq(gpio_to_irq(gpio_nr), &omap_serial_wake_interrupt,
 			  IRQF_TRIGGER_RISING, "serial wakeup", NULL);
 	if (ret) {
diff -u -p a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
--- a/arch/arm/mach-omap2/board-3430sdp.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-3430sdp.c 2011-03-20 21:01:52.000000000 +0100
@@ -132,12 +132,11 @@ static int ts_gpio;	/* Needed for ads784
  */
 static void ads7846_dev_init(void)
 {
-	if (gpio_request(ts_gpio, "ADS7846 pendown") < 0) {
+	if (gpio_request_one(ts_gpio, GPIOF_IN, "ADS7846 pendown") < 0) {
 		printk(KERN_ERR "can't get ads746 pen down GPIO\n");
 		return;
 	}
 
-	gpio_direction_input(ts_gpio);
 	gpio_set_debounce(ts_gpio, 310);
 }
 
@@ -190,21 +189,19 @@ static void __init sdp3430_display_init(
 	enable_gpio    = SDP3430_LCD_PANEL_ENABLE_GPIO;
 	backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO;
 
-	r = gpio_request(enable_gpio, "LCD reset");
+	r = gpio_request_one(enable_gpio, GPIOF_OUT_INIT_LOW, "LCD reset");
 	if (r) {
 		printk(KERN_ERR "failed to get LCD reset GPIO\n");
 		goto err0;
 	}
 
-	r = gpio_request(backlight_gpio, "LCD Backlight");
+	r = gpio_request_one(backlight_gpio, GPIOF_OUT_INIT_LOW,
+			     "LCD Backlight");
 	if (r) {
 		printk(KERN_ERR "failed to get LCD backlight GPIO\n");
 		goto err1;
 	}
 
-	gpio_direction_output(enable_gpio, 0);
-	gpio_direction_output(backlight_gpio, 0);
-
 	return;
 err1:
 	gpio_free(enable_gpio);
@@ -360,12 +357,10 @@ static int sdp3430_twl_gpio_setup(struct
 	omap2_hsmmc_init(mmc);
 
 	/* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
-	gpio_request(gpio + 7, "sub_lcd_en_bkl");
-	gpio_direction_output(gpio + 7, 0);
+	gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "sub_lcd_en_bkl");
 
 	/* gpio + 15 is "sub_lcd_nRST" (output) */
-	gpio_request(gpio + 15, "sub_lcd_nRST");
-	gpio_direction_output(gpio + 15, 0);
+	gpio_request_one(gpio + 15, GPIOF_OUT_INIT_LOW, "sub_lcd_nRST");
 
 	return 0;
 }
diff -u -p a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
--- a/arch/arm/mach-omap2/board-am3517evm.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-am3517evm.c 2011-03-20 21:01:54.000000000 +0100
@@ -252,30 +252,29 @@ static void __init am3517_evm_display_in
 	/*
 	 * Enable GPIO 182 = LCD Backlight Power
 	 */
-	r = gpio_request(LCD_PANEL_BKLIGHT_PWR, "lcd_backlight_pwr");
+	r = gpio_request_one(LCD_PANEL_BKLIGHT_PWR, GPIOF_OUT_INIT_HIGH,
+			     "lcd_backlight_pwr");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_backlight_pwr\n");
 		return;
 	}
-	gpio_direction_output(LCD_PANEL_BKLIGHT_PWR, 1);
 	/*
 	 * Enable GPIO 181 = LCD Panel PWM
 	 */
-	r = gpio_request(LCD_PANEL_PWM, "lcd_pwm");
+	r = gpio_request_one(LCD_PANEL_PWM, GPIOF_OUT_INIT_HIGH, "lcd_pwm");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_pwm\n");
 		goto err_1;
 	}
-	gpio_direction_output(LCD_PANEL_PWM, 1);
 	/*
 	 * Enable GPIO 176 = LCD Panel Power enable pin
 	 */
-	r = gpio_request(LCD_PANEL_PWR, "lcd_panel_pwr");
+	r = gpio_request_one(LCD_PANEL_PWR, GPIOF_OUT_INIT_HIGH,
+			     "lcd_panel_pwr");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_panel_pwr\n");
 		goto err_2;
 	}
-	gpio_direction_output(LCD_PANEL_PWR, 1);
 
 	printk(KERN_INFO "Display initialized successfully\n");
 	return;
diff -u -p a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
--- a/arch/arm/mach-omap2/board-apollon.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-apollon.c 2011-03-20 21:01:53.000000000 +0100
@@ -246,13 +246,12 @@ static inline void __init apollon_init_s
 	udelay(100);
 
 	omap_mux_init_gpio(74, 0);
-	if (gpio_request(APOLLON_ETHR_GPIO_IRQ, "SMC91x irq") < 0) {
+	if (gpio_request_one(APOLLON_ETHR_GPIO_IRQ, GPIOF_IN, "SMC91x irq") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
 			APOLLON_ETHR_GPIO_IRQ);
 		gpmc_cs_free(APOLLON_ETH_CS);
 		goto out;
 	}
-	gpio_direction_input(APOLLON_ETHR_GPIO_IRQ);
 
 out:
 	clk_disable(gpmc_fck);
@@ -284,16 +283,13 @@ static void __init apollon_led_init(void
 {
 	/* LED0 - AA10 */
 	omap_mux_init_signal("vlynq_clk.gpio_13", 0);
-	gpio_request(LED0_GPIO13, "LED0");
-	gpio_direction_output(LED0_GPIO13, 0);
+	gpio_request_one(LED0_GPIO13, GPIOF_OUT_INIT_LOW, "LED0");
 	/* LED1  - AA6 */
 	omap_mux_init_signal("vlynq_rx1.gpio_14", 0);
-	gpio_request(LED1_GPIO14, "LED1");
-	gpio_direction_output(LED1_GPIO14, 0);
+	gpio_request_one(LED1_GPIO14, GPIOF_OUT_INIT_LOW, "LED1");
 	/* LED2  - AA4 */
 	omap_mux_init_signal("vlynq_rx0.gpio_15", 0);
-	gpio_request(LED2_GPIO15, "LED2");
-	gpio_direction_output(LED2_GPIO15, 0);
+	gpio_request_one(LED2_GPIO15, GPIOF_OUT_INIT_LOW, "LED2");
 }
 
 static void __init apollon_usb_init(void)
@@ -301,8 +297,7 @@ static void __init apollon_usb_init(void
 	/* USB device */
 	/* DEVICE_SUSPEND */
 	omap_mux_init_signal("mcbsp2_clkx.gpio_12", 0);
-	gpio_request(12, "USB suspend");
-	gpio_direction_output(12, 0);
+	gpio_request_one(12, GPIOF_OUT_INIT_LOW, "USB suspend");
 	omap2_usbfs_init(&apollon_usb_config);
 }
 
diff -u -p a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
--- a/arch/arm/mach-omap2/board-cm-t3517.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-cm-t3517.c 2011-03-20 21:01:53.000000000 +0100
@@ -148,14 +148,13 @@ static void __init cm_t3517_init_rtc(voi
 {
 	int err;
 
-	err = gpio_request(RTC_CS_EN_GPIO, "rtc cs en");
+	err = gpio_request_one(RTC_CS_EN_GPIO, GPIOF_OUT_INIT_HIGH,
+			       "rtc cs en");
 	if (err) {
 		pr_err("CM-T3517: rtc cs en gpio request failed: %d\n", err);
 		return;
 	}
 
-	gpio_direction_output(RTC_CS_EN_GPIO, 1);
-
 	platform_device_register(&cm_t3517_rtc_device);
 }
 #else
diff -u -p a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
--- a/arch/arm/mach-omap2/board-devkit8000.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-devkit8000.c 2011-03-20 21:01:55.000000000 +0100
@@ -468,14 +468,12 @@ static void __init devkit8000_ads7846_in
 	int gpio = OMAP3_DEVKIT_TS_GPIO;
 	int ret;
 
-	ret = gpio_request(gpio, "ads7846_pen_down");
+	ret = gpio_request_one(gpio, GPIOF_IN, "ads7846_pen_down");
 	if (ret < 0) {
 		printk(KERN_ERR "Failed to request GPIO %d for "
 				"ads7846 pen down IRQ\n", gpio);
 		return;
 	}
-
-	gpio_direction_input(gpio);
 }
 
 static int ads7846_get_pendown_state(void)
@@ -551,14 +549,12 @@ static void __init omap_dm9000_init(void
 	unsigned char *eth_addr = omap_dm9000_platdata.dev_addr;
 	struct omap_die_id odi;
 
-	if (gpio_request(OMAP_DM9000_GPIO_IRQ, "dm9000 irq") < 0) {
+	if (gpio_request_one(OMAP_DM9000_GPIO_IRQ, GPIOF_IN, "dm9000 irq") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ\n",
 			OMAP_DM9000_GPIO_IRQ);
 		return;
 		}
 
-	gpio_direction_input(OMAP_DM9000_GPIO_IRQ);
-
 	/* init the mac address using DIE id */
 	omap_get_die_id(&odi);
 
diff -u -p a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
--- a/arch/arm/mach-omap2/board-ldp.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-ldp.c 2011-03-20 21:01:54.000000000 +0100
@@ -206,12 +206,11 @@ static int ts_gpio;
  */
 static void ads7846_dev_init(void)
 {
-	if (gpio_request(ts_gpio, "ads7846 irq") < 0) {
+	if (gpio_request_one(ts_gpio, GPIOF_IN, "ads7846 irq") < 0) {
 		printk(KERN_ERR "can't get ads746 pen down GPIO\n");
 		return;
 	}
 
-	gpio_direction_input(ts_gpio);
 	gpio_set_debounce(ts_gpio, 310);
 }
 
@@ -267,12 +266,11 @@ static inline void __init ldp_init_smsc9
 
 	ldp_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
 
-	if (gpio_request(eth_gpio, "smsc911x irq") < 0) {
+	if (gpio_request_one(eth_gpio, GPIOF_IN, "smsc911x irq") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
 				eth_gpio);
 		return;
 	}
-	gpio_direction_input(eth_gpio);
 }
 
 static struct platform_device ldp_lcd_device = {
diff -u -p a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
--- a/arch/arm/mach-omap2/board-n8x0.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-n8x0.c 2011-03-20 21:01:53.000000000 +0100
@@ -106,13 +106,13 @@ static void __init n8x0_usb_init(void)
 	static char	announce[] __initdata = KERN_INFO "TUSB 6010\n";
 
 	/* PM companion chip power control pin */
-	ret = gpio_request(TUSB6010_GPIO_ENABLE, "TUSB6010 enable");
+	ret = gpio_request_one(TUSB6010_GPIO_ENABLE, GPIOF_OUT_INIT_LOW,
+			       "TUSB6010 enable");
 	if (ret != 0) {
 		printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
 		       TUSB6010_GPIO_ENABLE);
 		return;
 	}
-	gpio_direction_output(TUSB6010_GPIO_ENABLE, 0);
 
 	tusb_set_power(0);
 
@@ -512,27 +512,26 @@ static void __init n8x0_mmc_init(void)
 		mmc1_data.slots[1].ban_openended = 1;
 	}
 
-	err = gpio_request(N8X0_SLOT_SWITCH_GPIO, "MMC slot switch");
+	err = gpio_request_one(N8X0_SLOT_SWITCH_GPIO, GPIOF_OUT_INIT_LOW,
+			       "MMC slot switch");
 	if (err)
 		return;
 
-	gpio_direction_output(N8X0_SLOT_SWITCH_GPIO, 0);
-
 	if (machine_is_nokia_n810()) {
-		err = gpio_request(N810_EMMC_VSD_GPIO, "MMC slot 2 Vddf");
+		err = gpio_request_one(N810_EMMC_VSD_GPIO,
+				       GPIOF_OUT_INIT_LOW, "MMC slot 2 Vddf");
 		if (err) {
 			gpio_free(N8X0_SLOT_SWITCH_GPIO);
 			return;
 		}
-		gpio_direction_output(N810_EMMC_VSD_GPIO, 0);
 
-		err = gpio_request(N810_EMMC_VIO_GPIO, "MMC slot 2 Vdd");
+		err = gpio_request_one(N810_EMMC_VIO_GPIO,
+				       GPIOF_OUT_INIT_LOW, "MMC slot 2 Vdd");
 		if (err) {
 			gpio_free(N8X0_SLOT_SWITCH_GPIO);
 			gpio_free(N810_EMMC_VSD_GPIO);
 			return;
 		}
-		gpio_direction_output(N810_EMMC_VIO_GPIO, 0);
 	}
 
 	mmc_data[0] = &mmc1_data;
diff -u -p a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
--- a/arch/arm/mach-omap2/board-omap3beagle.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-omap3beagle.c 2011-03-20 21:01:54.000000000 +0100
@@ -88,22 +88,18 @@ static void __init omap3_beagle_init_rev
 	omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP);
 	omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP);
 
-	ret = gpio_request(171, "rev_id_0");
+	ret = gpio_request_one(171, GPIOF_IN, "rev_id_0");
 	if (ret < 0)
 		goto fail0;
 
-	ret = gpio_request(172, "rev_id_1");
+	ret = gpio_request_one(172, GPIOF_IN, "rev_id_1");
 	if (ret < 0)
 		goto fail1;
 
-	ret = gpio_request(173, "rev_id_2");
+	ret = gpio_request_one(173, GPIOF_IN, "rev_id_2");
 	if (ret < 0)
 		goto fail2;
 
-	gpio_direction_input(171);
-	gpio_direction_input(172);
-	gpio_direction_input(173);
-
 	beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1)
 			| (gpio_get_value(173) << 2);
 
@@ -243,13 +239,12 @@ static void __init beagle_display_init(v
 {
 	int r;
 
-	r = gpio_request(beagle_dvi_device.reset_gpio, "DVI reset");
+	r = gpio_request_one(beagle_dvi_device.reset_gpio,
+			     GPIOF_OUT_INIT_LOW, "DVI reset");
 	if (r < 0) {
 		printk(KERN_ERR "Unable to get DVI reset GPIO\n");
 		return;
 	}
-
-	gpio_direction_output(beagle_dvi_device.reset_gpio, 0);
 }
 
 #include "sdram-micron-mt46h32m32lf-6.h"
diff -u -p a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
--- a/arch/arm/mach-omap2/board-omap3evm.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-omap3evm.c 2011-03-20 21:01:51.000000000 +0100
@@ -171,13 +171,12 @@ static inline void __init omap3evm_init_
 		usleep_range(1, 2);
 	}
 
-	if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) {
+	if (gpio_request_one(OMAP3EVM_ETHR_GPIO_IRQ, GPIOF_IN, "SMSC911x irq") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
 			OMAP3EVM_ETHR_GPIO_IRQ);
 		return;
 	}
 
-	gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ);
 	platform_device_register(&omap3evm_smsc911x_device);
 }
 
@@ -204,47 +203,47 @@ static void __init omap3_evm_display_ini
 {
 	int r;
 
-	r = gpio_request(OMAP3EVM_LCD_PANEL_RESB, "lcd_panel_resb");
+	r = gpio_request_one(OMAP3EVM_LCD_PANEL_RESB, GPIOF_OUT_INIT_HIGH,
+			     "lcd_panel_resb");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_panel_resb\n");
 		return;
 	}
-	gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB, 1);
 
-	r = gpio_request(OMAP3EVM_LCD_PANEL_INI, "lcd_panel_ini");
+	r = gpio_request_one(OMAP3EVM_LCD_PANEL_INI, GPIOF_OUT_INIT_HIGH,
+			     "lcd_panel_ini");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_panel_ini\n");
 		goto err_1;
 	}
-	gpio_direction_output(OMAP3EVM_LCD_PANEL_INI, 1);
 
-	r = gpio_request(OMAP3EVM_LCD_PANEL_QVGA, "lcd_panel_qvga");
+	r = gpio_request_one(OMAP3EVM_LCD_PANEL_QVGA, GPIOF_OUT_INIT_LOW,
+			     "lcd_panel_qvga");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_panel_qvga\n");
 		goto err_2;
 	}
-	gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA, 0);
 
-	r = gpio_request(OMAP3EVM_LCD_PANEL_LR, "lcd_panel_lr");
+	r = gpio_request_one(OMAP3EVM_LCD_PANEL_LR, GPIOF_OUT_INIT_HIGH,
+			     "lcd_panel_lr");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_panel_lr\n");
 		goto err_3;
 	}
-	gpio_direction_output(OMAP3EVM_LCD_PANEL_LR, 1);
 
-	r = gpio_request(OMAP3EVM_LCD_PANEL_UD, "lcd_panel_ud");
+	r = gpio_request_one(OMAP3EVM_LCD_PANEL_UD, GPIOF_OUT_INIT_HIGH,
+			     "lcd_panel_ud");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_panel_ud\n");
 		goto err_4;
 	}
-	gpio_direction_output(OMAP3EVM_LCD_PANEL_UD, 1);
 
-	r = gpio_request(OMAP3EVM_LCD_PANEL_ENVDD, "lcd_panel_envdd");
+	r = gpio_request_one(OMAP3EVM_LCD_PANEL_ENVDD, GPIOF_OUT_INIT_LOW,
+			     "lcd_panel_envdd");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_panel_envdd\n");
 		goto err_5;
 	}
-	gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD, 0);
 
 	return;
 
@@ -473,8 +472,7 @@ static int omap3evm_twl_gpio_setup(struc
 		printk(KERN_ERR "failed to get/set lcd_bkl gpio\n");
 
 	/* gpio + 7 == DVI Enable */
-	gpio_request(gpio + 7, "EN_DVI");
-	gpio_direction_output(gpio + 7, 0);
+	gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI");
 
 	/* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
 	gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -681,10 +679,9 @@ static int __init omap3_evm_i2c_init(voi
 
 static void ads7846_dev_init(void)
 {
-	if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0)
+	if (gpio_request_one(OMAP3_EVM_TS_GPIO, GPIOF_IN, "ADS7846 pendown") < 0)
 		printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
 
-	gpio_direction_input(OMAP3_EVM_TS_GPIO);
 	gpio_set_debounce(OMAP3_EVM_TS_GPIO, 310);
 }
 
@@ -852,14 +849,14 @@ static void __init omap3_evm_init(void)
 	if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
 		/* enable EHCI VBUS using GPIO22 */
 		omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP);
-		gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS");
-		gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0);
+		gpio_request_one(OMAP3_EVM_EHCI_VBUS, GPIOF_OUT_INIT_LOW,
+				 "enable EHCI VBUS");
 		gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1);
 
 		/* Select EHCI port on main board */
 		omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP);
-		gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port");
-		gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0);
+		gpio_request_one(OMAP3_EVM_EHCI_SELECT, GPIOF_OUT_INIT_LOW,
+				 "select EHCI port");
 		gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0);
 
 		/* setup EHCI phy reset config */
diff -u -p a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
--- a/arch/arm/mach-omap2/board-omap3pandora.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-omap3pandora.c 2011-03-20 21:01:54.000000000 +0100
@@ -575,14 +575,12 @@ static void __init omap3pandora_ads7846_
 	int gpio = OMAP3_PANDORA_TS_GPIO;
 	int ret;
 
-	ret = gpio_request(gpio, "ads7846_pen_down");
+	ret = gpio_request_one(gpio, GPIOF_IN, "ads7846_pen_down");
 	if (ret < 0) {
 		printk(KERN_ERR "Failed to request GPIO %d for "
 				"ads7846 pen down IRQ\n", gpio);
 		return;
 	}
-
-	gpio_direction_input(gpio);
 }
 
 static int ads7846_get_pendown_state(void)
diff -u -p a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
--- a/arch/arm/mach-omap2/board-omap3stalker.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-omap3stalker.c 2011-03-20 21:01:53.000000000 +0100
@@ -107,15 +107,14 @@ static inline void __init omap3stalker_i
 		rate = clk_get_rate(l3ck);
 
 	omap_mux_init_gpio(19, OMAP_PIN_INPUT_PULLUP);
-	if (gpio_request(OMAP3STALKER_ETHR_GPIO_IRQ, "SMC911x irq") < 0) {
+	if (gpio_request_one(OMAP3STALKER_ETHR_GPIO_IRQ, GPIOF_IN,
+			     "SMC911x irq") < 0) {
 		printk(KERN_ERR
 		       "Failed to request GPIO%d for smc911x IRQ\n",
 		       OMAP3STALKER_ETHR_GPIO_IRQ);
 		return;
 	}
 
-	gpio_direction_input(OMAP3STALKER_ETHR_GPIO_IRQ);
-
 	platform_device_register(&omap3stalker_smsc911x_device);
 }
 
@@ -365,12 +364,11 @@ omap3stalker_twl_gpio_setup(struct devic
 	 */
 
 	/* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */
-	gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL");
-	gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
+	gpio_request_one(gpio + TWL4030_GPIO_MAX, GPIOF_OUT_INIT_LOW,
+			 "EN_LCD_BKL");
 
 	/* gpio + 7 == DVI Enable */
-	gpio_request(gpio + 7, "EN_DVI");
-	gpio_direction_output(gpio + 7, 0);
+	gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI");
 
 	/* TWL4030_GPIO_MAX + 1 == ledB (out, mmc0) */
 	gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -534,10 +532,10 @@ static int __init omap3_stalker_i2c_init
 #define OMAP3_STALKER_TS_GPIO	175
 static void ads7846_dev_init(void)
 {
-	if (gpio_request(OMAP3_STALKER_TS_GPIO, "ADS7846 pendown") < 0)
+	if (gpio_request_one(OMAP3_STALKER_TS_GPIO, GPIOF_IN,
+			     "ADS7846 pendown") < 0)
 		printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
 
-	gpio_direction_input(OMAP3_STALKER_TS_GPIO);
 	gpio_set_debounce(OMAP3_STALKER_TS_GPIO, 310);
 }
 
diff -u -p a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
--- a/arch/arm/mach-omap2/board-omap3touchbook.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c 2011-03-20 21:01:51.000000000 +0100
@@ -155,12 +155,11 @@ static int touchbook_twl_gpio_setup(stru
 	 * power switch and overcurrent detect
 	 */
 
-	gpio_request(gpio + 1, "EHCI_nOC");
-	gpio_direction_input(gpio + 1);
+	gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC");
 
 	/* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */
-	gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR");
-	gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
+	gpio_request_one(gpio + TWL4030_GPIO_MAX, GPIOF_OUT_INIT_LOW,
+			 "nEN_USB_PWR");
 
 	/* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
 	gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -303,13 +302,12 @@ static int __init omap3_touchbook_i2c_in
 
 static void __init omap3_ads7846_init(void)
 {
-	if (gpio_request(OMAP3_TS_GPIO, "ads7846_pen_down")) {
+	if (gpio_request_one(OMAP3_TS_GPIO, GPIOF_IN, "ads7846_pen_down")) {
 		printk(KERN_ERR "Failed to request GPIO %d for "
 				"ads7846 pen down IRQ\n", OMAP3_TS_GPIO);
 		return;
 	}
 
-	gpio_direction_input(OMAP3_TS_GPIO);
 	gpio_set_debounce(OMAP3_TS_GPIO, 310);
 }
 
@@ -483,13 +481,12 @@ static void omap3_touchbook_poweroff(voi
 {
 	int r;
 
-	r = gpio_request(TB_KILL_POWER_GPIO, "DVI reset");
+	r = gpio_request_one(TB_KILL_POWER_GPIO, GPIOF_OUT_INIT_LOW,
+			     "DVI reset");
 	if (r < 0) {
 		printk(KERN_ERR "Unable to get kill power GPIO\n");
 		return;
 	}
-
-	gpio_direction_output(TB_KILL_POWER_GPIO, 0);
 }
 
 static int __init early_touchbook_revision(char *p)
diff -u -p a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c 2011-03-20 21:01:51.000000000 +0100
@@ -557,10 +557,8 @@ static __init void rx51_init_si4713(void
 static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
 {
 	/* FIXME this gpio setup is just a placeholder for now */
-	gpio_request(gpio + 6, "backlight_pwm");
-	gpio_direction_output(gpio + 6, 0);
-	gpio_request(gpio + 7, "speaker_en");
-	gpio_direction_output(gpio + 7, 1);
+	gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "backlight_pwm");
+	gpio_request_one(gpio + 7, GPIOF_OUT_INIT_HIGH, "speaker_en");
 
 	return 0;
 }
diff -u -p a/arch/arm/mach-omap2/board-rx51-video.c b/arch/arm/mach-omap2/board-rx51-video.c
--- a/arch/arm/mach-omap2/board-rx51-video.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-omap2/board-rx51-video.c 2011-03-20 21:01:53.000000000 +0100
@@ -76,13 +76,12 @@ static int __init rx51_video_init(void)
 		return 0;
 	}
 
-	if (gpio_request(RX51_LCD_RESET_GPIO, "LCD ACX565AKM reset")) {
+	if (gpio_request_one(RX51_LCD_RESET_GPIO, GPIOF_OUT_INIT_HIGH,
+			     "LCD ACX565AKM reset")) {
 		pr_err("%s failed to get LCD Reset GPIO\n", __func__);
 		return 0;
 	}
 
-	gpio_direction_output(RX51_LCD_RESET_GPIO, 1);
-
 	omap_display_init(&rx51_dss_board_info);
 	return 0;
 }
diff -u -p a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c
--- a/arch/arm/mach-omap2/board-zoom-debugboard.c 2010-10-14 18:30:03.000000000 +0200
+++ b/arch/arm/mach-omap2/board-zoom-debugboard.c 2011-03-20 21:01:52.000000000 +0100
@@ -74,12 +74,11 @@ static inline void __init zoom_init_smsc
 
 	zoom_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
 
-	if (gpio_request(eth_gpio, "smsc911x irq") < 0) {
+	if (gpio_request_one(eth_gpio, GPIOF_IN, "smsc911x irq") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
 				eth_gpio);
 		return;
 	}
-	gpio_direction_input(eth_gpio);
 }
 
 static struct plat_serial8250_port serial_platform_data[] = {
@@ -120,12 +119,11 @@ static inline void __init zoom_init_quad
 
 	quart_gpio = ZOOM_QUADUART_GPIO;
 
-	if (gpio_request(quart_gpio, "TL16CP754C GPIO") < 0) {
+	if (gpio_request_one(quart_gpio, GPIOF_IN, "TL16CP754C GPIO") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n",
 								quart_gpio);
 		return;
 	}
-	gpio_direction_input(quart_gpio);
 }
 
 static inline int omap_zoom_debugboard_detect(void)
@@ -135,12 +133,12 @@ static inline int omap_zoom_debugboard_d
 
 	debug_board_detect = ZOOM_SMSC911X_GPIO;
 
-	if (gpio_request(debug_board_detect, "Zoom debug board detect") < 0) {
+	if (gpio_request_one(debug_board_detect, GPIOF_IN,
+			     "Zoom debug board detect") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for Zoom debug"
 		"board detect\n", debug_board_detect);
 		return 0;
 	}
-	gpio_direction_input(debug_board_detect);
 
 	if (!gpio_get_value(debug_board_detect)) {
 		ret = 0;
diff -u -p a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c
--- a/arch/arm/mach-omap2/board-zoom-display.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-omap2/board-zoom-display.c 2011-03-20 21:01:54.000000000 +0100
@@ -30,21 +30,21 @@ static void zoom_lcd_panel_init(void)
 			LCD_PANEL_RESET_GPIO_PROD :
 			LCD_PANEL_RESET_GPIO_PILOT;
 
-	ret = gpio_request(lcd_panel_reset_gpio, "lcd reset");
+	ret = gpio_request_one(lcd_panel_reset_gpio, GPIOF_OUT_INIT_HIGH,
+			       "lcd reset");
 	if (ret) {
 		pr_err("Failed to get LCD reset GPIO (gpio%d).\n",
 			lcd_panel_reset_gpio);
 		return;
 	}
-	gpio_direction_output(lcd_panel_reset_gpio, 1);
 
-	ret = gpio_request(LCD_PANEL_QVGA_GPIO, "lcd qvga");
+	ret = gpio_request_one(LCD_PANEL_QVGA_GPIO, GPIOF_OUT_INIT_HIGH,
+			       "lcd qvga");
 	if (ret) {
 		pr_err("Failed to get LCD_PANEL_QVGA_GPIO (gpio%d).\n",
 			LCD_PANEL_QVGA_GPIO);
 		goto err0;
 	}
-	gpio_direction_output(LCD_PANEL_QVGA_GPIO, 1);
 
 	return;
 err0:
diff -u -p a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c 2011-03-20 21:01:55.000000000 +0100
@@ -276,13 +276,13 @@ static int zoom_twl_gpio_setup(struct de
 	zoom_vsim_supply.dev = mmc[0].dev;
 	zoom_vmmc2_supply.dev = mmc[1].dev;
 
-	ret = gpio_request(LCD_PANEL_ENABLE_GPIO, "lcd enable");
+	ret = gpio_request_one(LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW,
+			       "lcd enable");
 	if (ret) {
 		pr_err("Failed to get LCD_PANEL_ENABLE_GPIO (gpio%d).\n",
 				LCD_PANEL_ENABLE_GPIO);
 		return ret;
 	}
-	gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 0);
 
 	return ret;
 }
diff -u -p a/arch/arm/mach-omap2/gpmc-smc91x.c b/arch/arm/mach-omap2/gpmc-smc91x.c
--- a/arch/arm/mach-omap2/gpmc-smc91x.c 2009-12-12 00:23:19.000000000 +0100
+++ b/arch/arm/mach-omap2/gpmc-smc91x.c 2011-03-20 21:01:51.000000000 +0100
@@ -147,25 +147,24 @@ void __init gpmc_smc91x_init(struct omap
 			goto free1;
 	}
 
-	if (gpio_request(gpmc_cfg->gpio_irq, "SMC91X irq") < 0)
+	if (gpio_request_one(gpmc_cfg->gpio_irq, GPIOF_IN, "SMC91X irq") < 0)
 		goto free1;
 
-	gpio_direction_input(gpmc_cfg->gpio_irq);
 	gpmc_smc91x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq);
 
 	if (gpmc_cfg->gpio_pwrdwn) {
-		ret = gpio_request(gpmc_cfg->gpio_pwrdwn, "SMC91X powerdown");
+		ret = gpio_request_one(gpmc_cfg->gpio_pwrdwn,
+				       GPIOF_OUT_INIT_LOW, "SMC91X powerdown");
 		if (ret)
 			goto free2;
-		gpio_direction_output(gpmc_cfg->gpio_pwrdwn, 0);
 	}
 
 	if (gpmc_cfg->gpio_reset) {
-		ret = gpio_request(gpmc_cfg->gpio_reset, "SMC91X reset");
+		ret = gpio_request_one(gpmc_cfg->gpio_reset,
+				       GPIOF_OUT_INIT_LOW, "SMC91X reset");
 		if (ret)
 			goto free3;
 
-		gpio_direction_output(gpmc_cfg->gpio_reset, 0);
 		gpio_set_value(gpmc_cfg->gpio_reset, 1);
 		msleep(100);
 		gpio_set_value(gpmc_cfg->gpio_reset, 0);
diff -u -p a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c
--- a/arch/arm/mach-omap2/gpmc-smsc911x.c 2010-09-30 17:54:14.000000000 +0200
+++ b/arch/arm/mach-omap2/gpmc-smsc911x.c 2011-03-20 21:01:54.000000000 +0100
@@ -71,26 +71,25 @@ void __init gpmc_smsc911x_init(struct om
 	gpmc_smsc911x_resources[0].start = cs_mem_base + 0x0;
 	gpmc_smsc911x_resources[0].end = cs_mem_base + 0xff;
 
-	if (gpio_request(gpmc_cfg->gpio_irq, "smsc911x irq") < 0) {
+	if (gpio_request_one(gpmc_cfg->gpio_irq, GPIOF_IN, "smsc911x irq") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
 				gpmc_cfg->gpio_irq);
 		goto free1;
 	}
 
-	gpio_direction_input(gpmc_cfg->gpio_irq);
 	gpmc_smsc911x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq);
 	gpmc_smsc911x_resources[1].flags |=
 					(gpmc_cfg->flags & IRQF_TRIGGER_MASK);
 
 	if (gpio_is_valid(gpmc_cfg->gpio_reset)) {
-		ret = gpio_request(gpmc_cfg->gpio_reset, "smsc911x reset");
+		ret = gpio_request_one(gpmc_cfg->gpio_reset,
+				       GPIOF_OUT_INIT_HIGH, "smsc911x reset");
 		if (ret) {
 			printk(KERN_ERR "Failed to request GPIO%d for smsc911x reset\n",
 					gpmc_cfg->gpio_reset);
 			goto free2;
 		}
 
-		gpio_direction_output(gpmc_cfg->gpio_reset, 1);
 		gpio_set_value(gpmc_cfg->gpio_reset, 0);
 		msleep(100);
 		gpio_set_value(gpmc_cfg->gpio_reset, 1);
diff -u -p a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
--- a/arch/arm/mach-omap2/usb-tusb6010.c 2010-12-28 18:26:02.000000000 +0100
+++ b/arch/arm/mach-omap2/usb-tusb6010.c 2011-03-20 21:01:54.000000000 +0100
@@ -293,12 +293,11 @@ tusb6010_setup_interface(struct musb_hdr
 			);
 
 	/* IRQ */
-	status = gpio_request(irq, "TUSB6010 irq");
+	status = gpio_request_one(irq, GPIOF_IN, "TUSB6010 irq");
 	if (status < 0) {
 		printk(error, 3, status);
 		return status;
 	}
-	gpio_direction_input(irq);
 	tusb_resources[2].start = irq + IH_GPIO_BASE;
 
 	/* set up memory timings ... can speed them up later */
diff -u -p a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
--- a/arch/arm/mach-orion5x/dns323-setup.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-orion5x/dns323-setup.c 2011-03-20 21:01:52.000000000 +0100
@@ -642,8 +642,8 @@ static void __init dns323_init(void)
 		 * DNS323_GPIO_LED_POWER1 to also be low.
 		 */
 		 dns323ab_leds[0].active_low = 1;
-		 gpio_request(DNS323_GPIO_LED_POWER1, "Power Led Enable");
-		 gpio_direction_output(DNS323_GPIO_LED_POWER1, 0);
+		 gpio_request_one(DNS323_GPIO_LED_POWER1, GPIOF_OUT_INIT_LOW,
+				  "Power Led Enable");
 		/* Fall through */
 	case DNS323_REV_B1:
 		i2c_register_board_info(0, dns323ab_i2c_devices,
diff -u -p a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
--- a/arch/arm/mach-pxa/cm-x270.c 2010-12-31 15:18:30.000000000 +0100
+++ b/arch/arm/mach-pxa/cm-x270.c 2011-03-20 21:01:53.000000000 +0100
@@ -208,10 +208,9 @@ static int cmx270_marathon_probe(struct 
 	int gpio, err;
 
 	for (gpio = 58; gpio <= 77; gpio++) {
-		err = gpio_request(gpio, "LCD");
+		err = gpio_request_one(gpio, GPIOF_IN, "LCD");
 		if (err)
 			return err;
-		gpio_direction_input(gpio);
 	}
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_marathon_on));
diff -u -p a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
--- a/arch/arm/mach-pxa/cm-x300.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/cm-x300.c 2011-03-20 21:01:51.000000000 +0100
@@ -484,14 +484,14 @@ static int cm_x300_ulpi_phy_reset(void)
 	int err;
 
 	/* reset the PHY */
-	err = gpio_request(GPIO_ULPI_PHY_RST, "ulpi reset");
+	err = gpio_request_one(GPIO_ULPI_PHY_RST, GPIOF_OUT_INIT_LOW,
+			       "ulpi reset");
 	if (err) {
 		pr_err("%s: failed to request ULPI reset GPIO: %d\n",
 		       __func__, err);
 		return err;
 	}
 
-	gpio_direction_output(GPIO_ULPI_PHY_RST, 0);
 	msleep(10);
 	gpio_set_value(GPIO_ULPI_PHY_RST, 1);
 	msleep(10);
diff -u -p a/arch/arm/mach-pxa/colibri-pxa3xx.c b/arch/arm/mach-pxa/colibri-pxa3xx.c
--- a/arch/arm/mach-pxa/colibri-pxa3xx.c 2010-12-28 18:26:02.000000000 +0100
+++ b/arch/arm/mach-pxa/colibri-pxa3xx.c 2011-03-20 21:01:51.000000000 +0100
@@ -103,8 +103,7 @@ static struct pxafb_mach_info sharp_lq43
 void __init colibri_pxa3xx_init_lcd(int bl_pin)
 {
 	lcd_bl_pin = bl_pin;
-	gpio_request(bl_pin, "lcd backlight");
-	gpio_direction_output(bl_pin, 0);
+	gpio_request_one(bl_pin, GPIOF_OUT_INIT_LOW, "lcd backlight");
 	set_pxa_fb_info(&sharp_lq43_info);
 }
 #endif
diff -u -p a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
--- a/arch/arm/mach-pxa/em-x270.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/em-x270.c 2011-03-20 21:01:53.000000000 +0100
@@ -379,23 +379,19 @@ static void __init em_x270_init_nand(voi
 {
 	int err;
 
-	err = gpio_request(GPIO11_NAND_CS, "NAND CS");
+	err = gpio_request_one(GPIO11_NAND_CS, GPIOF_OUT_INIT_HIGH, "NAND CS");
 	if (err) {
 		pr_warning("EM-X270: failed to request NAND CS gpio\n");
 		return;
 	}
 
-	gpio_direction_output(GPIO11_NAND_CS, 1);
-
-	err = gpio_request(nand_rb, "NAND R/B");
+	err = gpio_request_one(nand_rb, GPIOF_IN, "NAND R/B");
 	if (err) {
 		pr_warning("EM-X270: failed to request NAND R/B gpio\n");
 		gpio_free(GPIO11_NAND_CS);
 		return;
 	}
 
-	gpio_direction_input(nand_rb);
-
 	platform_device_register(&em_x270_nand);
 }
 #else
@@ -469,17 +465,16 @@ static int em_x270_usb_hub_init(void)
 	if (IS_ERR(em_x270_usb_ldo))
 		return PTR_ERR(em_x270_usb_ldo);
 
-	err = gpio_request(GPIO9_USB_VBUS_EN, "vbus en");
+	err = gpio_request_one(GPIO9_USB_VBUS_EN, GPIOF_OUT_INIT_LOW,
+			       "vbus en");
 	if (err)
 		goto err_free_usb_ldo;
 
-	err = gpio_request(usb_hub_reset, "hub rst");
+	err = gpio_request_one(usb_hub_reset, GPIOF_OUT_INIT_HIGH, "hub rst");
 	if (err)
 		goto err_free_vbus_gpio;
 
 	/* USB Hub power-on and reset */
-	gpio_direction_output(usb_hub_reset, 1);
-	gpio_direction_output(GPIO9_USB_VBUS_EN, 0);
 	regulator_enable(em_x270_usb_ldo);
 	gpio_set_value(usb_hub_reset, 0);
 	gpio_set_value(usb_hub_reset, 1);
@@ -568,21 +563,20 @@ static int em_x270_mci_init(struct devic
 	}
 
 	if (machine_is_em_x270()) {
-		err = gpio_request(GPIO95_MMC_WP, "MMC WP");
+		err = gpio_request_one(GPIO95_MMC_WP, GPIOF_IN, "MMC WP");
 		if (err) {
 			dev_err(dev, "can't request MMC write protect: %d\n",
 				err);
 			goto err_gpio_wp;
 		}
-		gpio_direction_input(GPIO95_MMC_WP);
 	} else {
-		err = gpio_request(GPIO38_SD_PWEN, "sdio power");
+		err = gpio_request_one(GPIO38_SD_PWEN, GPIOF_OUT_INIT_HIGH,
+				       "sdio power");
 		if (err) {
 			dev_err(dev, "can't request MMC power control : %d\n",
 				err);
 			goto err_gpio_wp;
 		}
-		gpio_direction_output(GPIO38_SD_PWEN, 1);
 	}
 
 	return 0;
@@ -732,29 +726,29 @@ static unsigned long em_x270_libertas_pi
 
 static int em_x270_libertas_setup(struct spi_device *spi)
 {
-	int err = gpio_request(GPIO115_WLAN_PWEN, "WLAN PWEN");
+	int err = gpio_request_one(GPIO115_WLAN_PWEN, GPIOF_OUT_INIT_LOW,
+				   "WLAN PWEN");
 	if (err)
 		return err;
 
-	err = gpio_request(GPIO19_WLAN_STRAP, "WLAN STRAP");
+	err = gpio_request_one(GPIO19_WLAN_STRAP, GPIOF_OUT_INIT_HIGH,
+			       "WLAN STRAP");
 	if (err)
 		goto err_free_pwen;
 
 	if (machine_is_exeda()) {
-		err = gpio_request(GPIO37_WLAN_RST, "WLAN RST");
+		err = gpio_request_one(GPIO37_WLAN_RST, GPIOF_OUT_INIT_HIGH,
+				       "WLAN RST");
 		if (err)
 			goto err_free_strap;
 
-		gpio_direction_output(GPIO37_WLAN_RST, 1);
 		msleep(100);
 	}
 
-	gpio_direction_output(GPIO19_WLAN_STRAP, 1);
 	msleep(100);
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_libertas_pin_config));
 
-	gpio_direction_output(GPIO115_WLAN_PWEN, 0);
 	msleep(100);
 	gpio_set_value(GPIO115_WLAN_PWEN, 1);
 	msleep(100);
@@ -951,12 +945,10 @@ static int em_x270_sensor_init(void)
 {
 	int ret;
 
-	ret = gpio_request(cam_reset, "camera reset");
+	ret = gpio_request_one(cam_reset, GPIOF_OUT_INIT_LOW, "camera reset");
 	if (ret)
 		return ret;
 
-	gpio_direction_output(cam_reset, 0);
-
 	em_x270_camera_ldo = regulator_get(NULL, "vcc cam");
 	if (em_x270_camera_ldo == NULL) {
 		gpio_free(cam_reset);
diff -u -p a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
--- a/arch/arm/mach-pxa/eseries.c 2010-12-28 18:26:02.000000000 +0100
+++ b/arch/arm/mach-pxa/eseries.c 2011-03-20 21:01:51.000000000 +0100
@@ -97,10 +97,8 @@ int eseries_tmio_resume(struct platform_
 
 void eseries_get_tmio_gpios(void)
 {
-	gpio_request(GPIO_ESERIES_TMIO_SUSPEND, NULL);
-	gpio_request(GPIO_ESERIES_TMIO_PCLR, NULL);
-	gpio_direction_output(GPIO_ESERIES_TMIO_SUSPEND, 0);
-	gpio_direction_output(GPIO_ESERIES_TMIO_PCLR, 0);
+	gpio_request_one(GPIO_ESERIES_TMIO_SUSPEND, GPIOF_OUT_INIT_LOW, NULL);
+	gpio_request_one(GPIO_ESERIES_TMIO_PCLR, GPIOF_OUT_INIT_LOW, NULL);
 }
 
 /* TMIO controller uses the same resources on all e-series machines. */
diff -u -p a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c
--- a/arch/arm/mach-pxa/ezx.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/ezx.c 2011-03-20 21:01:52.000000000 +0100
@@ -702,21 +702,19 @@ static int a780_camera_init(void)
 	 * GPIO50_nCAM_EN is active low
 	 * GPIO19_GEN1_CAM_RST is active on rising edge
 	 */
-	err = gpio_request(GPIO50_nCAM_EN, "nCAM_EN");
+	err = gpio_request_one(GPIO50_nCAM_EN, GPIOF_OUT_INIT_HIGH, "nCAM_EN");
 	if (err) {
 		pr_err("%s: Failed to request nCAM_EN\n", __func__);
 		goto fail;
 	}
 
-	err = gpio_request(GPIO19_GEN1_CAM_RST, "CAM_RST");
+	err = gpio_request_one(GPIO19_GEN1_CAM_RST, GPIOF_OUT_INIT_LOW,
+			       "CAM_RST");
 	if (err) {
 		pr_err("%s: Failed to request CAM_RST\n", __func__);
 		goto fail_gpio_cam_rst;
 	}
 
-	gpio_direction_output(GPIO50_nCAM_EN, 1);
-	gpio_direction_output(GPIO19_GEN1_CAM_RST, 0);
-
 	return 0;
 
 fail_gpio_cam_rst:
@@ -971,21 +969,19 @@ static int a910_camera_init(void)
 	 * GPIO50_nCAM_EN is active low
 	 * GPIO28_GEN2_CAM_RST is active on rising edge
 	 */
-	err = gpio_request(GPIO50_nCAM_EN, "nCAM_EN");
+	err = gpio_request_one(GPIO50_nCAM_EN, GPIOF_OUT_INIT_HIGH, "nCAM_EN");
 	if (err) {
 		pr_err("%s: Failed to request nCAM_EN\n", __func__);
 		goto fail;
 	}
 
-	err = gpio_request(GPIO28_GEN2_CAM_RST, "CAM_RST");
+	err = gpio_request_one(GPIO28_GEN2_CAM_RST, GPIOF_OUT_INIT_LOW,
+			       "CAM_RST");
 	if (err) {
 		pr_err("%s: Failed to request CAM_RST\n", __func__);
 		goto fail_gpio_cam_rst;
 	}
 
-	gpio_direction_output(GPIO50_nCAM_EN, 1);
-	gpio_direction_output(GPIO28_GEN2_CAM_RST, 0);
-
 	return 0;
 
 fail_gpio_cam_rst:
diff -u -p a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
--- a/arch/arm/mach-pxa/magician.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/magician.c 2011-03-20 21:01:53.000000000 +0100
@@ -748,15 +748,15 @@ static void __init magician_init(void)
 		lcd_select = board_id & 0x8;
 		pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly");
 		if (lcd_select && (system_rev < 3)) {
-			gpio_request(GPIO75_MAGICIAN_SAMSUNG_POWER, "SAMSUNG_POWER");
-			gpio_direction_output(GPIO75_MAGICIAN_SAMSUNG_POWER, 0);
+			gpio_request_one(GPIO75_MAGICIAN_SAMSUNG_POWER,
+					 GPIOF_OUT_INIT_LOW, "SAMSUNG_POWER");
 		}
-		gpio_request(GPIO104_MAGICIAN_LCD_POWER_1, "LCD_POWER_1");
-		gpio_request(GPIO105_MAGICIAN_LCD_POWER_2, "LCD_POWER_2");
-		gpio_request(GPIO106_MAGICIAN_LCD_POWER_3, "LCD_POWER_3");
-		gpio_direction_output(GPIO104_MAGICIAN_LCD_POWER_1, 0);
-		gpio_direction_output(GPIO105_MAGICIAN_LCD_POWER_2, 0);
-		gpio_direction_output(GPIO106_MAGICIAN_LCD_POWER_3, 0);
+		gpio_request_one(GPIO104_MAGICIAN_LCD_POWER_1,
+				 GPIOF_OUT_INIT_LOW, "LCD_POWER_1");
+		gpio_request_one(GPIO105_MAGICIAN_LCD_POWER_2,
+				 GPIOF_OUT_INIT_LOW, "LCD_POWER_2");
+		gpio_request_one(GPIO106_MAGICIAN_LCD_POWER_3,
+				 GPIOF_OUT_INIT_LOW, "LCD_POWER_3");
 		set_pxa_fb_info(lcd_select ? &samsung_info : &toppoly_info);
 	} else
 		pr_err("LCD detection: CPLD mapping failed\n");
diff -u -p a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
--- a/arch/arm/mach-pxa/poodle.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/poodle.c 2011-03-20 21:01:50.000000000 +0100
@@ -234,17 +234,16 @@ static int poodle_mci_init(struct device
 {
 	int err;
 
-	err = gpio_request(POODLE_GPIO_SD_PWR, "SD_PWR");
+	err = gpio_request_one(POODLE_GPIO_SD_PWR, GPIOF_OUT_INIT_LOW,
+			       "SD_PWR");
 	if (err)
 		goto err_free_2;
 
-	err = gpio_request(POODLE_GPIO_SD_PWR1, "SD_PWR1");
+	err = gpio_request_one(POODLE_GPIO_SD_PWR1, GPIOF_OUT_INIT_LOW,
+			       "SD_PWR1");
 	if (err)
 		goto err_free_3;
 
-	gpio_direction_output(POODLE_GPIO_SD_PWR, 0);
-	gpio_direction_output(POODLE_GPIO_SD_PWR1, 0);
-
 	return 0;
 
 err_free_3:
diff -u -p a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c
--- a/arch/arm/mach-pxa/saar.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/saar.c 2011-03-20 21:01:52.000000000 +0100
@@ -413,13 +413,13 @@ static void ltm022a97a_lcd_power(int on,
 	int err;
 
 	if (!pin_requested) {
-		err = gpio_request(GPIO_LCD_RESET, "lcd reset");
+		err = gpio_request_one(GPIO_LCD_RESET, GPIOF_OUT_INIT_LOW,
+				       "lcd reset");
 		if (err) {
 			pr_err("failed to request gpio for LCD reset\n");
 			return;
 		}
 
-		gpio_direction_output(GPIO_LCD_RESET, 0);
 		pin_requested = 1;
 	}
 
diff -u -p a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
--- a/arch/arm/mach-pxa/sharpsl_pm.c 2010-12-28 18:26:03.000000000 +0100
+++ b/arch/arm/mach-pxa/sharpsl_pm.c 2011-03-20 21:01:50.000000000 +0100
@@ -899,12 +899,13 @@ static int __devinit sharpsl_pm_probe(st
 
 	sharpsl_pm.machinfo->init();
 
-	gpio_request(sharpsl_pm.machinfo->gpio_acin, "AC IN");
-	gpio_direction_input(sharpsl_pm.machinfo->gpio_acin);
-	gpio_request(sharpsl_pm.machinfo->gpio_batfull, "Battery Full");
-	gpio_direction_input(sharpsl_pm.machinfo->gpio_batfull);
-	gpio_request(sharpsl_pm.machinfo->gpio_batlock, "Battery Lock");
-	gpio_direction_input(sharpsl_pm.machinfo->gpio_batlock);
+	gpio_request_one(sharpsl_pm.machinfo->gpio_acin, GPIOF_IN, "AC IN");
+	
+	gpio_request_one(sharpsl_pm.machinfo->gpio_batfull, GPIOF_IN,
+			 "Battery Full");
+	
+	gpio_request_one(sharpsl_pm.machinfo->gpio_batlock, GPIOF_IN,
+			 "Battery Lock");
 
 	/* Register interrupt handlers */
 	if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "AC Input Detect", sharpsl_ac_isr)) {
diff -u -p a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c
--- a/arch/arm/mach-pxa/stargate2.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/stargate2.c 2011-03-20 21:01:53.000000000 +0100
@@ -693,19 +693,18 @@ static int stargate2_mci_init(struct dev
 {
 	int err;
 
-	err = gpio_request(SG2_SD_POWER_ENABLE, "SG2_sd_power_enable");
+	err = gpio_request_one(SG2_SD_POWER_ENABLE, GPIOF_OUT_INIT_LOW,
+			       "SG2_sd_power_enable");
 	if (err) {
 		printk(KERN_ERR "Can't get the gpio for SD power control");
 		goto return_err;
 	}
-	gpio_direction_output(SG2_SD_POWER_ENABLE, 0);
 
-	err = gpio_request(SG2_GPIO_nSD_DETECT, "SG2_sd_detect");
+	err = gpio_request_one(SG2_GPIO_nSD_DETECT, GPIOF_IN, "SG2_sd_detect");
 	if (err) {
 		printk(KERN_ERR "Can't get the sd detect gpio");
 		goto free_power_en;
 	}
-	gpio_direction_input(SG2_GPIO_nSD_DETECT);
 
 	err = request_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT),
 			  stargate2_detect_int,
@@ -799,12 +798,12 @@ static struct at24_platform_data pca9500
 static int stargate2_reset_bluetooth(void)
 {
 	int err;
-	err = gpio_request(SG2_BT_RESET, "SG2_BT_RESET");
+	err = gpio_request_one(SG2_BT_RESET, GPIOF_OUT_INIT_HIGH,
+			       "SG2_BT_RESET");
 	if (err) {
 		printk(KERN_ERR "Could not get gpio for bluetooth reset\n");
 		return err;
 	}
-	gpio_direction_output(SG2_BT_RESET, 1);
 	mdelay(5);
 	/* now reset it - 5 msec minimum */
 	gpio_set_value(SG2_BT_RESET, 0);
diff -u -p a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c
--- a/arch/arm/mach-pxa/zylonite_pxa300.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/zylonite_pxa300.c 2011-03-20 21:01:50.000000000 +0100
@@ -197,8 +197,7 @@ static void __init zylonite_detect_lcd_p
 	for (i = 0; i < NUM_LCD_DETECT_PINS; i++) {
 		id = id << 1;
 		gpio = mfp_to_gpio(lcd_detect_pins[i]);
-		gpio_request(gpio, "LCD_ID_PINS");
-		gpio_direction_input(gpio);
+		gpio_request_one(gpio, GPIOF_IN, "LCD_ID_PINS");
 
 		if (gpio_get_value(gpio))
 			id = id | 0x1;
diff -u -p a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c
--- a/arch/arm/mach-pxa/zylonite_pxa320.c 2010-01-12 18:05:01.000000000 +0100
+++ b/arch/arm/mach-pxa/zylonite_pxa320.c 2011-03-20 21:01:50.000000000 +0100
@@ -176,8 +176,7 @@ static void __init zylonite_detect_lcd_p
 	for (i = 0; i < NUM_LCD_DETECT_PINS; i++) {
 		id = id << 1;
 		gpio = mfp_to_gpio(lcd_detect_pins[i]);
-		gpio_request(gpio, "LCD_ID_PINS");
-		gpio_direction_input(gpio);
+		gpio_request_one(gpio, GPIOF_IN, "LCD_ID_PINS");
 
 		if (gpio_get_value(gpio))
 			id = id | 0x1;
diff -u -p a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
--- a/arch/arm/mach-s3c2410/mach-h1940.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-s3c2410/mach-h1940.c 2011-03-20 21:01:53.000000000 +0100
@@ -305,10 +305,10 @@ int h1940_bat_init(void)
 {
 	int ret;
 
-	ret = gpio_request(H1940_LATCH_SM803_ENABLE, "h1940-charger-enable");
+	ret = gpio_request_one(H1940_LATCH_SM803_ENABLE, GPIOF_OUT_INIT_LOW,
+			       "h1940-charger-enable");
 	if (ret)
 		return ret;
-	gpio_direction_output(H1940_LATCH_SM803_ENABLE, 0);
 
 	return 0;
 
@@ -473,9 +473,8 @@ static struct s3c24xx_mci_pdata h1940_mm
 
 static int h1940_backlight_init(struct device *dev)
 {
-	gpio_request(S3C2410_GPB(0), "Backlight");
+	gpio_request_one(S3C2410_GPB(0), GPIOF_OUT_INIT_LOW, "Backlight");
 
-	gpio_direction_output(S3C2410_GPB(0), 0);
 	s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
 	s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
 	gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
@@ -700,42 +699,29 @@ static void __init h1940_init(void)
 	      | (0x03 << S3C24XX_PLLCON_SDIVSHIFT);
 	writel(tmp, S3C2410_UPLLCON);
 
-	gpio_request(S3C2410_GPC(0), "LCD power");
-	gpio_request(S3C2410_GPC(1), "LCD power");
-	gpio_request(S3C2410_GPC(4), "LCD power");
-	gpio_request(S3C2410_GPC(5), "LCD power");
-	gpio_request(S3C2410_GPC(6), "LCD power");
-	gpio_request(H1940_LATCH_LCD_P0, "LCD power");
-	gpio_request(H1940_LATCH_LCD_P1, "LCD power");
-	gpio_request(H1940_LATCH_LCD_P2, "LCD power");
-	gpio_request(H1940_LATCH_LCD_P3, "LCD power");
-	gpio_request(H1940_LATCH_LCD_P4, "LCD power");
-	gpio_request(H1940_LATCH_MAX1698_nSHUTDOWN, "LCD power");
-	gpio_direction_output(S3C2410_GPC(0), 0);
-	gpio_direction_output(S3C2410_GPC(1), 0);
-	gpio_direction_output(S3C2410_GPC(4), 0);
-	gpio_direction_output(S3C2410_GPC(5), 0);
-	gpio_direction_input(S3C2410_GPC(6));
-	gpio_direction_output(H1940_LATCH_LCD_P0, 0);
-	gpio_direction_output(H1940_LATCH_LCD_P1, 0);
-	gpio_direction_output(H1940_LATCH_LCD_P2, 0);
-	gpio_direction_output(H1940_LATCH_LCD_P3, 0);
-	gpio_direction_output(H1940_LATCH_LCD_P4, 0);
-	gpio_direction_output(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
+	gpio_request_one(S3C2410_GPC(0), GPIOF_OUT_INIT_LOW, "LCD power");
+	gpio_request_one(S3C2410_GPC(1), GPIOF_OUT_INIT_LOW, "LCD power");
+	gpio_request_one(S3C2410_GPC(4), GPIOF_OUT_INIT_LOW, "LCD power");
+	gpio_request_one(S3C2410_GPC(5), GPIOF_OUT_INIT_LOW, "LCD power");
+	gpio_request_one(S3C2410_GPC(6), GPIOF_IN, "LCD power");
+	gpio_request_one(H1940_LATCH_LCD_P0, GPIOF_OUT_INIT_LOW, "LCD power");
+	gpio_request_one(H1940_LATCH_LCD_P1, GPIOF_OUT_INIT_LOW, "LCD power");
+	gpio_request_one(H1940_LATCH_LCD_P2, GPIOF_OUT_INIT_LOW, "LCD power");
+	gpio_request_one(H1940_LATCH_LCD_P3, GPIOF_OUT_INIT_LOW, "LCD power");
+	gpio_request_one(H1940_LATCH_LCD_P4, GPIOF_OUT_INIT_LOW, "LCD power");
+	gpio_request_one(H1940_LATCH_MAX1698_nSHUTDOWN, GPIOF_OUT_INIT_LOW,
+			 "LCD power");
 
-	gpio_request(H1940_LATCH_SD_POWER, "SD power");
-	gpio_direction_output(H1940_LATCH_SD_POWER, 0);
+	gpio_request_one(H1940_LATCH_SD_POWER, GPIOF_OUT_INIT_LOW, "SD power");
 
 	platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
 
-	gpio_request(S3C2410_GPA(1), "Red LED blink");
-	gpio_request(S3C2410_GPA(3), "Blue LED blink");
-	gpio_request(S3C2410_GPA(7), "Green LED blink");
-	gpio_request(H1940_LATCH_LED_FLASH, "LED blink");
-	gpio_direction_output(S3C2410_GPA(1), 0);
-	gpio_direction_output(S3C2410_GPA(3), 0);
-	gpio_direction_output(S3C2410_GPA(7), 0);
-	gpio_direction_output(H1940_LATCH_LED_FLASH, 0);
+	gpio_request_one(S3C2410_GPA(1), GPIOF_OUT_INIT_LOW, "Red LED blink");
+	gpio_request_one(S3C2410_GPA(3), GPIOF_OUT_INIT_LOW, "Blue LED blink");
+	gpio_request_one(S3C2410_GPA(7), GPIOF_OUT_INIT_LOW,
+			 "Green LED blink");
+	gpio_request_one(H1940_LATCH_LED_FLASH, GPIOF_OUT_INIT_LOW,
+			 "LED blink");
 
 	i2c_register_board_info(0, h1940_i2c_devices,
 		ARRAY_SIZE(h1940_i2c_devices));
diff -u -p a/arch/arm/mach-s3c2410/mach-qt2410.c b/arch/arm/mach-s3c2410/mach-qt2410.c
--- a/arch/arm/mach-s3c2410/mach-qt2410.c 2010-10-23 19:40:31.000000000 +0200
+++ b/arch/arm/mach-s3c2410/mach-qt2410.c 2011-03-20 21:01:52.000000000 +0100
@@ -354,8 +354,8 @@ static void __init qt2410_machine_init(v
 	s3c24xx_udc_set_platdata(&qt2410_udc_cfg);
 	s3c_i2c0_set_platdata(NULL);
 
-	WARN_ON(gpio_request(S3C2410_GPB(5), "spi cs"));
-	gpio_direction_output(S3C2410_GPB(5), 1);
+	WARN_ON(gpio_request_one(S3C2410_GPB(5), GPIOF_OUT_INIT_HIGH,
+				 "spi cs"));
 
 	platform_add_devices(qt2410_devices, ARRAY_SIZE(qt2410_devices));
 	s3c_pm_init();
diff -u -p a/arch/arm/mach-s3c2410/usb-simtec.c b/arch/arm/mach-s3c2410/usb-simtec.c
--- a/arch/arm/mach-s3c2410/usb-simtec.c 2010-01-20 13:04:05.000000000 +0100
+++ b/arch/arm/mach-s3c2410/usb-simtec.c 2011-03-20 21:01:53.000000000 +0100
@@ -110,23 +110,20 @@ int usb_simtec_init(void)
 
 	printk("USB Power Control, Copyright 2004 Simtec Electronics\n");
 
-	ret = gpio_request(S3C2410_GPB(4), "USB power control");
+	ret = gpio_request_one(S3C2410_GPB(4), GPIOF_OUT_INIT_HIGH,
+			       "USB power control");
 	if (ret < 0) {
 		pr_err("%s: failed to get GPB4\n", __func__);
 		return ret;
 	}
 
-	ret = gpio_request(S3C2410_GPG(10), "USB overcurrent");
+	ret = gpio_request_one(S3C2410_GPG(10), GPIOF_IN, "USB overcurrent");
 	if (ret < 0) {
 		pr_err("%s: failed to get GPG10\n", __func__);
 		gpio_free(S3C2410_GPB(4));
 		return ret;
 	}
 
-	/* turn power on */
-	gpio_direction_output(S3C2410_GPB(4), 1);
-	gpio_direction_input(S3C2410_GPG(10));
-
 	s3c_ohci_set_platdata(&usb_simtec_info);
 	return 0;
 }
diff -u -p a/arch/arm/mach-s3c2412/mach-jive.c b/arch/arm/mach-s3c2412/mach-jive.c
--- a/arch/arm/mach-s3c2412/mach-jive.c 2010-10-23 19:40:31.000000000 +0200
+++ b/arch/arm/mach-s3c2412/mach-jive.c 2011-03-20 21:01:53.000000000 +0100
@@ -636,11 +636,9 @@ static void __init jive_machine_init(voi
 
 	/* initialise the spi */
 
-	gpio_request(S3C2410_GPG(13), "lcm reset");
-	gpio_direction_output(S3C2410_GPG(13), 0);
+	gpio_request_one(S3C2410_GPG(13), GPIOF_OUT_INIT_LOW, "lcm reset");
 
-	gpio_request(S3C2410_GPB(7), "jive spi");
-	gpio_direction_output(S3C2410_GPB(7), 1);
+	gpio_request_one(S3C2410_GPB(7), GPIOF_OUT_INIT_HIGH, "jive spi");
 
 	s3c2410_gpio_setpin(S3C2410_GPB(6), 0);
 	s3c_gpio_cfgpin(S3C2410_GPB(6), S3C2410_GPIO_OUTPUT);
@@ -650,8 +648,8 @@ static void __init jive_machine_init(voi
 
 	/* initialise the WM8750 spi */
 
-	gpio_request(S3C2410_GPH(10), "jive wm8750 spi");
-	gpio_direction_output(S3C2410_GPH(10), 1);
+	gpio_request_one(S3C2410_GPH(10), GPIOF_OUT_INIT_HIGH,
+			 "jive wm8750 spi");
 
 	/* Turn off suspend on both USB ports, and switch the
 	 * selectable USB port to USB device mode. */
diff -u -p a/arch/arm/mach-s3c2416/mach-smdk2416.c b/arch/arm/mach-s3c2416/mach-smdk2416.c
--- a/arch/arm/mach-s3c2416/mach-smdk2416.c 2011-01-09 09:32:57.000000000 +0100
+++ b/arch/arm/mach-s3c2416/mach-smdk2416.c 2011-03-20 21:01:53.000000000 +0100
@@ -203,14 +203,11 @@ static void __init smdk2416_machine_init
 	s3c_sdhci0_set_platdata(&smdk2416_hsmmc0_pdata);
 	s3c_sdhci1_set_platdata(&smdk2416_hsmmc1_pdata);
 
-	gpio_request(S3C2410_GPB(4), "USBHost Power");
-	gpio_direction_output(S3C2410_GPB(4), 1);
+	gpio_request_one(S3C2410_GPB(4), GPIOF_OUT_INIT_HIGH, "USBHost Power");
 
-	gpio_request(S3C2410_GPB(3), "Display Power");
-	gpio_direction_output(S3C2410_GPB(3), 1);
+	gpio_request_one(S3C2410_GPB(3), GPIOF_OUT_INIT_HIGH, "Display Power");
 
-	gpio_request(S3C2410_GPB(1), "Display Reset");
-	gpio_direction_output(S3C2410_GPB(1), 1);
+	gpio_request_one(S3C2410_GPB(1), GPIOF_OUT_INIT_HIGH, "Display Reset");
 
 	platform_add_devices(smdk2416_devices, ARRAY_SIZE(smdk2416_devices));
 	smdk_machine_init();
diff -u -p a/arch/arm/mach-s3c2440/mach-mini2440.c b/arch/arm/mach-s3c2440/mach-mini2440.c
--- a/arch/arm/mach-s3c2440/mach-mini2440.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-s3c2440/mach-mini2440.c 2011-03-20 21:01:50.000000000 +0100
@@ -618,8 +618,8 @@ static void __init mini2440_init(void)
 	s3c_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND);
 
 	/* Turn the backlight early on */
-	WARN_ON(gpio_request(S3C2410_GPG(4), "backlight"));
-	gpio_direction_output(S3C2410_GPG(4), 1);
+	WARN_ON(gpio_request_one(S3C2410_GPG(4), GPIOF_OUT_INIT_HIGH,
+				 "backlight"));
 
 	/* remove pullup on optional PWM backlight -- unused on 3.5 and 7"s */
 	s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_UP);
diff -u -p a/arch/arm/mach-s3c2440/mach-osiris-dvs.c b/arch/arm/mach-s3c2440/mach-osiris-dvs.c
--- a/arch/arm/mach-s3c2440/mach-osiris-dvs.c 2009-12-08 20:58:27.000000000 +0100
+++ b/arch/arm/mach-s3c2440/mach-osiris-dvs.c 2011-03-20 21:01:50.000000000 +0100
@@ -99,15 +99,13 @@ static int __devinit osiris_dvs_probe(st
 
 	dev_info(&pdev->dev, "initialising\n");
 
-	ret = gpio_request(OSIRIS_GPIO_DVS, "osiris-dvs");
+	ret = gpio_request_one(OSIRIS_GPIO_DVS, GPIOF_OUT_INIT_HIGH,
+			       "osiris-dvs");
 	if (ret) {
 		dev_err(&pdev->dev, "cannot claim gpio\n");
 		goto err_nogpio;
 	}
 
-	/* start with dvs disabled */
-	gpio_direction_output(OSIRIS_GPIO_DVS, 1);
-
 	ret = cpufreq_register_notifier(&osiris_dvs_nb,
 					CPUFREQ_TRANSITION_NOTIFIER);
 	if (ret) {
diff -u -p a/arch/arm/mach-s3c2440/mach-rx1950.c b/arch/arm/mach-s3c2440/mach-rx1950.c
--- a/arch/arm/mach-s3c2440/mach-rx1950.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c 2011-03-20 21:01:50.000000000 +0100
@@ -785,8 +785,8 @@ static void __init rx1950_init_machine(v
 						S3C2410_MISCCR_USBSUSPND1, 0x0);
 
 	/* mmc power is disabled by default */
-	WARN_ON(gpio_request(S3C2410_GPJ(1), "MMC power"));
-	gpio_direction_output(S3C2410_GPJ(1), 0);
+	WARN_ON(gpio_request_one(S3C2410_GPJ(1), GPIOF_OUT_INIT_LOW,
+				 "MMC power"));
 
 	for (i = 0; i < 8; i++)
 		WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power"));
@@ -802,12 +802,12 @@ static void __init rx1950_init_machine(v
 
 	WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power"));
 
-	WARN_ON(gpio_request(S3C2410_GPA(3), "Red blink"));
-	WARN_ON(gpio_request(S3C2410_GPA(4), "Green blink"));
-	WARN_ON(gpio_request(S3C2410_GPJ(6), "LED blink"));
-	gpio_direction_output(S3C2410_GPA(3), 0);
-	gpio_direction_output(S3C2410_GPA(4), 0);
-	gpio_direction_output(S3C2410_GPJ(6), 0);
+	WARN_ON(gpio_request_one(S3C2410_GPA(3), GPIOF_OUT_INIT_LOW,
+				 "Red blink"));
+	WARN_ON(gpio_request_one(S3C2410_GPA(4), GPIOF_OUT_INIT_LOW,
+				 "Green blink"));
+	WARN_ON(gpio_request_one(S3C2410_GPJ(6), GPIOF_OUT_INIT_LOW,
+				 "LED blink"));
 
 	platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
 
diff -u -p a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
--- a/arch/arm/mach-s3c64xx/mach-hmt.c 2010-10-23 19:40:31.000000000 +0200
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c 2011-03-20 21:01:51.000000000 +0100
@@ -251,14 +251,12 @@ static void __init hmt_machine_init(void
 	s3c_fb_set_platdata(&hmt_lcd_pdata);
 	s3c_nand_set_platdata(&hmt_nand_info);
 
-	gpio_request(S3C64XX_GPC(7), "usb power");
-	gpio_direction_output(S3C64XX_GPC(7), 0);
-	gpio_request(S3C64XX_GPM(0), "usb power");
-	gpio_direction_output(S3C64XX_GPM(0), 1);
-	gpio_request(S3C64XX_GPK(7), "usb power");
-	gpio_direction_output(S3C64XX_GPK(7), 1);
-	gpio_request(S3C64XX_GPF(13), "usb power");
-	gpio_direction_output(S3C64XX_GPF(13), 1);
+	gpio_request_one(S3C64XX_GPC(7), GPIOF_OUT_INIT_LOW, "usb power");
+	gpio_request_one(S3C64XX_GPM(0), GPIOF_OUT_INIT_HIGH, "usb power");
+	
+	gpio_request_one(S3C64XX_GPK(7), GPIOF_OUT_INIT_HIGH, "usb power");
+	
+	gpio_request_one(S3C64XX_GPF(13), GPIOF_OUT_INIT_HIGH, "usb power");
 
 	platform_add_devices(hmt_devices, ARRAY_SIZE(hmt_devices));
 }
diff -u -p a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
--- a/arch/arm/mach-s3c64xx/mach-smartq.c 2010-09-04 09:22:04.000000000 +0200
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c 2011-03-20 21:01:51.000000000 +0100
@@ -189,13 +189,11 @@ static int __init smartq_lcd_setup_gpio(
 {
 	int ret;
 
-	ret = gpio_request(S3C64XX_GPM(3), "LCD power");
+	ret = gpio_request_one(S3C64XX_GPM(3), GPIOF_OUT_INIT_LOW,
+			       "LCD power");
 	if (ret < 0)
 		return ret;
 
-	/* turn power off */
-	gpio_direction_output(S3C64XX_GPM(3), 0);
-
 	return 0;
 }
 
@@ -276,15 +274,13 @@ static int __init smartq_power_off_init(
 {
 	int ret;
 
-	ret = gpio_request(S3C64XX_GPK(15), "Power control");
+	ret = gpio_request_one(S3C64XX_GPK(15), GPIOF_OUT_INIT_LOW,
+			       "Power control");
 	if (ret < 0) {
 		pr_err("%s: failed to get GPK15\n", __func__);
 		return ret;
 	}
 
-	/* leave power on */
-	gpio_direction_output(S3C64XX_GPK(15), 0);
-
 	pm_power_off = smartq_power_off;
 
 	return ret;
@@ -294,13 +290,15 @@ static int __init smartq_usb_host_init(v
 {
 	int ret;
 
-	ret = gpio_request(S3C64XX_GPL(0), "USB power control");
+	ret = gpio_request_one(S3C64XX_GPL(0), GPIOF_OUT_INIT_LOW,
+			       "USB power control");
 	if (ret < 0) {
 		pr_err("%s: failed to get GPL0\n", __func__);
 		return ret;
 	}
 
-	ret = gpio_request(S3C64XX_GPL(1), "USB host power control");
+	ret = gpio_request_one(S3C64XX_GPL(1), GPIOF_OUT_INIT_LOW,
+			       "USB host power control");
 	if (ret < 0) {
 		pr_err("%s: failed to get GPL1\n", __func__);
 		goto err;
@@ -316,8 +314,6 @@ static int __init smartq_usb_host_init(v
 	}
 
 	/* turn power off */
-	gpio_direction_output(S3C64XX_GPL(0), 0);
-	gpio_direction_output(S3C64XX_GPL(1), 0);
 	if (!machine_is_smartq5())
 		gpio_direction_input(S3C64XX_GPL(10));
 
@@ -343,24 +339,22 @@ static int __init smartq_wifi_init(void)
 {
 	int ret;
 
-	ret = gpio_request(S3C64XX_GPK(1), "wifi control");
+	ret = gpio_request_one(S3C64XX_GPK(1), GPIOF_OUT_INIT_HIGH,
+			       "wifi control");
 	if (ret < 0) {
 		pr_err("%s: failed to get GPK1\n", __func__);
 		return ret;
 	}
 
-	ret = gpio_request(S3C64XX_GPK(2), "wifi reset");
+	ret = gpio_request_one(S3C64XX_GPK(2), GPIOF_OUT_INIT_LOW,
+			       "wifi reset");
 	if (ret < 0) {
 		pr_err("%s: failed to get GPK2\n", __func__);
 		gpio_free(S3C64XX_GPK(1));
 		return ret;
 	}
 
-	/* turn power on */
-	gpio_direction_output(S3C64XX_GPK(1), 1);
-
 	/* reset device */
-	gpio_direction_output(S3C64XX_GPK(2), 0);
 	mdelay(100);
 	gpio_set_value(S3C64XX_GPK(2), 1);
 	gpio_direction_input(S3C64XX_GPK(2));
diff -u -p a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
--- a/arch/arm/mach-s5pv210/mach-aquila.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-s5pv210/mach-aquila.c 2011-03-20 21:01:54.000000000 +0100
@@ -595,8 +595,7 @@ static struct s3c_sdhci_platdata aquila_
 
 static void aquila_setup_sdhci(void)
 {
-	gpio_request(AQUILA_EXT_FLASH_EN, "FLASH_EN");
-	gpio_direction_output(AQUILA_EXT_FLASH_EN, 1);
+	gpio_request_one(AQUILA_EXT_FLASH_EN, GPIOF_OUT_INIT_HIGH, "FLASH_EN");
 
 	s3c_sdhci0_set_platdata(&aquila_hsmmc0_data);
 	s3c_sdhci1_set_platdata(&aquila_hsmmc1_data);
diff -u -p a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c 2011-03-20 21:01:53.000000000 +0100
@@ -153,15 +153,12 @@ static void smdkv210_lte480wv_set_power(
 {
 	if (power) {
 #if !defined(CONFIG_BACKLIGHT_PWM)
-		gpio_request(S5PV210_GPD0(3), "GPD0");
-		gpio_direction_output(S5PV210_GPD0(3), 1);
+		gpio_request_one(S5PV210_GPD0(3), GPIOF_OUT_INIT_HIGH, "GPD0");
 		gpio_free(S5PV210_GPD0(3));
 #endif
 
 		/* fire nRESET on power up */
-		gpio_request(S5PV210_GPH0(6), "GPH0");
-
-		gpio_direction_output(S5PV210_GPH0(6), 1);
+		gpio_request_one(S5PV210_GPH0(6), GPIOF_OUT_INIT_HIGH, "GPH0");
 
 		gpio_set_value(S5PV210_GPH0(6), 0);
 		mdelay(10);
@@ -172,8 +169,7 @@ static void smdkv210_lte480wv_set_power(
 		gpio_free(S5PV210_GPH0(6));
 	} else {
 #if !defined(CONFIG_BACKLIGHT_PWM)
-		gpio_request(S5PV210_GPD0(3), "GPD0");
-		gpio_direction_output(S5PV210_GPD0(3), 0);
+		gpio_request_one(S5PV210_GPD0(3), GPIOF_OUT_INIT_LOW, "GPD0");
 		gpio_free(S5PV210_GPD0(3));
 #endif
 	}
diff -u -p a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
--- a/arch/arm/mach-shmobile/board-ag5evm.c 2011-02-02 17:27:36.000000000 +0100
+++ b/arch/arm/mach-shmobile/board-ag5evm.c 2011-03-20 21:01:54.000000000 +0100
@@ -418,14 +418,11 @@ static void __init ag5evm_init(void)
 	gpio_request(GPIO_FN_MMCD0_5, NULL);
 	gpio_request(GPIO_FN_MMCD0_6, NULL);
 	gpio_request(GPIO_FN_MMCD0_7, NULL);
-	gpio_request(GPIO_PORT208, NULL); /* Reset */
-	gpio_direction_output(GPIO_PORT208, 1);
+	gpio_request_one(GPIO_PORT208, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* enable SMSC911X */
-	gpio_request(GPIO_PORT144, NULL); /* PINTA2 */
-	gpio_direction_input(GPIO_PORT144);
-	gpio_request(GPIO_PORT145, NULL); /* RESET */
-	gpio_direction_output(GPIO_PORT145, 1);
+	gpio_request_one(GPIO_PORT144, GPIOF_IN, NULL); /* PINTA2 */
+	gpio_request_one(GPIO_PORT145, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* FSI A */
 	gpio_request(GPIO_FN_FSIACK, NULL);
@@ -440,15 +437,13 @@ static void __init ag5evm_init(void)
 	gpio_request(GPIO_FN_PORT243_IRDA_FIRSEL, NULL);
 
 	/* LCD panel */
-	gpio_request(GPIO_PORT217, NULL); /* RESET */
-	gpio_direction_output(GPIO_PORT217, 0);
+	gpio_request_one(GPIO_PORT217, GPIOF_OUT_INIT_LOW, NULL); /* RESET */
 	mdelay(1);
 	gpio_set_value(GPIO_PORT217, 1);
 	mdelay(100);
 
 	/* LCD backlight controller */
-	gpio_request(GPIO_PORT235, NULL); /* RESET */
-	gpio_direction_output(GPIO_PORT235, 0);
+	gpio_request_one(GPIO_PORT235, GPIOF_OUT_INIT_LOW, NULL); /* RESET */
 	lcd_backlight_reset();
 
 	/* MIPI-DSI clock setup */
diff -u -p a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
--- a/arch/arm/mach-shmobile/board-ap4evb.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-shmobile/board-ap4evb.c 2011-03-20 21:01:54.000000000 +0100
@@ -1054,9 +1054,7 @@ static int ts_get_pendown_state(void)
 
 	gpio_free(GPIO_TSC_IRQ);
 
-	gpio_request(GPIO_TSC_PORT, NULL);
-
-	gpio_direction_input(GPIO_TSC_PORT);
+	gpio_request_one(GPIO_TSC_PORT, GPIOF_IN, NULL);
 
 	val = gpio_get_value(GPIO_TSC_PORT);
 
@@ -1139,14 +1137,10 @@ static void __init ap4evb_init(void)
 	gpio_request(GPIO_FN_IRQ6_39,	NULL);
 
 	/* enable Debug switch (S6) */
-	gpio_request(GPIO_PORT32, NULL);
-	gpio_request(GPIO_PORT33, NULL);
-	gpio_request(GPIO_PORT34, NULL);
-	gpio_request(GPIO_PORT35, NULL);
-	gpio_direction_input(GPIO_PORT32);
-	gpio_direction_input(GPIO_PORT33);
-	gpio_direction_input(GPIO_PORT34);
-	gpio_direction_input(GPIO_PORT35);
+	gpio_request_one(GPIO_PORT32, GPIOF_IN, NULL);
+	gpio_request_one(GPIO_PORT33, GPIOF_IN, NULL);
+	gpio_request_one(GPIO_PORT34, GPIOF_IN, NULL);
+	gpio_request_one(GPIO_PORT35, GPIOF_IN, NULL);
 	gpio_export(GPIO_PORT32, 0);
 	gpio_export(GPIO_PORT33, 0);
 	gpio_export(GPIO_PORT34, 0);
@@ -1198,8 +1192,7 @@ static void __init ap4evb_init(void)
 	gpio_request(GPIO_FN_FSIAILR,	NULL);
 	gpio_request(GPIO_FN_FSIAISLD,	NULL);
 	gpio_request(GPIO_FN_FSIAOSLD,	NULL);
-	gpio_request(GPIO_PORT161,	NULL);
-	gpio_direction_output(GPIO_PORT161, 0); /* slave */
+	gpio_request_one(GPIO_PORT161, GPIOF_OUT_INIT_LOW, NULL);/* slave */
 
 	gpio_request(GPIO_PORT9, NULL);
 	gpio_request(GPIO_PORT10, NULL);
@@ -1207,8 +1200,7 @@ static void __init ap4evb_init(void)
 	gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */
 
 	/* card detect pin for MMC slot (CN7) */
-	gpio_request(GPIO_PORT41, NULL);
-	gpio_direction_input(GPIO_PORT41);
+	gpio_request_one(GPIO_PORT41, GPIOF_IN, NULL);
 
 	/* setup FSI2 port B (HDMI) */
 	gpio_request(GPIO_FN_FSIBCK, NULL);
@@ -1296,11 +1288,9 @@ static void __init ap4evb_init(void)
 	gpio_request(GPIO_FN_LCDDISP,  NULL);
 	gpio_request(GPIO_FN_LCDDCK,   NULL);
 
-	gpio_request(GPIO_PORT189, NULL); /* backlight */
-	gpio_direction_output(GPIO_PORT189, 1);
+	gpio_request_one(GPIO_PORT189, GPIOF_OUT_INIT_HIGH, NULL);
 
-	gpio_request(GPIO_PORT151, NULL); /* LCDDON */
-	gpio_direction_output(GPIO_PORT151, 1);
+	gpio_request_one(GPIO_PORT151, GPIOF_OUT_INIT_HIGH, NULL);
 
 	lcdc_info.clock_source			= LCDC_CLK_BUS;
 	lcdc_info.ch[0].interface_type		= RGB18;
diff -u -p a/arch/arm/mach-shmobile/board-g3evm.c b/arch/arm/mach-shmobile/board-g3evm.c
--- a/arch/arm/mach-shmobile/board-g3evm.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/arm/mach-shmobile/board-g3evm.c 2011-03-20 21:01:55.000000000 +0100
@@ -271,18 +271,15 @@ static void __init g3evm_init(void)
 	sh7367_pinmux_init();
 
 	/* Lit DS4 LED */
-	gpio_request(GPIO_PORT22, NULL);
-	gpio_direction_output(GPIO_PORT22, 1);
+	gpio_request_one(GPIO_PORT22, GPIOF_OUT_INIT_HIGH, NULL);
 	gpio_export(GPIO_PORT22, 0);
 
 	/* Lit DS8 LED */
-	gpio_request(GPIO_PORT23, NULL);
-	gpio_direction_output(GPIO_PORT23, 1);
+	gpio_request_one(GPIO_PORT23, GPIOF_OUT_INIT_HIGH, NULL);
 	gpio_export(GPIO_PORT23, 0);
 
 	/* Lit DS3 LED */
-	gpio_request(GPIO_PORT24, NULL);
-	gpio_direction_output(GPIO_PORT24, 1);
+	gpio_request_one(GPIO_PORT24, GPIOF_OUT_INIT_HIGH, NULL);
 	gpio_export(GPIO_PORT24, 0);
 
 	/* SCIFA1 */
diff -u -p a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c
--- a/arch/arm/mach-shmobile/board-g4evm.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/arm/mach-shmobile/board-g4evm.c 2011-03-20 21:01:54.000000000 +0100
@@ -315,23 +315,19 @@ static void __init g4evm_init(void)
 	sh7377_pinmux_init();
 
 	/* Lit DS14 LED */
-	gpio_request(GPIO_PORT109, NULL);
-	gpio_direction_output(GPIO_PORT109, 1);
+	gpio_request_one(GPIO_PORT109, GPIOF_OUT_INIT_HIGH, NULL);
 	gpio_export(GPIO_PORT109, 1);
 
 	/* Lit DS15 LED */
-	gpio_request(GPIO_PORT110, NULL);
-	gpio_direction_output(GPIO_PORT110, 1);
+	gpio_request_one(GPIO_PORT110, GPIOF_OUT_INIT_HIGH, NULL);
 	gpio_export(GPIO_PORT110, 1);
 
 	/* Lit DS16 LED */
-	gpio_request(GPIO_PORT112, NULL);
-	gpio_direction_output(GPIO_PORT112, 1);
+	gpio_request_one(GPIO_PORT112, GPIOF_OUT_INIT_HIGH, NULL);
 	gpio_export(GPIO_PORT112, 1);
 
 	/* Lit DS17 LED */
-	gpio_request(GPIO_PORT113, NULL);
-	gpio_direction_output(GPIO_PORT113, 1);
+	gpio_request_one(GPIO_PORT113, GPIOF_OUT_INIT_HIGH, NULL);
 	gpio_export(GPIO_PORT113, 1);
 
 	/* USBHS */
diff -u -p a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
--- a/arch/arm/mach-shmobile/board-mackerel.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-shmobile/board-mackerel.c 2011-03-20 21:01:55.000000000 +0100
@@ -1058,11 +1058,9 @@ static void __init mackerel_init(void)
 	gpio_request(GPIO_FN_LCDDISP,  NULL);
 	gpio_request(GPIO_FN_LCDDCK,   NULL);
 
-	gpio_request(GPIO_PORT31, NULL); /* backlight */
-	gpio_direction_output(GPIO_PORT31, 1);
+	gpio_request_one(GPIO_PORT31, GPIOF_OUT_INIT_HIGH, NULL);
 
-	gpio_request(GPIO_PORT151, NULL); /* LCDDON */
-	gpio_direction_output(GPIO_PORT151, 1);
+	gpio_request_one(GPIO_PORT151, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* USB enable */
 	gpio_request(GPIO_FN_VBUS0_1,    NULL);
@@ -1080,8 +1078,7 @@ static void __init mackerel_init(void)
 	gpio_request(GPIO_FN_FSIAILR,	NULL);
 	gpio_request(GPIO_FN_FSIAISLD,	NULL);
 	gpio_request(GPIO_FN_FSIAOSLD,	NULL);
-	gpio_request(GPIO_PORT161,	NULL);
-	gpio_direction_output(GPIO_PORT161, 0); /* slave */
+	gpio_request_one(GPIO_PORT161, GPIOF_OUT_INIT_LOW, NULL);/* slave */
 
 	gpio_request(GPIO_PORT9,  NULL);
 	gpio_request(GPIO_PORT10, NULL);
@@ -1133,8 +1130,7 @@ static void __init mackerel_init(void)
 	gpio_request(GPIO_FN_SDHID1_0, NULL);
 #endif
 	/* card detect pin for MMC slot (CN7) */
-	gpio_request(GPIO_PORT41, NULL);
-	gpio_direction_input(GPIO_PORT41);
+	gpio_request_one(GPIO_PORT41, GPIOF_IN, NULL);
 
 	/* enable SDHI2 */
 	gpio_request(GPIO_FN_SDHICMD2, NULL);
@@ -1145,8 +1141,7 @@ static void __init mackerel_init(void)
 	gpio_request(GPIO_FN_SDHID2_0, NULL);
 
 	/* card detect pin for microSD slot (CN23) */
-	gpio_request(GPIO_PORT162, NULL);
-	gpio_direction_input(GPIO_PORT162);
+	gpio_request_one(GPIO_PORT162, GPIOF_IN, NULL);
 
 	/* MMCIF */
 	gpio_request(GPIO_FN_MMCD0_0, NULL);
diff -u -p a/arch/arm/mach-stmp378x/stmp378x_devb.c b/arch/arm/mach-stmp378x/stmp378x_devb.c
--- a/arch/arm/mach-stmp378x/stmp378x_devb.c 2010-10-23 19:40:31.000000000 +0200
+++ b/arch/arm/mach-stmp378x/stmp378x_devb.c 2011-03-20 21:01:54.000000000 +0100
@@ -133,18 +133,15 @@ static int stmp3xxxmmc_hw_init_ssp1(void
 		goto out;
 
 	/* Configure write protect GPIO pin */
-	ret = gpio_request(PINID_PWM4, "mmc wp");
+	ret = gpio_request_one(PINID_PWM4, GPIOF_IN, "mmc wp");
 	if (ret)
 		goto out_wp;
 
-	gpio_direction_input(PINID_PWM4);
-
 	/* Configure POWER pin as gpio to drive power to MMC slot */
-	ret = gpio_request(PINID_PWM3, "mmc power");
+	ret = gpio_request_one(PINID_PWM3, GPIOF_OUT_INIT_LOW, "mmc power");
 	if (ret)
 		goto out_power;
 
-	gpio_direction_output(PINID_PWM3, 0);
 	mdelay(100);
 
 	return 0;
diff -u -p a/arch/arm/mach-tegra/board-harmony-pcie.c b/arch/arm/mach-tegra/board-harmony-pcie.c
--- a/arch/arm/mach-tegra/board-harmony-pcie.c 2011-03-20 18:17:23.000000000 +0100
+++ b/arch/arm/mach-tegra/board-harmony-pcie.c 2011-03-20 21:01:53.000000000 +0100
@@ -38,12 +38,11 @@ static int __init harmony_pcie_init(void
 	if (!machine_is_harmony())
 		return 0;
 
-	err = gpio_request(EN_VDD_1V05_GPIO, "EN_VDD_1V05");
+	err = gpio_request_one(EN_VDD_1V05_GPIO, GPIOF_OUT_INIT_HIGH,
+			       "EN_VDD_1V05");
 	if (err)
 		return err;
 
-	gpio_direction_output(EN_VDD_1V05_GPIO, 1);
-
 	regulator = regulator_get(NULL, "pex_clk");
 	if (IS_ERR_OR_NULL(regulator))
 		goto err_reg;
diff -u -p a/arch/arm/mach-tegra/board-seaboard.c b/arch/arm/mach-tegra/board-seaboard.c
--- a/arch/arm/mach-tegra/board-seaboard.c 2011-03-20 18:17:23.000000000 +0100
+++ b/arch/arm/mach-tegra/board-seaboard.c 2011-03-20 21:01:54.000000000 +0100
@@ -154,8 +154,7 @@ static struct i2c_board_info __initdata 
 
 static void __init seaboard_i2c_init(void)
 {
-	gpio_request(TEGRA_GPIO_ISL29018_IRQ, "isl29018");
-	gpio_direction_input(TEGRA_GPIO_ISL29018_IRQ);
+	gpio_request_one(TEGRA_GPIO_ISL29018_IRQ, GPIOF_IN, "isl29018");
 
 	i2c_register_board_info(0, &isl29018_device, 1);
 
diff -u -p a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c
--- a/arch/arm/mach-tegra/usb_phy.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-tegra/usb_phy.c 2011-03-20 21:01:54.000000000 +0100
@@ -710,8 +710,8 @@ struct tegra_usb_phy *tegra_usb_phy_open
 			goto err1;
 		}
 		tegra_gpio_enable(ulpi_config->reset_gpio);
-		gpio_request(ulpi_config->reset_gpio, "ulpi_phy_reset_b");
-		gpio_direction_output(ulpi_config->reset_gpio, 0);
+		gpio_request_one(ulpi_config->reset_gpio, GPIOF_OUT_INIT_LOW,
+				 "ulpi_phy_reset_b");
 		phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0);
 		phy->ulpi->io_priv = regs + ULPI_VIEWPORT;
 	} else {
diff -u -p a/arch/arm/plat-mxc/3ds_debugboard.c b/arch/arm/plat-mxc/3ds_debugboard.c
--- a/arch/arm/plat-mxc/3ds_debugboard.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/arm/plat-mxc/3ds_debugboard.c 2011-03-20 21:01:54.000000000 +0100
@@ -176,8 +176,7 @@ int __init mxc_expio_init(u32 base, u32 
 	/*
 	 * Configure INT line as GPIO input
 	 */
-	gpio_request(MXC_IRQ_TO_GPIO(p_irq), "expio_pirq");
-	gpio_direction_input(MXC_IRQ_TO_GPIO(p_irq));
+	gpio_request_one(MXC_IRQ_TO_GPIO(p_irq), GPIOF_IN, "expio_pirq");
 
 	/* disable the interrupt and clear the status */
 	__raw_writew(0, brd_io + INTR_MASK_REG);
diff -u -p a/arch/arm/plat-omap/debug-devices.c b/arch/arm/plat-omap/debug-devices.c
--- a/arch/arm/plat-omap/debug-devices.c 2009-12-12 00:23:19.000000000 +0100
+++ b/arch/arm/plat-omap/debug-devices.c 2011-03-20 21:01:50.000000000 +0100
@@ -82,12 +82,11 @@ int __init debug_card_init(u32 addr, uns
 	smc91x_resources[1].start = gpio_to_irq(gpio);
 	smc91x_resources[1].end   = gpio_to_irq(gpio);
 
-	status = gpio_request(gpio, "SMC91x irq");
+	status = gpio_request_one(gpio, GPIOF_IN, "SMC91x irq");
 	if (status < 0) {
 		printk(KERN_ERR "GPIO%d unavailable for smc91x IRQ\n", gpio);
 		return status;
 	}
-	gpio_direction_input(gpio);
 
 	led_resources[0].start = addr;
 	led_resources[0].end   = addr + SZ_4K - 1;
diff -u -p a/arch/avr32/boards/atngw100/mrmt.c b/arch/avr32/boards/atngw100/mrmt.c
--- a/arch/avr32/boards/atngw100/mrmt.c 2009-09-21 18:11:44.000000000 +0200
+++ b/arch/avr32/boards/atngw100/mrmt.c 2011-03-20 21:01:49.000000000 +0100
@@ -314,13 +314,11 @@ static int __init mrmt1_init(void)
 #endif
 
 	at32_select_gpio( PIN_LCD_DISP, AT32_GPIOF_OUTPUT );
-	gpio_request( PIN_LCD_DISP, "LCD_DISP" );
-	gpio_direction_output( PIN_LCD_DISP, 0 );	/* LCD DISP */
+	gpio_request_one(PIN_LCD_DISP, GPIOF_OUT_INIT_LOW, "LCD_DISP");/* LCD DISP */
 #ifdef CONFIG_BOARD_MRMT_LCD_DISABLE
 	/* Keep Backlight and DISP off */
 	at32_select_gpio( PIN_LCD_BL, AT32_GPIOF_OUTPUT );
-	gpio_request( PIN_LCD_BL, "LCD_BL" );
-	gpio_direction_output( PIN_LCD_BL, 0 );		/* Backlight */
+	gpio_request_one(PIN_LCD_BL, GPIOF_OUT_INIT_LOW, "LCD_BL");/* Backlight */
 #else
 	gpio_set_value( PIN_LCD_DISP, 1 );	/* DISP asserted first */
 #ifdef CONFIG_BOARD_MRMT_BL_PWM
@@ -331,20 +329,17 @@ static int __init mrmt1_init(void)
 	/* Backlight always on */
 	udelay( 1 );
 	at32_select_gpio( PIN_LCD_BL, AT32_GPIOF_OUTPUT );
-	gpio_request( PIN_LCD_BL, "LCD_BL" );
-	gpio_direction_output( PIN_LCD_BL, 1 );
+	gpio_request_one(PIN_LCD_BL, GPIOF_OUT_INIT_HIGH, "LCD_BL");
 #endif
 #endif
 
 	/* Make sure BT and Zigbee modules in reset */
 	at32_select_gpio( PIN_BT_RST, AT32_GPIOF_OUTPUT );
-	gpio_request( PIN_BT_RST, "BT_RST" );
-	gpio_direction_output( PIN_BT_RST, 1 );
+	gpio_request_one(PIN_BT_RST, GPIOF_OUT_INIT_HIGH, "BT_RST");
 	/* BT Module in Reset */
 
 	at32_select_gpio( PIN_ZB_RST_N, AT32_GPIOF_OUTPUT );
-	gpio_request( PIN_ZB_RST_N, "ZB_RST_N" );
-	gpio_direction_output( PIN_ZB_RST_N, 0 );
+	gpio_request_one(PIN_ZB_RST_N, GPIOF_OUT_INIT_LOW, "ZB_RST_N");
 	/* XBee Module in Reset */
 
 #ifdef CONFIG_BOARD_MRMT_WIRELESS_ZB
@@ -366,8 +361,7 @@ static int __init mrmt1_early_init(void)
 {
 	/* To maintain power-on signal in case boot loader did not already */
 	at32_select_gpio( PIN_PWR_ON, AT32_GPIOF_OUTPUT );
-	gpio_request( PIN_PWR_ON, "PIN_PWR_ON" );
-	gpio_direction_output( PIN_PWR_ON, 1 );
+	gpio_request_one(PIN_PWR_ON, GPIOF_OUT_INIT_HIGH, "PIN_PWR_ON");
 
 	return 0;
 }
diff -u -p a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c
--- a/arch/avr32/boards/atngw100/setup.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/avr32/boards/atngw100/setup.c 2011-03-20 21:01:50.000000000 +0100
@@ -309,13 +309,11 @@ static int __init atngw100_arch_init(voi
 	 */
 #ifdef CONFIG_BOARD_ATNGW100_MKII
 	at32_select_gpio(GPIO_PIN_PE(30), 0);
-	gpio_request(GPIO_PIN_PE(30), "j15");
-	gpio_direction_input(GPIO_PIN_PE(30));
+	gpio_request_one(GPIO_PIN_PE(30), GPIOF_IN, "j15");
 	gpio_export(GPIO_PIN_PE(30), false);
 #else
 	at32_select_gpio(GPIO_PIN_PB(30), 0);
-	gpio_request(GPIO_PIN_PB(30), "j15");
-	gpio_direction_input(GPIO_PIN_PB(30));
+	gpio_request_one(GPIO_PIN_PB(30), GPIOF_IN, "j15");
 	gpio_export(GPIO_PIN_PB(30), false);
 #endif
 
diff -u -p a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
--- a/arch/blackfin/mach-bf533/boards/stamp.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/blackfin/mach-bf533/boards/stamp.c 2011-03-20 21:01:50.000000000 +0100
@@ -718,6 +718,5 @@ void __init native_machine_early_platfor
 void native_machine_restart(char *cmd)
 {
 	/* workaround pull up on cpld / flash pin not being strong enough */
-	gpio_request(GPIO_PF0, "flash_cpld");
-	gpio_direction_output(GPIO_PF0, 0);
+	gpio_request_one(GPIO_PF0, GPIOF_OUT_INIT_LOW, "flash_cpld");
 }
diff -u -p a/arch/mips/alchemy/devboards/db1200/platform.c b/arch/mips/alchemy/devboards/db1200/platform.c
--- a/arch/mips/alchemy/devboards/db1200/platform.c 2010-09-04 09:22:04.000000000 +0200
+++ b/arch/mips/alchemy/devboards/db1200/platform.c 2011-03-20 21:01:52.000000000 +0100
@@ -468,8 +468,7 @@ static int __init db1200_dev_init(void)
 	pfc = __raw_readl((void __iomem *)SYS_PINFUNC) & ~SYS_PINFUNC_P0A;
 
 	/* switch off OTG VBUS supply */
-	gpio_request(215, "otg-vbus");
-	gpio_direction_output(215, 1);
+	gpio_request_one(215, GPIOF_OUT_INIT_HIGH, "otg-vbus");
 
 	printk(KERN_INFO "DB1200 device configuration:\n");
 
diff -u -p a/arch/mips/alchemy/mtx-1/platform.c b/arch/mips/alchemy/mtx-1/platform.c
--- a/arch/mips/alchemy/mtx-1/platform.c 2011-03-20 18:17:23.000000000 +0100
+++ b/arch/mips/alchemy/mtx-1/platform.c 2011-03-20 21:01:52.000000000 +0100
@@ -153,14 +153,13 @@ static int __init mtx1_register_devices(
 
 	au1xxx_override_eth_cfg(0, &mtx1_au1000_eth0_pdata);
 
-	rc = gpio_request(mtx1_gpio_button[0].gpio,
-					mtx1_gpio_button[0].desc);
+	rc = gpio_request_one(mtx1_gpio_button[0].gpio, GPIOF_IN,
+			      mtx1_gpio_button[0].desc);
 	if (rc < 0) {
 		printk(KERN_INFO "mtx1: failed to request %d\n",
 					mtx1_gpio_button[0].gpio);
 		goto out;
 	}
-	gpio_direction_input(mtx1_gpio_button[0].gpio);
 out:
 	return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs));
 }
diff -u -p a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c
--- a/arch/mips/txx9/rbtx4927/setup.c 2010-02-11 23:53:22.000000000 +0100
+++ b/arch/mips/txx9/rbtx4927/setup.c 2011-03-20 21:01:53.000000000 +0100
@@ -207,8 +207,7 @@ static void __init rbtx4927_mem_setup(vo
 #endif
 
 	/* TX4927-SIO DTR on (PIO[15]) */
-	gpio_request(15, "sio-dtr");
-	gpio_direction_output(15, 1);
+	gpio_request_one(15, GPIOF_OUT_INIT_HIGH, "sio-dtr");
 
 	tx4927_sio_init(0, 0);
 }
diff -u -p a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
--- a/arch/mips/txx9/rbtx4938/setup.c 2010-02-11 23:53:22.000000000 +0100
+++ b/arch/mips/txx9/rbtx4938/setup.c 2011-03-20 21:01:53.000000000 +0100
@@ -285,14 +285,12 @@ static int __init rbtx4938_spi_init(void
 	spi_eeprom_register(SPI_BUSNO, SEEPROM1_CS, 128);
 	spi_eeprom_register(SPI_BUSNO, 16 + SEEPROM2_CS, 128);
 	spi_eeprom_register(SPI_BUSNO, 16 + SEEPROM3_CS, 128);
-	gpio_request(16 + SRTC_CS, "rtc-rs5c348");
-	gpio_direction_output(16 + SRTC_CS, 0);
-	gpio_request(SEEPROM1_CS, "seeprom1");
-	gpio_direction_output(SEEPROM1_CS, 1);
-	gpio_request(16 + SEEPROM2_CS, "seeprom2");
-	gpio_direction_output(16 + SEEPROM2_CS, 1);
-	gpio_request(16 + SEEPROM3_CS, "seeprom3");
-	gpio_direction_output(16 + SEEPROM3_CS, 1);
+	gpio_request_one(16 + SRTC_CS, GPIOF_OUT_INIT_LOW, "rtc-rs5c348");
+	gpio_request_one(SEEPROM1_CS, GPIOF_OUT_INIT_HIGH, "seeprom1");
+	
+	gpio_request_one(16 + SEEPROM2_CS, GPIOF_OUT_INIT_HIGH, "seeprom2");
+	
+	gpio_request_one(16 + SEEPROM3_CS, GPIOF_OUT_INIT_HIGH, "seeprom3");
 	tx4938_spi_init(SPI_BUSNO);
 	return 0;
 }
diff -u -p a/arch/sh/boards/board-sh7757lcr.c b/arch/sh/boards/board-sh7757lcr.c
--- a/arch/sh/boards/board-sh7757lcr.c 2011-03-20 18:17:23.000000000 +0100
+++ b/arch/sh/boards/board-sh7757lcr.c 2011-03-20 21:01:50.000000000 +0100
@@ -492,26 +492,22 @@ static int __init sh7757lcr_devices_setu
 	gpio_request(GPIO_FN_EVENT0, NULL);
 
 	/* LED for heartbeat */
-	gpio_request(GPIO_PTU3, NULL);
-	gpio_direction_output(GPIO_PTU3, 1);
-	gpio_request(GPIO_PTU2, NULL);
-	gpio_direction_output(GPIO_PTU2, 1);
-	gpio_request(GPIO_PTU1, NULL);
-	gpio_direction_output(GPIO_PTU1, 1);
-	gpio_request(GPIO_PTU0, NULL);
-	gpio_direction_output(GPIO_PTU0, 1);
+	gpio_request_one(GPIO_PTU3, GPIOF_OUT_INIT_HIGH, NULL);
+	
+	gpio_request_one(GPIO_PTU2, GPIOF_OUT_INIT_HIGH, NULL);
+	
+	gpio_request_one(GPIO_PTU1, GPIOF_OUT_INIT_HIGH, NULL);
+	
+	gpio_request_one(GPIO_PTU0, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* control for MDIO of Gigabit Ethernet */
-	gpio_request(GPIO_PTT4, NULL);
-	gpio_direction_output(GPIO_PTT4, 1);
+	gpio_request_one(GPIO_PTT4, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* control for eMMC */
-	gpio_request(GPIO_PTT7, NULL);		/* eMMC_RST# */
-	gpio_direction_output(GPIO_PTT7, 0);
-	gpio_request(GPIO_PTT6, NULL);		/* eMMC_INDEX# */
-	gpio_direction_output(GPIO_PTT6, 0);
-	gpio_request(GPIO_PTT5, NULL);		/* eMMC_PRST# */
-	gpio_direction_output(GPIO_PTT5, 1);
+	gpio_request_one(GPIO_PTT7, GPIOF_OUT_INIT_LOW, NULL);		/* eMMC_RST# */
+	
+	gpio_request_one(GPIO_PTT6, GPIOF_OUT_INIT_LOW, NULL);		/* eMMC_INDEX# */
+	gpio_request_one(GPIO_PTT5, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* register SPI device information */
 	spi_register_board_info(spi_board_info,
diff -u -p a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
--- a/arch/sh/boards/mach-ap325rxa/setup.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/sh/boards/mach-ap325rxa/setup.c 2011-03-20 21:01:51.000000000 +0100
@@ -548,17 +548,14 @@ static int __init ap325rxa_devices_setup
 					&ap325rxa_sdram_leave_end);
 
 	/* LD3 and LD4 LEDs */
-	gpio_request(GPIO_PTX5, NULL); /* RUN */
-	gpio_direction_output(GPIO_PTX5, 1);
+	gpio_request_one(GPIO_PTX5, GPIOF_OUT_INIT_HIGH, NULL); /* RUN */
 	gpio_export(GPIO_PTX5, 0);
 
-	gpio_request(GPIO_PTX4, NULL); /* INDICATOR */
-	gpio_direction_output(GPIO_PTX4, 0);
+	gpio_request_one(GPIO_PTX4, GPIOF_OUT_INIT_LOW, NULL); /* INDICATOR */
 	gpio_export(GPIO_PTX4, 0);
 
 	/* SW1 input */
-	gpio_request(GPIO_PTF7, NULL); /* MODE */
-	gpio_direction_input(GPIO_PTF7);
+	gpio_request_one(GPIO_PTF7, GPIOF_IN, NULL); /* MODE */
 	gpio_export(GPIO_PTF7, 0);
 
 	/* LCDC */
@@ -588,8 +585,7 @@ static int __init ap325rxa_devices_setup
 	gpio_request(GPIO_FN_LCDDON, NULL);
 
 	/* LCD backlight */
-	gpio_request(GPIO_PTS3, NULL);
-	gpio_direction_output(GPIO_PTS3, 1);
+	gpio_request_one(GPIO_PTS3, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* CEU */
 	gpio_request(GPIO_FN_VIO_CLK2, NULL);
@@ -606,14 +602,13 @@ static int __init ap325rxa_devices_setup
 	gpio_request(GPIO_FN_VIO_D9, NULL);
 	gpio_request(GPIO_FN_VIO_D8, NULL);
 
-	gpio_request(GPIO_PTZ7, NULL);
-	gpio_direction_output(GPIO_PTZ7, 0); /* OE_CAM */
-	gpio_request(GPIO_PTZ6, NULL);
-	gpio_direction_output(GPIO_PTZ6, 0); /* STBY_CAM */
-	gpio_request(GPIO_PTZ5, NULL);
-	gpio_direction_output(GPIO_PTZ5, 0); /* RST_CAM */
-	gpio_request(GPIO_PTZ4, NULL);
-	gpio_direction_output(GPIO_PTZ4, 0); /* SADDR */
+	gpio_request_one(GPIO_PTZ7, GPIOF_OUT_INIT_LOW, NULL);
+	 /* OE_CAM */
+	gpio_request_one(GPIO_PTZ6, GPIOF_OUT_INIT_LOW, NULL);
+	 /* STBY_CAM */
+	gpio_request_one(GPIO_PTZ5, GPIOF_OUT_INIT_LOW, NULL);
+	 /* RST_CAM */
+	gpio_request_one(GPIO_PTZ4, GPIOF_OUT_INIT_LOW, NULL);/* SADDR */
 
 	__raw_writew(__raw_readw(PORT_MSELCRB) & ~0x0001, PORT_MSELCRB);
 
diff -u -p a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
--- a/arch/sh/boards/mach-ecovec24/setup.c 2011-03-20 18:17:23.000000000 +0100
+++ b/arch/sh/boards/mach-ecovec24/setup.c 2011-03-20 21:01:52.000000000 +0100
@@ -433,8 +433,7 @@ static int ts_get_pendown_state(void)
 {
 	int val = 0;
 	gpio_free(GPIO_FN_INTC_IRQ0);
-	gpio_request(GPIO_PTZ0, NULL);
-	gpio_direction_input(GPIO_PTZ0);
+	gpio_request_one(GPIO_PTZ0, GPIOF_IN, NULL);
 
 	val = gpio_get_value(GPIO_PTZ0);
 
@@ -981,19 +980,14 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_SCIF0_RXD, NULL);
 
 	/* enable debug LED */
-	gpio_request(GPIO_PTG0, NULL);
-	gpio_request(GPIO_PTG1, NULL);
-	gpio_request(GPIO_PTG2, NULL);
-	gpio_request(GPIO_PTG3, NULL);
-	gpio_direction_output(GPIO_PTG0, 0);
-	gpio_direction_output(GPIO_PTG1, 0);
-	gpio_direction_output(GPIO_PTG2, 0);
-	gpio_direction_output(GPIO_PTG3, 0);
+	gpio_request_one(GPIO_PTG0, GPIOF_OUT_INIT_LOW, NULL);
+	gpio_request_one(GPIO_PTG1, GPIOF_OUT_INIT_LOW, NULL);
+	gpio_request_one(GPIO_PTG2, GPIOF_OUT_INIT_LOW, NULL);
+	gpio_request_one(GPIO_PTG3, GPIOF_OUT_INIT_LOW, NULL);
 	__raw_writew((__raw_readw(PORT_HIZA) & ~(0x1 << 1)) , PORT_HIZA);
 
 	/* enable SH-Eth */
-	gpio_request(GPIO_PTA1, NULL);
-	gpio_direction_output(GPIO_PTA1, 1);
+	gpio_request_one(GPIO_PTA1, GPIOF_OUT_INIT_HIGH, NULL);
 	mdelay(20);
 
 	gpio_request(GPIO_FN_RMII_RXD0,    NULL);
@@ -1011,12 +1005,9 @@ static int __init arch_setup(void)
 	/* enable USB */
 	__raw_writew(0x0000, 0xA4D80000);
 	__raw_writew(0x0000, 0xA4D90000);
-	gpio_request(GPIO_PTB3,  NULL);
-	gpio_request(GPIO_PTB4,  NULL);
-	gpio_request(GPIO_PTB5,  NULL);
-	gpio_direction_input(GPIO_PTB3);
-	gpio_direction_output(GPIO_PTB4, 0);
-	gpio_direction_output(GPIO_PTB5, 0);
+	gpio_request_one(GPIO_PTB3, GPIOF_IN, NULL);
+	gpio_request_one(GPIO_PTB4, GPIOF_OUT_INIT_LOW, NULL);
+	gpio_request_one(GPIO_PTB5, GPIOF_OUT_INIT_LOW, NULL);
 	__raw_writew(0x0600, 0xa40501d4);
 	__raw_writew(0x0600, 0xa4050192);
 
@@ -1061,14 +1052,10 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_LCDLCLK,  NULL);
 	__raw_writew((__raw_readw(PORT_HIZA) & ~0x0001), PORT_HIZA);
 
-	gpio_request(GPIO_PTE6, NULL);
-	gpio_request(GPIO_PTU1, NULL);
-	gpio_request(GPIO_PTR1, NULL);
-	gpio_request(GPIO_PTA2, NULL);
-	gpio_direction_input(GPIO_PTE6);
-	gpio_direction_output(GPIO_PTU1, 0);
-	gpio_direction_output(GPIO_PTR1, 0);
-	gpio_direction_output(GPIO_PTA2, 0);
+	gpio_request_one(GPIO_PTE6, GPIOF_IN, NULL);
+	gpio_request_one(GPIO_PTU1, GPIOF_OUT_INIT_LOW, NULL);
+	gpio_request_one(GPIO_PTR1, GPIOF_OUT_INIT_LOW, NULL);
+	gpio_request_one(GPIO_PTA2, GPIOF_OUT_INIT_LOW, NULL);
 
 	/* I/O buffer drive ability is high */
 	__raw_writew((__raw_readw(IODRIVEA) & ~0x00c0) | 0x0080 , IODRIVEA);
@@ -1097,8 +1084,7 @@ static int __init arch_setup(void)
 		 * but current sh_mobile_lcdc driver doesn't control it.
 		 * It is temporary correspondence
 		 */
-		gpio_request(GPIO_PTF4, NULL);
-		gpio_direction_output(GPIO_PTF4, 1);
+		gpio_request_one(GPIO_PTF4, GPIOF_OUT_INIT_HIGH, NULL);
 
 		/* enable TouchScreen */
 		i2c_register_board_info(0, &ts_i2c_clients, 1);
@@ -1153,14 +1139,10 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_KEYIN0,      NULL);
 
 	/* enable user debug switch */
-	gpio_request(GPIO_PTR0, NULL);
-	gpio_request(GPIO_PTR4, NULL);
-	gpio_request(GPIO_PTR5, NULL);
-	gpio_request(GPIO_PTR6, NULL);
-	gpio_direction_input(GPIO_PTR0);
-	gpio_direction_input(GPIO_PTR4);
-	gpio_direction_input(GPIO_PTR5);
-	gpio_direction_input(GPIO_PTR6);
+	gpio_request_one(GPIO_PTR0, GPIOF_IN, NULL);
+	gpio_request_one(GPIO_PTR4, GPIOF_IN, NULL);
+	gpio_request_one(GPIO_PTR5, GPIOF_IN, NULL);
+	gpio_request_one(GPIO_PTR6, GPIOF_IN, NULL);
 
 #ifdef CONFIG_MFD_SH_MOBILE_SDHI
 	/* enable SDHI0 on CN11 (needs DS2.4 set to ON) */
@@ -1172,8 +1154,7 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_SDHI0D2,  NULL);
 	gpio_request(GPIO_FN_SDHI0D1,  NULL);
 	gpio_request(GPIO_FN_SDHI0D0,  NULL);
-	gpio_request(GPIO_PTB6, NULL);
-	gpio_direction_output(GPIO_PTB6, 0);
+	gpio_request_one(GPIO_PTB6, GPIOF_OUT_INIT_LOW, NULL);
 
 #if !defined(CONFIG_MMC_SH_MMCIF)
 	/* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */
@@ -1185,8 +1166,7 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_SDHI1D2,  NULL);
 	gpio_request(GPIO_FN_SDHI1D1,  NULL);
 	gpio_request(GPIO_FN_SDHI1D0,  NULL);
-	gpio_request(GPIO_PTB7, NULL);
-	gpio_direction_output(GPIO_PTB7, 0);
+	gpio_request_one(GPIO_PTB7, GPIOF_OUT_INIT_LOW, NULL);
 
 	/* I/O buffer drive ability is high for SDHI1 */
 	__raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
@@ -1196,27 +1176,21 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_MSIOF0_TXD, NULL);
 	gpio_request(GPIO_FN_MSIOF0_RXD, NULL);
 	gpio_request(GPIO_FN_MSIOF0_TSCK, NULL);
-	gpio_request(GPIO_PTM4, NULL); /* software CS control of TSYNC pin */
-	gpio_direction_output(GPIO_PTM4, 1); /* active low CS */
-	gpio_request(GPIO_PTB6, NULL); /* 3.3V power control */
-	gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */
-	gpio_request(GPIO_PTY6, NULL); /* write protect */
-	gpio_direction_input(GPIO_PTY6);
-	gpio_request(GPIO_PTY7, NULL); /* card detect */
-	gpio_direction_input(GPIO_PTY7);
+	gpio_request_one(GPIO_PTM4, GPIOF_OUT_INIT_HIGH, NULL); /* software CS control of TSYNC pin *//* active low CS */
+	gpio_request_one(GPIO_PTB6, GPIOF_OUT_INIT_LOW, NULL); /* 3.3V power control *//* disable power by default */
+	gpio_request_one(GPIO_PTY6, GPIOF_IN, NULL); /* write protect */
+	
+	gpio_request_one(GPIO_PTY7, GPIOF_IN, NULL);
 
 	spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
 #endif
 
 	/* enable Video */
-	gpio_request(GPIO_PTU2, NULL);
-	gpio_direction_output(GPIO_PTU2, 1);
+	gpio_request_one(GPIO_PTU2, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* enable Camera */
-	gpio_request(GPIO_PTA3, NULL);
-	gpio_request(GPIO_PTA4, NULL);
-	gpio_direction_output(GPIO_PTA3, 0);
-	gpio_direction_output(GPIO_PTA4, 0);
+	gpio_request_one(GPIO_PTA3, GPIOF_OUT_INIT_LOW, NULL);
+	gpio_request_one(GPIO_PTA4, GPIOF_OUT_INIT_LOW, NULL);
 
 	/* enable FSI */
 	gpio_request(GPIO_FN_FSIMCKB,    NULL);
@@ -1245,13 +1219,11 @@ static int __init arch_setup(void)
 		clk_put(clk);
 	}
 
-	gpio_request(GPIO_PTU0, NULL);
-	gpio_direction_output(GPIO_PTU0, 0);
+	gpio_request_one(GPIO_PTU0, GPIOF_OUT_INIT_LOW, NULL);
 	mdelay(20);
 
 	/* enable motion sensor */
-	gpio_request(GPIO_FN_INTC_IRQ1, NULL);
-	gpio_direction_input(GPIO_FN_INTC_IRQ1);
+	gpio_request_one(GPIO_FN_INTC_IRQ1, GPIOF_IN, NULL);
 
 	/* set VPU clock to 166 MHz */
 	clk = clk_get(NULL, "vpu_clk");
@@ -1263,8 +1235,7 @@ static int __init arch_setup(void)
 	/* enable IrDA */
 	gpio_request(GPIO_FN_IRDA_OUT, NULL);
 	gpio_request(GPIO_FN_IRDA_IN,  NULL);
-	gpio_request(GPIO_PTU5, NULL);
-	gpio_direction_output(GPIO_PTU5, 0);
+	gpio_request_one(GPIO_PTU5, GPIOF_OUT_INIT_LOW, NULL);
 
 #if defined(CONFIG_MMC_SH_MMCIF)
 	/* enable MMCIF (needs DS2.6,7 set to OFF,ON) */
@@ -1278,8 +1249,7 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_MMC_D0, NULL);
 	gpio_request(GPIO_FN_MMC_CLK, NULL);
 	gpio_request(GPIO_FN_MMC_CMD, NULL);
-	gpio_request(GPIO_PTB7, NULL);
-	gpio_direction_output(GPIO_PTB7, 0);
+	gpio_request_one(GPIO_PTB7, GPIOF_OUT_INIT_LOW, NULL);
 
 	/* I/O buffer drive ability is high for MMCIF */
 	__raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
@@ -1308,12 +1278,8 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_DV_HSYNC, NULL);
 
 	/* AK8813 power / reset sequence */
-	gpio_request(GPIO_PTG4, NULL);
-	gpio_request(GPIO_PTU3, NULL);
-	/* Reset */
-	gpio_direction_output(GPIO_PTG4, 0);
-	/* Power down */
-	gpio_direction_output(GPIO_PTU3, 1);
+	gpio_request_one(GPIO_PTG4, GPIOF_OUT_INIT_LOW, NULL);
+	gpio_request_one(GPIO_PTU3, GPIOF_OUT_INIT_HIGH, NULL);
 
 	udelay(10);
 
diff -u -p a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
--- a/arch/sh/boards/mach-kfr2r09/setup.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/sh/boards/mach-kfr2r09/setup.c 2011-03-20 21:01:52.000000000 +0100
@@ -500,8 +500,7 @@ static int kfr2r09_usb0_gadget_setup(voi
 {
 	int plugged_in;
 
-	gpio_request(GPIO_PTN4, NULL); /* USB_DET */
-	gpio_direction_input(GPIO_PTN4);
+	gpio_request_one(GPIO_PTN4, GPIOF_IN, NULL); /* USB_DET */
 	plugged_in = gpio_get_value(GPIO_PTN4);
 	if (!plugged_in)
 		return -ENODEV; /* no cable plugged in */
@@ -511,8 +510,7 @@ static int kfr2r09_usb0_gadget_setup(voi
 
 	__raw_writew((__raw_readw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
 	gpio_request(GPIO_FN_PDSTATUS, NULL); /* R-standby disables USB clock */
-	gpio_request(GPIO_PTV6, NULL); /* USBCLK_ON */
-	gpio_direction_output(GPIO_PTV6, 1); /* USBCLK_ON = H */
+	gpio_request_one(GPIO_PTV6, GPIOF_OUT_INIT_HIGH, NULL); /* USBCLK_ON *//* USBCLK_ON = H */
 	msleep(20); /* wait 20ms to let the clock settle */
 	clk_enable(clk_get(NULL, "usb0"));
 	__raw_writew(0x0600, 0xa40501d4);
@@ -539,8 +537,7 @@ static int __init kfr2r09_devices_setup(
 	gpio_request(GPIO_FN_SCIF1_RXD, NULL);
 	gpio_request(GPIO_FN_SCIF1_TXD, NULL);
 	kfr2r09_serial_i2c_setup(); /* ECONTMSK(bit6=L10ONEN) set 1 */
-	gpio_request(GPIO_PTG3, NULL); /* HPON_ON */
-	gpio_direction_output(GPIO_PTG3, 1); /* HPON_ON = H */
+	gpio_request_one(GPIO_PTG3, GPIOF_OUT_INIT_HIGH, NULL); /* HPON_ON *//* HPON_ON = H */
 
 	/* setup NOR flash@CS0 */
 	__raw_writel(0x36db0400, BSC_CS0BCR);
@@ -587,12 +584,11 @@ static int __init kfr2r09_devices_setup(
 	gpio_request(GPIO_FN_LCDRD, NULL); /* LCD_RD/ */
 	gpio_request(GPIO_FN_LCDWR, NULL); /* LCD_WR/ */
 	gpio_request(GPIO_FN_LCDVSYN, NULL); /* LCD_VSYNC */
-	gpio_request(GPIO_PTE4, NULL); /* LCD_RST/ */
-	gpio_direction_output(GPIO_PTE4, 1);
-	gpio_request(GPIO_PTF4, NULL); /* PROTECT/ */
-	gpio_direction_output(GPIO_PTF4, 1);
-	gpio_request(GPIO_PTU0, NULL); /* LEDSTDBY/ */
-	gpio_direction_output(GPIO_PTU0, 1);
+	gpio_request_one(GPIO_PTE4, GPIOF_OUT_INIT_HIGH, NULL); /* LCD_RST/ */
+	
+	gpio_request_one(GPIO_PTF4, GPIOF_OUT_INIT_HIGH, NULL); /* PROTECT/ */
+	
+	gpio_request_one(GPIO_PTU0, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* setup USB function */
 	if (kfr2r09_usb0_gadget_setup() == 0)
diff -u -p a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
--- a/arch/sh/boards/mach-migor/setup.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/sh/boards/mach-migor/setup.c 2011-03-20 21:01:50.000000000 +0100
@@ -538,8 +538,7 @@ static int __init migor_devices_setup(vo
 	/* NAND Flash */
 	gpio_request(GPIO_FN_CS6A_CE2B, NULL);
 	__raw_writel((__raw_readl(BSC_CS6ABCR) & ~0x0600) | 0x0200, BSC_CS6ABCR);
-	gpio_request(GPIO_PTA1, NULL);
-	gpio_direction_input(GPIO_PTA1);
+	gpio_request_one(GPIO_PTA1, GPIOF_IN, NULL);
 
 	/* SDHI */
 	gpio_request(GPIO_FN_SDHICD, NULL);
@@ -576,8 +575,7 @@ static int __init migor_devices_setup(vo
 	gpio_request(GPIO_FN_LCDCS, NULL);
 	gpio_request(GPIO_FN_LCDRD, NULL);
 	gpio_request(GPIO_FN_LCDWR, NULL);
-	gpio_request(GPIO_PTH2, NULL); /* LCD_DON */
-	gpio_direction_output(GPIO_PTH2, 1);
+	gpio_request_one(GPIO_PTH2, GPIOF_OUT_INIT_HIGH, NULL); /* LCD_DON */
 #endif
 #ifdef CONFIG_SH_MIGOR_RTA_WVGA /* LCDC - WVGA - Enable RGB Interface signals */
 	gpio_request(GPIO_FN_LCDD15, NULL);
@@ -621,13 +619,10 @@ static int __init migor_devices_setup(vo
 	gpio_request(GPIO_FN_VIO_D9, NULL);
 	gpio_request(GPIO_FN_VIO_D8, NULL);
 
-	gpio_request(GPIO_PTT3, NULL); /* VIO_RST */
-	gpio_direction_output(GPIO_PTT3, 0);
-	gpio_request(GPIO_PTT2, NULL); /* TV_IN_EN */
-	gpio_direction_output(GPIO_PTT2, 1);
-	gpio_request(GPIO_PTT0, NULL); /* CAM_EN */
+	gpio_request_one(GPIO_PTT3, GPIOF_OUT_INIT_LOW, NULL); /* VIO_RST */
+	gpio_request_one(GPIO_PTT2, GPIOF_OUT_INIT_HIGH, NULL); /* TV_IN_EN */
+	gpio_request_one(GPIO_PTT0, GPIOF_OUT_INIT_LOW, NULL); /* CAM_EN */
 #ifdef CONFIG_SH_MIGOR_RTA_WVGA
-	gpio_direction_output(GPIO_PTT0, 0);
 #else
 	gpio_direction_output(GPIO_PTT0, 1);
 #endif
diff -u -p a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
--- a/arch/sh/boards/mach-se/7724/setup.c 2011-02-02 17:27:37.000000000 +0100
+++ b/arch/sh/boards/mach-se/7724/setup.c 2011-03-20 21:01:50.000000000 +0100
@@ -899,8 +899,7 @@ static int __init devices_setup(void)
 	gpio_request(GPIO_FN_RMII_CRS_DV,  NULL);
 	gpio_request(GPIO_FN_MDIO,         NULL);
 	gpio_request(GPIO_FN_MDC,          NULL);
-	gpio_request(GPIO_PTX5, NULL);
-	gpio_direction_input(GPIO_PTX5);
+	gpio_request_one(GPIO_PTX5, GPIOF_IN, NULL);
 	sh_eth_init();
 
 	if (sw & SW41_B) {
diff -u -p a/arch/xtensa/platforms/s6105/setup.c b/arch/xtensa/platforms/s6105/setup.c
--- a/arch/xtensa/platforms/s6105/setup.c 2009-06-24 21:18:48.000000000 +0200
+++ b/arch/xtensa/platforms/s6105/setup.c 2011-03-20 21:01:53.000000000 +0100
@@ -59,9 +59,8 @@ void __init platform_setup(char **cmdlin
 void __init platform_init(bp_tag_t *first)
 {
 	s6_gpio_init(0);
-	gpio_request(GPIO_LED1_NGREEN, "led1_green");
+	gpio_request_one(GPIO_LED1_NGREEN, GPIOF_OUT_INIT_HIGH, "led1_green");
 	gpio_request(GPIO_LED1_RED, "led1_red");
-	gpio_direction_output(GPIO_LED1_NGREEN, 1);
 }
 
 void platform_heartbeat(void)
diff -u -p a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
--- a/drivers/block/mg_disk.c 2010-08-25 09:45:50.000000000 +0200
+++ b/drivers/block/mg_disk.c 2011-03-20 21:01:53.000000000 +0100
@@ -882,10 +882,9 @@ static int mg_probe(struct platform_devi
 	host->rst = rsc->start;
 
 	/* init rst pin */
-	err = gpio_request(host->rst, MG_RST_PIN);
+	err = gpio_request_one(host->rst, GPIOF_OUT_INIT_HIGH, MG_RST_PIN);
 	if (err)
 		goto probe_err_3;
-	gpio_direction_output(host->rst, 1);
 
 	/* reset out pin */
 	if (!(prv_data->dev_attr & MG_DEV_MASK))
@@ -901,10 +900,9 @@ static int mg_probe(struct platform_devi
 			goto probe_err_3a;
 		}
 		host->rstout = rsc->start;
-		err = gpio_request(host->rstout, MG_RSTOUT_PIN);
+		err = gpio_request_one(host->rstout, GPIOF_IN, MG_RSTOUT_PIN);
 		if (err)
 			goto probe_err_3a;
-		gpio_direction_input(host->rstout);
 	}
 
 	/* disk reset */
diff -u -p a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
--- a/drivers/hwmon/sht15.c 2011-03-20 18:17:23.000000000 +0100
+++ b/drivers/hwmon/sht15.c 2011-03-20 21:01:53.000000000 +0100
@@ -555,12 +555,12 @@ static int __devinit sht15_probe(struct 
 		ret = regulator_register_notifier(data->reg, &data->nb);
 	}
 /* Try requesting the GPIOs */
-	ret = gpio_request(data->pdata->gpio_sck, "SHT15 sck");
+	ret = gpio_request_one(data->pdata->gpio_sck, GPIOF_OUT_INIT_LOW,
+			       "SHT15 sck");
 	if (ret) {
 		dev_err(&pdev->dev, "gpio request failed");
 		goto err_free_data;
 	}
-	gpio_direction_output(data->pdata->gpio_sck, 0);
 	ret = gpio_request(data->pdata->gpio_data, "SHT15 data");
 	if (ret) {
 		dev_err(&pdev->dev, "gpio request failed");
diff -u -p a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
--- a/drivers/input/keyboard/matrix_keypad.c 2010-07-03 18:06:34.000000000 +0200
+++ b/drivers/input/keyboard/matrix_keypad.c 2011-03-20 21:01:51.000000000 +0100
@@ -318,15 +318,14 @@ static int __devinit init_matrix_gpio(st
 	}
 
 	for (i = 0; i < pdata->num_row_gpios; i++) {
-		err = gpio_request(pdata->row_gpios[i], "matrix_kbd_row");
+		err = gpio_request_one(pdata->row_gpios[i], GPIOF_IN,
+				       "matrix_kbd_row");
 		if (err) {
 			dev_err(&pdev->dev,
 				"failed to request GPIO%d for ROW%d\n",
 				pdata->row_gpios[i], i);
 			goto err_free_rows;
 		}
-
-		gpio_direction_input(pdata->row_gpios[i]);
 	}
 
 	if (pdata->clustered_irq > 0) {
diff -u -p a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
--- a/drivers/input/keyboard/omap-keypad.c 2010-12-28 18:26:03.000000000 +0100
+++ b/drivers/input/keyboard/omap-keypad.c 2011-03-20 21:01:50.000000000 +0100
@@ -336,23 +336,24 @@ static int __devinit omap_kp_probe(struc
 	if (cpu_is_omap24xx()) {
 		/* Cols: outputs */
 		for (col_idx = 0; col_idx < omap_kp->cols; col_idx++) {
-			if (gpio_request(col_gpios[col_idx], "omap_kp_col") < 0) {
+			if (gpio_request_one(col_gpios[col_idx],
+					     GPIOF_OUT_INIT_LOW,
+					     "omap_kp_col") < 0) {
 				printk(KERN_ERR "Failed to request"
 				       "GPIO%d for keypad\n",
 				       col_gpios[col_idx]);
 				goto err1;
 			}
-			gpio_direction_output(col_gpios[col_idx], 0);
 		}
 		/* Rows: inputs */
 		for (row_idx = 0; row_idx < omap_kp->rows; row_idx++) {
-			if (gpio_request(row_gpios[row_idx], "omap_kp_row") < 0) {
+			if (gpio_request_one(row_gpios[row_idx], GPIOF_IN,
+					     "omap_kp_row") < 0) {
 				printk(KERN_ERR "Failed to request"
 				       "GPIO%d for keypad\n",
 				       row_gpios[row_idx]);
 				goto err2;
 			}
-			gpio_direction_input(row_gpios[row_idx]);
 		}
 	} else {
 		col_idx = 0;
diff -u -p a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c
--- a/drivers/input/mouse/gpio_mouse.c 2009-07-12 20:48:31.000000000 +0200
+++ b/drivers/input/mouse/gpio_mouse.c 2011-03-20 21:01:50.000000000 +0100
@@ -83,14 +83,12 @@ static int __devinit gpio_mouse_probe(st
 				dev_dbg(&pdev->dev, "no left button defined\n");
 
 		} else {
-			error = gpio_request(pin, "gpio_mouse");
+			error = gpio_request_one(pin, GPIOF_IN, "gpio_mouse");
 			if (error) {
 				dev_err(&pdev->dev, "fail %d pin (%d idx)\n",
 					pin, i);
 				goto out_free_gpios;
 			}
-
-			gpio_direction_input(pin);
 		}
 	}
 
diff -u -p a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
--- a/drivers/input/serio/ams_delta_serio.c 2010-11-24 07:55:11.000000000 +0100
+++ b/drivers/input/serio/ams_delta_serio.c 2011-03-20 21:01:50.000000000 +0100
@@ -122,19 +122,19 @@ static int __init ams_delta_serio_init(v
 	strlcpy(ams_delta_serio->phys, "GPIO/serio0",
 			sizeof(ams_delta_serio->phys));
 
-	err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, "serio-data");
+	err = gpio_request_one(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, GPIOF_IN,
+			       "serio-data");
 	if (err) {
 		pr_err("ams_delta_serio: Couldn't request gpio pin for data\n");
 		goto serio;
 	}
-	gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
 
-	err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, "serio-clock");
+	err = gpio_request_one(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, GPIOF_IN,
+			       "serio-clock");
 	if (err) {
 		pr_err("ams_delta_serio: couldn't request gpio pin for clock\n");
 		goto gpio_data;
 	}
-	gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
 
 	err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
 			ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
diff -u -p a/drivers/leds/leds-bd2802.c b/drivers/leds/leds-bd2802.c
--- a/drivers/leds/leds-bd2802.c 2010-08-06 00:40:23.000000000 +0200
+++ b/drivers/leds/leds-bd2802.c 2011-03-20 21:01:50.000000000 +0100
@@ -697,8 +697,7 @@ static int __devinit bd2802_probe(struct
 	i2c_set_clientdata(client, led);
 
 	/* Configure RESET GPIO (L: RESET, H: RESET cancel) */
-	gpio_request(pdata->reset_gpio, "RGB_RESETB");
-	gpio_direction_output(pdata->reset_gpio, 1);
+	gpio_request_one(pdata->reset_gpio, GPIOF_OUT_INIT_HIGH, "RGB_RESETB");
 
 	/* Tacss = min 0.1ms */
 	udelay(100);
diff -u -p a/drivers/media/video/via-camera.c b/drivers/media/video/via-camera.c
--- a/drivers/media/video/via-camera.c 2011-03-14 17:19:15.000000000 +0100
+++ b/drivers/media/video/via-camera.c 2011-03-20 21:01:50.000000000 +0100
@@ -194,19 +194,19 @@ static int via_sensor_power_setup(struct
 		dev_err(&cam->platdev->dev, "Unable to find GPIO lines\n");
 		return -EINVAL;
 	}
-	ret = gpio_request(cam->power_gpio, "viafb-camera");
+	ret = gpio_request_one(cam->power_gpio, GPIOF_OUT_INIT_LOW,
+			       "viafb-camera");
 	if (ret) {
 		dev_err(&cam->platdev->dev, "Unable to request power GPIO\n");
 		return ret;
 	}
-	ret = gpio_request(cam->reset_gpio, "viafb-camera");
+	ret = gpio_request_one(cam->reset_gpio, GPIOF_OUT_INIT_LOW,
+			       "viafb-camera");
 	if (ret) {
 		dev_err(&cam->platdev->dev, "Unable to request reset GPIO\n");
 		gpio_free(cam->power_gpio);
 		return ret;
 	}
-	gpio_direction_output(cam->power_gpio, 0);
-	gpio_direction_output(cam->reset_gpio, 0);
 	return 0;
 }
 
diff -u -p a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c
--- a/drivers/mfd/dm355evm_msp.c 2009-09-19 08:25:19.000000000 +0200
+++ b/drivers/mfd/dm355evm_msp.c 2011-03-20 21:01:51.000000000 +0100
@@ -307,8 +307,7 @@ static int add_children(struct i2c_clien
 	for (i = 0; i < ARRAY_SIZE(config_inputs); i++) {
 		int gpio = dm355evm_msp_gpio.base + config_inputs[i].offset;
 
-		gpio_request(gpio, config_inputs[i].label);
-		gpio_direction_input(gpio);
+		gpio_request_one(gpio, GPIOF_IN, config_inputs[i].label);
 
 		/* make it easy for userspace to see these */
 		gpio_export(gpio, false);
diff -u -p a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
--- a/drivers/mfd/omap-usb-host.c 2011-03-14 17:19:15.000000000 +0100
+++ b/drivers/mfd/omap-usb-host.c 2011-03-20 21:01:51.000000000 +0100
@@ -716,17 +716,15 @@ static int usbhs_enable(struct device *d
 
 	if (pdata->ehci_data->phy_reset) {
 		if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) {
-			gpio_request(pdata->ehci_data->reset_gpio_port[0],
-						"USB1 PHY reset");
-			gpio_direction_output
-				(pdata->ehci_data->reset_gpio_port[0], 1);
+			gpio_request_one(pdata->ehci_data->reset_gpio_port[0],
+					 GPIOF_OUT_INIT_HIGH,
+					 "USB1 PHY reset");
 		}
 
 		if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) {
-			gpio_request(pdata->ehci_data->reset_gpio_port[1],
-						"USB2 PHY reset");
-			gpio_direction_output
-				(pdata->ehci_data->reset_gpio_port[1], 1);
+			gpio_request_one(pdata->ehci_data->reset_gpio_port[1],
+					 GPIOF_OUT_INIT_HIGH,
+					 "USB2 PHY reset");
 		}
 
 		/* Hold the PHY in RESET for enough time till DIR is high */
diff -u -p a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
--- a/drivers/mmc/host/pxamci.c 2010-09-30 17:54:15.000000000 +0200
+++ b/drivers/mmc/host/pxamci.c 2011-03-20 21:01:51.000000000 +0100
@@ -719,20 +719,19 @@ static int pxamci_probe(struct platform_
 				      host->pdata->gpio_power_invert);
 	}
 	if (gpio_is_valid(gpio_ro)) {
-		ret = gpio_request(gpio_ro, "mmc card read only");
+		ret = gpio_request_one(gpio_ro, GPIOF_IN,
+				       "mmc card read only");
 		if (ret) {
 			dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_ro);
 			goto err_gpio_ro;
 		}
-		gpio_direction_input(gpio_ro);
 	}
 	if (gpio_is_valid(gpio_cd)) {
-		ret = gpio_request(gpio_cd, "mmc card detect");
+		ret = gpio_request_one(gpio_cd, GPIOF_IN, "mmc card detect");
 		if (ret) {
 			dev_err(&pdev->dev, "Failed requesting gpio_cd %d\n", gpio_cd);
 			goto err_gpio_cd;
 		}
-		gpio_direction_input(gpio_cd);
 
 		ret = request_irq(gpio_to_irq(gpio_cd), pxamci_detect_irq,
 				  IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
diff -u -p a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c
--- a/drivers/mmc/host/s3cmci.c 2010-09-18 08:59:06.000000000 +0200
+++ b/drivers/mmc/host/s3cmci.c 2011-03-20 21:01:54.000000000 +0100
@@ -1676,13 +1676,12 @@ static int __devinit s3cmci_probe(struct
 		host->irq_cd = -1;
 
 	if (!host->pdata->no_wprotect) {
-		ret = gpio_request(host->pdata->gpio_wprotect, "s3cmci wp");
+		ret = gpio_request_one(host->pdata->gpio_wprotect, GPIOF_IN,
+				       "s3cmci wp");
 		if (ret) {
 			dev_err(&pdev->dev, "failed to get writeprotect\n");
 			goto probe_free_irq_cd;
 		}
-
-		gpio_direction_input(host->pdata->gpio_wprotect);
 	}
 
 	/* depending on the dma state, get a dma channel to use. */
diff -u -p a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c
--- a/drivers/mtd/maps/bfin-async-flash.c 2010-03-29 19:27:56.000000000 +0200
+++ b/drivers/mtd/maps/bfin-async-flash.c 2011-03-20 21:01:54.000000000 +0100
@@ -154,12 +154,12 @@ static int __devinit bfin_flash_probe(st
 	state->flash_ambctl0  = flash_ambctl->start;
 	state->flash_ambctl1  = flash_ambctl->end;
 
-	if (gpio_request(state->enet_flash_pin, DRIVER_NAME)) {
+	if (gpio_request_one(state->enet_flash_pin, GPIOF_OUT_INIT_HIGH,
+			     DRIVER_NAME)) {
 		pr_devinit(KERN_ERR DRIVER_NAME ": Failed to request gpio %d\n", state->enet_flash_pin);
 		kfree(state);
 		return -EBUSY;
 	}
-	gpio_direction_output(state->enet_flash_pin, 1);
 
 	pr_devinit(KERN_NOTICE DRIVER_NAME ": probing %d-bit flash bus\n", state->map.bankwidth * 8);
 	state->mtd = do_map_probe(memory->name, &state->map);
diff -u -p a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c
--- a/drivers/mtd/maps/gpio-addr-flash.c 2010-11-01 20:33:30.000000000 +0100
+++ b/drivers/mtd/maps/gpio-addr-flash.c 2011-03-20 21:01:54.000000000 +0100
@@ -233,7 +233,8 @@ static int __devinit gpio_flash_probe(st
 
 	i = 0;
 	do {
-		if (gpio_request(state->gpio_addrs[i], DRIVER_NAME)) {
+		if (gpio_request_one(state->gpio_addrs[i],
+				     GPIOF_OUT_INIT_LOW, DRIVER_NAME)) {
 			pr_devinit(KERN_ERR PFX "failed to request gpio %d\n",
 				state->gpio_addrs[i]);
 			while (i--)
@@ -241,7 +242,6 @@ static int __devinit gpio_flash_probe(st
 			kfree(state);
 			return -EBUSY;
 		}
-		gpio_direction_output(state->gpio_addrs[i], 0);
 	} while (++i < state->gpio_count);
 
 	pr_devinit(KERN_NOTICE PFX "probing %d-bit flash bus\n",
diff -u -p a/drivers/mtd/nand/cmx270_nand.c b/drivers/mtd/nand/cmx270_nand.c
--- a/drivers/mtd/nand/cmx270_nand.c 2010-03-29 19:27:56.000000000 +0200
+++ b/drivers/mtd/nand/cmx270_nand.c 2011-03-20 21:01:54.000000000 +0100
@@ -159,22 +159,18 @@ static int __init cmx270_init(void)
 	if (!(machine_is_armcore() && cpu_is_pxa27x()))
 		return -ENODEV;
 
-	ret = gpio_request(GPIO_NAND_CS, "NAND CS");
+	ret = gpio_request_one(GPIO_NAND_CS, GPIOF_OUT_INIT_HIGH, "NAND CS");
 	if (ret) {
 		pr_warning("CM-X270: failed to request NAND CS gpio\n");
 		return ret;
 	}
 
-	gpio_direction_output(GPIO_NAND_CS, 1);
-
-	ret = gpio_request(GPIO_NAND_RB, "NAND R/B");
+	ret = gpio_request_one(GPIO_NAND_RB, GPIOF_IN, "NAND R/B");
 	if (ret) {
 		pr_warning("CM-X270: failed to request NAND R/B gpio\n");
 		goto err_gpio_request;
 	}
 
-	gpio_direction_input(GPIO_NAND_RB);
-
 	/* Allocate memory for MTD device structure and private data */
 	cmx270_nand_mtd = kzalloc(sizeof(struct mtd_info) +
 				  sizeof(struct nand_chip),
diff -u -p a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
--- a/drivers/mtd/nand/fsl_upm.c 2011-03-14 17:19:15.000000000 +0100
+++ b/drivers/mtd/nand/fsl_upm.c 2011-03-20 21:01:54.000000000 +0100
@@ -278,13 +278,13 @@ static int __devinit fun_probe(struct pl
 		fun->rnb_gpio[i] = -1;
 		rnb_gpio = of_get_gpio(ofdev->dev.of_node, i);
 		if (rnb_gpio >= 0) {
-			ret = gpio_request(rnb_gpio, dev_name(&ofdev->dev));
+			ret = gpio_request_one(rnb_gpio, GPIOF_IN,
+					       dev_name(&ofdev->dev));
 			if (ret) {
 				dev_err(&ofdev->dev,
 					"can't request RNB gpio #%d\n", i);
 				goto err2;
 			}
-			gpio_direction_input(rnb_gpio);
 			fun->rnb_gpio[i] = rnb_gpio;
 		} else if (rnb_gpio == -EINVAL) {
 			dev_err(&ofdev->dev, "RNB gpio #%d is invalid\n", i);
diff -u -p a/drivers/mtd/nand/gpio.c b/drivers/mtd/nand/gpio.c
--- a/drivers/mtd/nand/gpio.c 2010-01-03 21:18:12.000000000 +0100
+++ b/drivers/mtd/nand/gpio.c 2011-03-20 21:01:53.000000000 +0100
@@ -259,28 +259,27 @@ static int __devinit gpio_nand_probe(str
 
 	memcpy(&gpiomtd->plat, dev->dev.platform_data, sizeof(gpiomtd->plat));
 
-	ret = gpio_request(gpiomtd->plat.gpio_nce, "NAND NCE");
+	ret = gpio_request_one(gpiomtd->plat.gpio_nce, GPIOF_OUT_INIT_HIGH,
+			       "NAND NCE");
 	if (ret)
 		goto err_nce;
-	gpio_direction_output(gpiomtd->plat.gpio_nce, 1);
 	if (gpio_is_valid(gpiomtd->plat.gpio_nwp)) {
-		ret = gpio_request(gpiomtd->plat.gpio_nwp, "NAND NWP");
+		ret = gpio_request_one(gpiomtd->plat.gpio_nwp,
+				       GPIOF_OUT_INIT_HIGH, "NAND NWP");
 		if (ret)
 			goto err_nwp;
-		gpio_direction_output(gpiomtd->plat.gpio_nwp, 1);
 	}
-	ret = gpio_request(gpiomtd->plat.gpio_ale, "NAND ALE");
+	ret = gpio_request_one(gpiomtd->plat.gpio_ale, GPIOF_OUT_INIT_LOW,
+			       "NAND ALE");
 	if (ret)
 		goto err_ale;
-	gpio_direction_output(gpiomtd->plat.gpio_ale, 0);
-	ret = gpio_request(gpiomtd->plat.gpio_cle, "NAND CLE");
+	ret = gpio_request_one(gpiomtd->plat.gpio_cle, GPIOF_OUT_INIT_LOW,
+			       "NAND CLE");
 	if (ret)
 		goto err_cle;
-	gpio_direction_output(gpiomtd->plat.gpio_cle, 0);
-	ret = gpio_request(gpiomtd->plat.gpio_rdy, "NAND RDY");
+	ret = gpio_request_one(gpiomtd->plat.gpio_rdy, GPIOF_IN, "NAND RDY");
 	if (ret)
 		goto err_rdy;
-	gpio_direction_input(gpiomtd->plat.gpio_rdy);
 
 
 	this->IO_ADDR_W  = this->IO_ADDR_R;
diff -u -p a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
--- a/drivers/mtd/onenand/omap2.c 2011-03-14 17:19:15.000000000 +0100
+++ b/drivers/mtd/onenand/omap2.c 2011-03-20 21:01:54.000000000 +0100
@@ -682,12 +682,12 @@ static int __devinit omap2_onenand_probe
 	}
 
 	if (c->gpio_irq) {
-		if ((r = gpio_request(c->gpio_irq, "OneNAND irq")) < 0) {
+		if ((r = gpio_request_one(c->gpio_irq, GPIOF_IN,
+					  "OneNAND irq")) < 0) {
 			dev_err(&pdev->dev,  "Failed to request GPIO%d for "
 				"OneNAND\n", c->gpio_irq);
 			goto err_iounmap;
 	}
-	gpio_direction_input(c->gpio_irq);
 
 	if ((r = request_irq(gpio_to_irq(c->gpio_irq),
 			     omap2_onenand_interrupt, IRQF_TRIGGER_RISING,
diff -u -p a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
--- a/drivers/net/phy/mdio-gpio.c 2011-03-14 17:19:16.000000000 +0100
+++ b/drivers/net/phy/mdio-gpio.c 2011-03-20 21:01:52.000000000 +0100
@@ -117,14 +117,12 @@ static struct mii_bus * __devinit mdio_g
 
 	snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", bus_id);
 
-	if (gpio_request(bitbang->mdc, "mdc"))
+	if (gpio_request_one(bitbang->mdc, GPIOF_OUT_INIT_LOW, "mdc"))
 		goto out_free_bus;
 
 	if (gpio_request(bitbang->mdio, "mdio"))
 		goto out_free_mdc;
 
-	gpio_direction_output(bitbang->mdc, 0);
-
 	dev_set_drvdata(dev, new_bus);
 
 	return new_bus;
diff -u -p a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
--- a/drivers/net/wireless/p54/p54spi.c 2010-09-18 08:59:06.000000000 +0200
+++ b/drivers/net/wireless/p54/p54spi.c 2011-03-20 21:01:52.000000000 +0100
@@ -626,21 +626,19 @@ static int __devinit p54spi_probe(struct
 		goto err_free_common;
 	}
 
-	ret = gpio_request(p54spi_gpio_power, "p54spi power");
+	ret = gpio_request_one(p54spi_gpio_power, GPIOF_OUT_INIT_LOW,
+			       "p54spi power");
 	if (ret < 0) {
 		dev_err(&priv->spi->dev, "power GPIO request failed: %d", ret);
 		goto err_free_common;
 	}
 
-	ret = gpio_request(p54spi_gpio_irq, "p54spi irq");
+	ret = gpio_request_one(p54spi_gpio_irq, GPIOF_IN, "p54spi irq");
 	if (ret < 0) {
 		dev_err(&priv->spi->dev, "irq GPIO request failed: %d", ret);
 		goto err_free_common;
 	}
 
-	gpio_direction_output(p54spi_gpio_power, 0);
-	gpio_direction_input(p54spi_gpio_irq);
-
 	ret = request_irq(gpio_to_irq(p54spi_gpio_irq),
 			  p54spi_interrupt, IRQF_DISABLED, "p54spi",
 			  priv->spi);
diff -u -p a/drivers/pcmcia/bfin_cf_pcmcia.c b/drivers/pcmcia/bfin_cf_pcmcia.c
--- a/drivers/pcmcia/bfin_cf_pcmcia.c 2010-03-29 19:27:57.000000000 +0200
+++ b/drivers/pcmcia/bfin_cf_pcmcia.c 2011-03-20 21:01:55.000000000 +0100
@@ -211,13 +211,12 @@ static int __devinit bfin_cf_probe(struc
 
 	cd_pfx = platform_get_irq(pdev, 1);	/*Card Detect GPIO PIN */
 
-	if (gpio_request(cd_pfx, "pcmcia: CD")) {
+	if (gpio_request_one(cd_pfx, GPIOF_IN, "pcmcia: CD")) {
 		dev_err(&pdev->dev,
 		       "Failed ro request Card Detect GPIO_%d\n",
 		       cd_pfx);
 		return -EBUSY;
 	}
-	gpio_direction_input(cd_pfx);
 
 	cf = kzalloc(sizeof *cf, GFP_KERNEL);
 	if (!cf) {
diff -u -p a/drivers/pcmcia/pxa2xx_cm_x255.c b/drivers/pcmcia/pxa2xx_cm_x255.c
--- a/drivers/pcmcia/pxa2xx_cm_x255.c 2009-11-08 21:45:05.000000000 +0100
+++ b/drivers/pcmcia/pxa2xx_cm_x255.c 2011-03-20 21:01:55.000000000 +0100
@@ -39,10 +39,10 @@ static struct pcmcia_irqs irqs[] = {
 
 static int cmx255_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
-	int ret = gpio_request(GPIO_PCMCIA_RESET, "PCCard reset");
+	int ret = gpio_request_one(GPIO_PCMCIA_RESET, GPIOF_OUT_INIT_LOW,
+				   "PCCard reset");
 	if (ret)
 		return ret;
-	gpio_direction_output(GPIO_PCMCIA_RESET, 0);
 
 	skt->socket.pci_irq = skt->nr == 0 ? PCMCIA_S0_RDYINT : PCMCIA_S1_RDYINT;
 	ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
diff -u -p a/drivers/pcmcia/pxa2xx_cm_x270.c b/drivers/pcmcia/pxa2xx_cm_x270.c
--- a/drivers/pcmcia/pxa2xx_cm_x270.c 2009-11-08 21:45:05.000000000 +0100
+++ b/drivers/pcmcia/pxa2xx_cm_x270.c 2011-03-20 21:01:55.000000000 +0100
@@ -33,10 +33,10 @@ static struct pcmcia_irqs irqs[] = {
 
 static int cmx270_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
-	int ret = gpio_request(GPIO_PCMCIA_RESET, "PCCard reset");
+	int ret = gpio_request_one(GPIO_PCMCIA_RESET, GPIOF_OUT_INIT_LOW,
+				   "PCCard reset");
 	if (ret)
 		return ret;
-	gpio_direction_output(GPIO_PCMCIA_RESET, 0);
 
 	skt->socket.pci_irq = PCMCIA_S0_RDYINT;
 	ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
diff -u -p a/drivers/pcmcia/pxa2xx_stargate2.c b/drivers/pcmcia/pxa2xx_stargate2.c
--- a/drivers/pcmcia/pxa2xx_stargate2.c 2009-12-17 08:30:14.000000000 +0100
+++ b/drivers/pcmcia/pxa2xx_stargate2.c 2011-03-20 21:01:55.000000000 +0100
@@ -122,19 +122,18 @@ static int __init sg2_pcmcia_init(void)
 	if (!sg2_pcmcia_device)
 		return -ENOMEM;
 
-	ret = gpio_request(SG2_S0_BUFF_CTL, "SG2 CF buff ctl");
+	ret = gpio_request_one(SG2_S0_BUFF_CTL, GPIOF_OUT_INIT_LOW,
+			       "SG2 CF buff ctl");
 	if (ret)
 		goto error_put_platform_device;
-	ret = gpio_request(SG2_S0_POWER_CTL, "SG2 CF power ctl");
+	ret = gpio_request_one(SG2_S0_POWER_CTL, GPIOF_OUT_INIT_HIGH,
+			       "SG2 CF power ctl");
 	if (ret)
 		goto error_free_gpio_buff_ctl;
-	ret = gpio_request(SG2_S0_GPIO_RESET, "SG2 CF reset");
+	ret = gpio_request_one(SG2_S0_GPIO_RESET, GPIOF_OUT_INIT_HIGH,
+			       "SG2 CF reset");
 	if (ret)
 		goto error_free_gpio_power_ctl;
-	/* Set gpio directions */
-	gpio_direction_output(SG2_S0_BUFF_CTL, 0);
-	gpio_direction_output(SG2_S0_POWER_CTL, 1);
-	gpio_direction_output(SG2_S0_GPIO_RESET, 1);
 
 	ret = platform_device_add_data(sg2_pcmcia_device,
 				       &sg2_pcmcia_ops,
diff -u -p a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c
--- a/drivers/rtc/rtc-v3020.c 2010-03-29 19:27:57.000000000 +0200
+++ b/drivers/rtc/rtc-v3020.c 2011-03-20 21:01:52.000000000 +0100
@@ -125,11 +125,11 @@ static int v3020_gpio_map(struct v3020 *
 	v3020_gpio[V3020_IO].gpio = pdata->gpio_io;
 
 	for (i = 0; i < ARRAY_SIZE(v3020_gpio); i++) {
-		err = gpio_request(v3020_gpio[i].gpio, v3020_gpio[i].name);
+		err = gpio_request_one(v3020_gpio[i].gpio,
+				       GPIOF_OUT_INIT_HIGH,
+				       v3020_gpio[i].name);
 		if (err)
 			goto err_request;
-
-		gpio_direction_output(v3020_gpio[i].gpio, 1);
 	}
 
 	chip->gpio = v3020_gpio;
diff -u -p a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c
--- a/drivers/spi/mpc52xx_spi.c 2011-03-14 17:19:16.000000000 +0100
+++ b/drivers/spi/mpc52xx_spi.c 2011-03-20 21:01:52.000000000 +0100
@@ -468,7 +468,8 @@ static int __devinit mpc52xx_spi_probe(s
 				goto err_gpio;
 			}
 
-			rc = gpio_request(gpio_cs, dev_name(&op->dev));
+			rc = gpio_request_one(gpio_cs, GPIOF_OUT_INIT_HIGH,
+					      dev_name(&op->dev));
 			if (rc) {
 				dev_err(&op->dev,
 					"can't request spi cs gpio #%d "
@@ -476,7 +477,6 @@ static int __devinit mpc52xx_spi_probe(s
 				goto err_gpio;
 			}
 
-			gpio_direction_output(gpio_cs, 1);
 			ms->gpio_cs[i] = gpio_cs;
 		}
 	} else {
diff -u -p a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
--- a/drivers/spi/spi_bfin5xx.c 2011-02-19 08:28:52.000000000 +0100
+++ b/drivers/spi/spi_bfin5xx.c 2011-03-20 21:01:50.000000000 +0100
@@ -1150,12 +1150,13 @@ static int bfin_spi_setup(struct spi_dev
 	if (chip->chip_select_num >= MAX_CTRL_CS) {
 		/* Only request on first setup */
 		if (spi_get_ctldata(spi) == NULL) {
-			ret = gpio_request(chip->cs_gpio, spi->modalias);
+			ret = gpio_request_one(chip->cs_gpio,
+					       GPIOF_OUT_INIT_HIGH,
+					       spi->modalias);
 			if (ret) {
 				dev_err(&spi->dev, "gpio_request() error\n");
 				goto pin_error;
 			}
-			gpio_direction_output(chip->cs_gpio, 1);
 		}
 	}
 
diff -u -p a/drivers/spi/spi_oc_tiny.c b/drivers/spi/spi_oc_tiny.c
--- a/drivers/spi/spi_oc_tiny.c 2011-02-26 13:17:47.000000000 +0100
+++ b/drivers/spi/spi_oc_tiny.c 2011-03-20 21:01:51.000000000 +0100
@@ -346,10 +346,10 @@ static int __devinit tiny_spi_probe(stru
 			goto exit;
 	}
 	for (i = 0; i < hw->gpio_cs_count; i++) {
-		err = gpio_request(hw->gpio_cs[i], dev_name(&pdev->dev));
+		err = gpio_request_one(hw->gpio_cs[i], GPIOF_OUT_INIT_HIGH,
+				       dev_name(&pdev->dev));
 		if (err)
 			goto exit_gpio;
-		gpio_direction_output(hw->gpio_cs[i], 1);
 	}
 	hw->bitbang.master->num_chipselect = max(1U, hw->gpio_cs_count);
 
diff -u -p a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
--- a/drivers/spi/spi_s3c24xx.c 2010-03-29 19:27:58.000000000 +0200
+++ b/drivers/spi/spi_s3c24xx.c 2011-03-20 21:01:52.000000000 +0100
@@ -614,14 +614,14 @@ static int __init s3c24xx_spi_probe(stru
 			goto err_register;
 		}
 
-		err = gpio_request(pdata->pin_cs, dev_name(&pdev->dev));
+		err = gpio_request_one(pdata->pin_cs, GPIOF_OUT_INIT_HIGH,
+				       dev_name(&pdev->dev));
 		if (err) {
 			dev_err(&pdev->dev, "Failed to get gpio for cs\n");
 			goto err_register;
 		}
 
 		hw->set_cs = s3c24xx_spi_gpiocs;
-		gpio_direction_output(pdata->pin_cs, 1);
 	} else
 		hw->set_cs = pdata->set_cs;
 
diff -u -p a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
--- a/drivers/staging/iio/adc/ad7816.c 2010-11-13 10:26:39.000000000 +0100
+++ b/drivers/staging/iio/adc/ad7816.c 2011-03-20 21:01:52.000000000 +0100
@@ -396,27 +396,24 @@ static int __devinit ad7816_probe(struct
 	chip->convert_pin = pins[1];
 	chip->busy_pin = pins[2];
 
-	ret = gpio_request(chip->rdwr_pin, chip->name);
+	ret = gpio_request_one(chip->rdwr_pin, GPIOF_IN, chip->name);
 	if (ret) {
 		dev_err(&spi_dev->dev, "Fail to request rdwr gpio PIN %d.\n",
 			chip->rdwr_pin);
 		goto error_free_chip;
 	}
-	gpio_direction_input(chip->rdwr_pin);
-	ret = gpio_request(chip->convert_pin, chip->name);
+	ret = gpio_request_one(chip->convert_pin, GPIOF_IN, chip->name);
 	if (ret) {
 		dev_err(&spi_dev->dev, "Fail to request convert gpio PIN %d.\n",
 			chip->convert_pin);
 		goto error_free_gpio_rdwr;
 	}
-	gpio_direction_input(chip->convert_pin);
-	ret = gpio_request(chip->busy_pin, chip->name);
+	ret = gpio_request_one(chip->busy_pin, GPIOF_IN, chip->name);
 	if (ret) {
 		dev_err(&spi_dev->dev, "Fail to request busy gpio PIN %d.\n",
 			chip->busy_pin);
 		goto error_free_gpio_convert;
 	}
-	gpio_direction_input(chip->busy_pin);
 
 	chip->indio_dev = iio_allocate_device();
 	if (chip->indio_dev == NULL) {
diff -u -p a/drivers/staging/iio/resolver/ad2s120x.c b/drivers/staging/iio/resolver/ad2s120x.c
--- a/drivers/staging/iio/resolver/ad2s120x.c 2010-11-13 10:26:39.000000000 +0100
+++ b/drivers/staging/iio/resolver/ad2s120x.c 2011-03-20 21:01:53.000000000 +0100
@@ -220,12 +220,11 @@ static int __devinit ad2s120x_probe(stru
 	unsigned short *pins = spi->dev.platform_data;
 
 	for (pn = 0; pn < AD2S120X_PN; pn++) {
-		if (gpio_request(pins[pn], DRV_NAME)) {
+		if (gpio_request_one(pins[pn], GPIOF_OUT_INIT_HIGH, DRV_NAME)) {
 			pr_err("%s: request gpio pin %d failed\n",
 						DRV_NAME, pins[pn]);
 			goto error_ret;
 		}
-		gpio_direction_output(pins[pn], 1);
 	}
 
 	st = kzalloc(sizeof(*st), GFP_KERNEL);
diff -u -p a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
--- a/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c 2011-02-26 13:17:47.000000000 +0100
+++ b/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c 2011-03-20 21:01:53.000000000 +0100
@@ -20,11 +20,11 @@ static int dcon_init_xo_1(struct dcon_pr
 {
 	unsigned char lob;
 
-	if (gpio_request(OLPC_GPIO_DCON_STAT0, "OLPC-DCON")) {
+	if (gpio_request_one(OLPC_GPIO_DCON_STAT0, GPIOF_IN, "OLPC-DCON")) {
 		printk(KERN_ERR "olpc-dcon: failed to request STAT0 GPIO\n");
 		return -EIO;
 	}
-	if (gpio_request(OLPC_GPIO_DCON_STAT1, "OLPC-DCON")) {
+	if (gpio_request_one(OLPC_GPIO_DCON_STAT1, GPIOF_IN, "OLPC-DCON")) {
 		printk(KERN_ERR "olpc-dcon: failed to request STAT1 GPIO\n");
 		goto err_gp_stat1;
 	}
@@ -36,7 +36,7 @@ static int dcon_init_xo_1(struct dcon_pr
 		printk(KERN_ERR "olpc-dcon: failed to request LOAD GPIO\n");
 		goto err_gp_load;
 	}
-	if (gpio_request(OLPC_GPIO_DCON_BLANK, "OLPC-DCON")) {
+	if (gpio_request_one(OLPC_GPIO_DCON_BLANK, GPIOF_IN, "OLPC-DCON")) {
 		printk(KERN_ERR "olpc-dcon: failed to request BLANK GPIO\n");
 		goto err_gp_blank;
 	}
@@ -60,10 +60,7 @@ static int dcon_init_xo_1(struct dcon_pr
 	dcon->pending_src = dcon->curr_src;
 
 	/* Set the directions for the GPIO pins */
-	gpio_direction_input(OLPC_GPIO_DCON_STAT0);
-	gpio_direction_input(OLPC_GPIO_DCON_STAT1);
 	gpio_direction_input(OLPC_GPIO_DCON_IRQ);
-	gpio_direction_input(OLPC_GPIO_DCON_BLANK);
 	gpio_direction_output(OLPC_GPIO_DCON_LOAD,
 			dcon->curr_src == DCON_SOURCE_CPU);
 
diff -u -p a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
--- a/drivers/usb/gadget/at91_udc.c 2011-02-19 08:28:52.000000000 +0100
+++ b/drivers/usb/gadget/at91_udc.c 2011-03-20 21:01:54.000000000 +0100
@@ -1820,12 +1820,12 @@ static int __init at91udc_probe(struct p
 		goto fail1;
 	}
 	if (udc->board.vbus_pin > 0) {
-		retval = gpio_request(udc->board.vbus_pin, "udc_vbus");
+		retval = gpio_request_one(udc->board.vbus_pin, GPIOF_IN,
+					  "udc_vbus");
 		if (retval < 0) {
 			DBG("request vbus pin failed\n");
 			goto fail2;
 		}
-		gpio_direction_input(udc->board.vbus_pin);
 
 		/*
 		 * Get the initial state of VBUS - we cannot expect
diff -u -p a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
--- a/drivers/usb/gadget/pxa25x_udc.c 2010-09-04 09:22:05.000000000 +0200
+++ b/drivers/usb/gadget/pxa25x_udc.c 2011-03-20 21:01:55.000000000 +0100
@@ -2200,27 +2200,27 @@ static int __init pxa25x_udc_probe(struc
 	dev->transceiver = otg_get_transceiver();
 
 	if (gpio_is_valid(dev->mach->gpio_vbus)) {
-		if ((retval = gpio_request(dev->mach->gpio_vbus,
-				"pxa25x_udc GPIO VBUS"))) {
+		if ((retval = gpio_request_one(dev->mach->gpio_vbus,
+					       GPIOF_IN,
+					       "pxa25x_udc GPIO VBUS"))) {
 			dev_dbg(&pdev->dev,
 				"can't get vbus gpio %d, err: %d\n",
 				dev->mach->gpio_vbus, retval);
 			goto err_gpio_vbus;
 		}
-		gpio_direction_input(dev->mach->gpio_vbus);
 		vbus_irq = gpio_to_irq(dev->mach->gpio_vbus);
 	} else
 		vbus_irq = 0;
 
 	if (gpio_is_valid(dev->mach->gpio_pullup)) {
-		if ((retval = gpio_request(dev->mach->gpio_pullup,
-				"pca25x_udc GPIO PULLUP"))) {
+		if ((retval = gpio_request_one(dev->mach->gpio_pullup,
+					       GPIOF_OUT_INIT_LOW,
+					       "pca25x_udc GPIO PULLUP"))) {
 			dev_dbg(&pdev->dev,
 				"can't get pullup gpio %d, err: %d\n",
 				dev->mach->gpio_pullup, retval);
 			goto err_gpio_pullup;
 		}
-		gpio_direction_output(dev->mach->gpio_pullup, 0);
 	}
 
 	init_timer(&dev->timer);
diff -u -p a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
--- a/drivers/usb/host/ohci-at91.c 2010-05-08 13:16:00.000000000 +0200
+++ b/drivers/usb/host/ohci-at91.c 2011-03-20 21:01:53.000000000 +0100
@@ -283,8 +283,8 @@ static int ohci_hcd_at91_drv_probe(struc
 		for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) {
 			if (pdata->vbus_pin[i] <= 0)
 				continue;
-			gpio_request(pdata->vbus_pin[i], "ohci_vbus");
-			gpio_direction_output(pdata->vbus_pin[i], 0);
+			gpio_request_one(pdata->vbus_pin[i],
+					 GPIOF_OUT_INIT_LOW, "ohci_vbus");
 		}
 	}
 
diff -u -p a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
--- a/drivers/usb/host/ohci-omap.c 2009-10-28 12:03:41.000000000 +0100
+++ b/drivers/usb/host/ohci-omap.c 2011-03-20 21:01:53.000000000 +0100
@@ -254,8 +254,7 @@ static int ohci_omap_init(struct usb_hcd
 
 			/* gpio9 for overcurrent detction */
 			omap_cfg_reg(W8_1610_GPIO9);
-			gpio_request(9, "OHCI overcurrent");
-			gpio_direction_input(9);
+			gpio_request_one(9, GPIOF_IN, "OHCI overcurrent");
 
 			/* for paranoia's sake:  disable USB.PUEN */
 			omap_cfg_reg(W4_USB_HIGHZ);
diff -u -p a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
--- a/drivers/usb/musb/blackfin.c 2011-02-11 10:53:32.000000000 +0100
+++ b/drivers/usb/musb/blackfin.c 2011-03-20 21:01:54.000000000 +0100
@@ -380,12 +380,12 @@ static int bfin_musb_init(struct musb *m
 	 * here because we are in host mode
 	 */
 
-	if (gpio_request(musb->config->gpio_vrsel, "USB_VRSEL")) {
+	if (gpio_request_one(musb->config->gpio_vrsel, GPIOF_OUT_INIT_LOW,
+			     "USB_VRSEL")) {
 		printk(KERN_ERR "Failed ro request USB_VRSEL GPIO_%d\n",
 			musb->config->gpio_vrsel);
 		return -ENODEV;
 	}
-	gpio_direction_output(musb->config->gpio_vrsel, 0);
 
 	usb_nop_xceiv_register();
 	musb->xceiv = otg_get_transceiver();
diff -u -p a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c
--- a/drivers/usb/otg/gpio_vbus.c 2010-03-29 19:27:58.000000000 +0200
+++ b/drivers/usb/otg/gpio_vbus.c 2011-03-20 21:01:54.000000000 +0100
@@ -240,13 +240,12 @@ static int __init gpio_vbus_probe(struct
 	gpio_vbus->otg.set_power = gpio_vbus_set_power;
 	gpio_vbus->otg.set_suspend = gpio_vbus_set_suspend;
 
-	err = gpio_request(gpio, "vbus_detect");
+	err = gpio_request_one(gpio, GPIOF_IN, "vbus_detect");
 	if (err) {
 		dev_err(&pdev->dev, "can't request vbus gpio %d, err: %d\n",
 			gpio, err);
 		goto err_gpio;
 	}
-	gpio_direction_input(gpio);
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (res) {
diff -u -p a/drivers/video/bf537-lq035.c b/drivers/video/bf537-lq035.c
--- a/drivers/video/bf537-lq035.c 2011-02-02 17:27:39.000000000 +0100
+++ b/drivers/video/bf537-lq035.c 2011-03-20 21:01:56.000000000 +0100
@@ -383,23 +383,20 @@ static int __devinit request_ports(void)
 	}
 
 #if (defined(UD) && defined(LBR))
-	if (gpio_request(UD, KBUILD_MODNAME)) {
+	if (gpio_request_one(UD, GPIOF_OUT_INIT_LOW, KBUILD_MODNAME)) {
 		pr_err("requesting GPIO %d failed\n", UD);
 		return -EBUSY;
 	}
 
-	if (gpio_request(LBR, KBUILD_MODNAME)) {
+	if (gpio_request_one(LBR, GPIOF_OUT_INIT_HIGH, KBUILD_MODNAME)) {
 		pr_err("requesting GPIO %d failed\n", LBR);
 		gpio_free(UD);
 		return -EBUSY;
 	}
 
-	gpio_direction_output(UD, 0);
-	gpio_direction_output(LBR, 1);
-
 #endif
 
-	if (gpio_request(MOD, KBUILD_MODNAME)) {
+	if (gpio_request_one(MOD, GPIOF_OUT_INIT_HIGH, KBUILD_MODNAME)) {
 		pr_err("requesting GPIO %d failed\n", MOD);
 #if (defined(UD) && defined(LBR))
 		gpio_free(LBR);
@@ -408,8 +405,6 @@ static int __devinit request_ports(void)
 		return -EBUSY;
 	}
 
-	gpio_direction_output(MOD, 1);
-
 	SSYNC();
 	return 0;
 }
diff -u -p a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c
--- a/drivers/video/bf54x-lq043fb.c 2010-08-10 09:17:44.000000000 +0200
+++ b/drivers/video/bf54x-lq043fb.c 2011-03-20 21:01:50.000000000 +0100
@@ -240,7 +240,7 @@ static int request_ports(struct bfin_bf5
 	u16 eppi_req_18[] = EPPI0_18;
 	u16 disp = fbi->mach_info->disp;
 
-	if (gpio_request(disp, DRIVER_NAME)) {
+	if (gpio_request_one(disp, GPIOF_OUT_INIT_HIGH, DRIVER_NAME)) {
 		printk(KERN_ERR "Requesting GPIO %d failed\n", disp);
 		return -EFAULT;
 	}
@@ -263,8 +263,6 @@ static int request_ports(struct bfin_bf5
 		}
 	}
 
-	gpio_direction_output(disp, 1);
-
 	return 0;
 }
 
diff -u -p a/drivers/video/bfin-lq035q1-fb.c b/drivers/video/bfin-lq035q1-fb.c
--- a/drivers/video/bfin-lq035q1-fb.c 2010-05-27 15:47:04.000000000 +0200
+++ b/drivers/video/bfin-lq035q1-fb.c 2011-03-20 21:01:56.000000000 +0100
@@ -363,10 +363,10 @@ static int __devinit bfin_lq035q1_reques
 	 * Drive PPI_FS3 Low
 	 */
 	if (ANOMALY_05000400) {
-		int ret = gpio_request(P_IDENT(P_PPI0_FS3), "PPI_FS3");
+		int ret = gpio_request_one(P_IDENT(P_PPI0_FS3),
+					   GPIOF_OUT_INIT_LOW, "PPI_FS3");
 		if (ret)
 			return ret;
-		gpio_direction_output(P_IDENT(P_PPI0_FS3), 0);
 	}
 
 	if (ppi16)
@@ -714,14 +714,14 @@ static int __devinit bfin_lq035q1_probe(
 	}
 
 	if (info->disp_info->use_bl) {
-		ret = gpio_request(info->disp_info->gpio_bl, "LQ035 Backlight");
+		ret = gpio_request_one(info->disp_info->gpio_bl,
+				       GPIOF_OUT_INIT_LOW, "LQ035 Backlight");
 
 		if (ret) {
 			dev_err(&pdev->dev, "failed to request GPIO %d\n",
 				info->disp_info->gpio_bl);
 			goto out9;
 		}
-		gpio_direction_output(info->disp_info->gpio_bl, 0);
 	}
 
 	ret = register_framebuffer(fbinfo);
diff -u -p a/drivers/video/bfin_adv7393fb.c b/drivers/video/bfin_adv7393fb.c
--- a/drivers/video/bfin_adv7393fb.c 2010-12-04 18:54:36.000000000 +0100
+++ b/drivers/video/bfin_adv7393fb.c 2011-03-20 21:01:55.000000000 +0100
@@ -411,12 +411,12 @@ static int __devinit bfin_adv7393_fb_pro
 
 	/* Workaround "PPI Does Not Start Properly In Specific Mode" */
 	if (ANOMALY_05000400) {
-		if (gpio_request(P_IDENT(P_PPI0_FS3), "PPI0_FS3")) {
+		if (gpio_request_one(P_IDENT(P_PPI0_FS3), GPIOF_OUT_INIT_LOW,
+				     "PPI0_FS3")) {
 			dev_err(&client->dev, "PPI0_FS3 GPIO request failed\n");
 			ret = -EBUSY;
 			goto out_8;
 		}
-		gpio_direction_output(P_IDENT(P_PPI0_FS3), 0);
 	}
 
 	if (peripheral_request_list(ppi_pins, DRIVER_NAME)) {
diff -u -p a/drivers/video/omap/lcd_2430sdp.c b/drivers/video/omap/lcd_2430sdp.c
--- a/drivers/video/omap/lcd_2430sdp.c 2009-12-17 08:30:14.000000000 +0100
+++ b/drivers/video/omap/lcd_2430sdp.c 2011-03-20 21:01:55.000000000 +0100
@@ -66,10 +66,8 @@ static int sdp2430_panel_init(struct lcd
 		backlight_gpio = SDP2430_LCD_PANEL_BACKLIGHT_GPIO;
 	}
 
-	gpio_request(enable_gpio, "LCD enable");	/* LCD panel */
-	gpio_request(backlight_gpio, "LCD bl");		/* LCD backlight */
-	gpio_direction_output(enable_gpio, 0);
-	gpio_direction_output(backlight_gpio, 0);
+	gpio_request_one(enable_gpio, GPIOF_OUT_INIT_LOW, "LCD enable");	/* LCD panel */
+	gpio_request_one(backlight_gpio, GPIOF_OUT_INIT_LOW, "LCD bl");
 
 	return 0;
 }
diff -u -p a/drivers/video/omap/lcd_inn1610.c b/drivers/video/omap/lcd_inn1610.c
--- a/drivers/video/omap/lcd_inn1610.c 2009-11-16 12:10:37.000000000 +0100
+++ b/drivers/video/omap/lcd_inn1610.c 2011-03-20 21:01:55.000000000 +0100
@@ -32,20 +32,18 @@ static int innovator1610_panel_init(stru
 {
 	int r = 0;
 
-	if (gpio_request(14, "lcd_en0")) {
+	if (gpio_request_one(14, GPIOF_OUT_INIT_LOW, "lcd_en0")) {
 		pr_err(MODULE_NAME ": can't request GPIO 14\n");
 		r = -1;
 		goto exit;
 	}
-	if (gpio_request(15, "lcd_en1")) {
+	if (gpio_request_one(15, GPIOF_OUT_INIT_LOW, "lcd_en1")) {
 		pr_err(MODULE_NAME ": can't request GPIO 15\n");
 		gpio_free(14);
 		r = -1;
 		goto exit;
 	}
 	/* configure GPIO(14, 15) as outputs */
-	gpio_direction_output(14, 0);
-	gpio_direction_output(15, 0);
 exit:
 	return r;
 }
diff -u -p a/drivers/video/omap/lcd_ldp.c b/drivers/video/omap/lcd_ldp.c
--- a/drivers/video/omap/lcd_ldp.c 2009-12-17 08:30:14.000000000 +0100
+++ b/drivers/video/omap/lcd_ldp.c 2011-03-20 21:01:55.000000000 +0100
@@ -65,15 +65,13 @@
 static int ldp_panel_init(struct lcd_panel *panel,
 				struct omapfb_device *fbdev)
 {
-	gpio_request(LCD_PANEL_RESET_GPIO, "lcd reset");
-	gpio_request(LCD_PANEL_QVGA_GPIO, "lcd qvga");
-	gpio_request(LCD_PANEL_ENABLE_GPIO, "lcd panel");
-	gpio_request(LCD_PANEL_BACKLIGHT_GPIO, "lcd backlight");
-
-	gpio_direction_output(LCD_PANEL_QVGA_GPIO, 0);
-	gpio_direction_output(LCD_PANEL_RESET_GPIO, 0);
-	gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 0);
-	gpio_direction_output(LCD_PANEL_BACKLIGHT_GPIO, 0);
+	gpio_request_one(LCD_PANEL_RESET_GPIO, GPIOF_OUT_INIT_LOW,
+			 "lcd reset");
+	gpio_request_one(LCD_PANEL_QVGA_GPIO, GPIOF_OUT_INIT_LOW, "lcd qvga");
+	gpio_request_one(LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW,
+			 "lcd panel");
+	gpio_request_one(LCD_PANEL_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW,
+			 "lcd backlight");
 
 #ifdef CONFIG_FB_OMAP_LCD_VGA
 	gpio_set_value(LCD_PANEL_QVGA_GPIO, 0);
diff -u -p a/drivers/video/omap/lcd_omap2evm.c b/drivers/video/omap/lcd_omap2evm.c
--- a/drivers/video/omap/lcd_omap2evm.c 2009-12-17 08:30:14.000000000 +0100
+++ b/drivers/video/omap/lcd_omap2evm.c 2011-03-20 21:01:55.000000000 +0100
@@ -47,19 +47,13 @@ static unsigned int bklight_level;
 static int omap2evm_panel_init(struct lcd_panel *panel,
 				struct omapfb_device *fbdev)
 {
-	gpio_request(LCD_PANEL_ENABLE_GPIO, "LCD enable");
-	gpio_request(LCD_PANEL_LR, "LCD lr");
-	gpio_request(LCD_PANEL_UD, "LCD ud");
-	gpio_request(LCD_PANEL_INI, "LCD ini");
-	gpio_request(LCD_PANEL_QVGA, "LCD qvga");
-	gpio_request(LCD_PANEL_RESB, "LCD resb");
-
-	gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 1);
-	gpio_direction_output(LCD_PANEL_RESB, 1);
-	gpio_direction_output(LCD_PANEL_INI, 1);
-	gpio_direction_output(LCD_PANEL_QVGA, 0);
-	gpio_direction_output(LCD_PANEL_LR, 1);
-	gpio_direction_output(LCD_PANEL_UD, 1);
+	gpio_request_one(LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_HIGH,
+			 "LCD enable");
+	gpio_request_one(LCD_PANEL_LR, GPIOF_OUT_INIT_HIGH, "LCD lr");
+	gpio_request_one(LCD_PANEL_UD, GPIOF_OUT_INIT_HIGH, "LCD ud");
+	gpio_request_one(LCD_PANEL_INI, GPIOF_OUT_INIT_HIGH, "LCD ini");
+	gpio_request_one(LCD_PANEL_QVGA, GPIOF_OUT_INIT_LOW, "LCD qvga");
+	gpio_request_one(LCD_PANEL_RESB, GPIOF_OUT_INIT_HIGH, "LCD resb");
 
 	twl_i2c_write_u8(TWL4030_MODULE_LED, 0x11, TWL_LED_LEDEN);
 	twl_i2c_write_u8(TWL4030_MODULE_PWMA, 0x01, TWL_PWMA_PWMAON);
diff -u -p a/drivers/video/omap/lcd_omap3evm.c b/drivers/video/omap/lcd_omap3evm.c
--- a/drivers/video/omap/lcd_omap3evm.c 2009-12-17 08:30:14.000000000 +0100
+++ b/drivers/video/omap/lcd_omap3evm.c 2011-03-20 21:01:55.000000000 +0100
@@ -51,17 +51,11 @@ static unsigned int bklight_level;
 static int omap3evm_panel_init(struct lcd_panel *panel,
 				struct omapfb_device *fbdev)
 {
-	gpio_request(LCD_PANEL_LR, "LCD lr");
-	gpio_request(LCD_PANEL_UD, "LCD ud");
-	gpio_request(LCD_PANEL_INI, "LCD ini");
-	gpio_request(LCD_PANEL_RESB, "LCD resb");
-	gpio_request(LCD_PANEL_QVGA, "LCD qvga");
-
-	gpio_direction_output(LCD_PANEL_RESB, 1);
-	gpio_direction_output(LCD_PANEL_INI, 1);
-	gpio_direction_output(LCD_PANEL_QVGA, 0);
-	gpio_direction_output(LCD_PANEL_LR, 1);
-	gpio_direction_output(LCD_PANEL_UD, 1);
+	gpio_request_one(LCD_PANEL_LR, GPIOF_OUT_INIT_HIGH, "LCD lr");
+	gpio_request_one(LCD_PANEL_UD, GPIOF_OUT_INIT_HIGH, "LCD ud");
+	gpio_request_one(LCD_PANEL_INI, GPIOF_OUT_INIT_HIGH, "LCD ini");
+	gpio_request_one(LCD_PANEL_RESB, GPIOF_OUT_INIT_HIGH, "LCD resb");
+	gpio_request_one(LCD_PANEL_QVGA, GPIOF_OUT_INIT_LOW, "LCD qvga");
 
 	twl_i2c_write_u8(TWL4030_MODULE_LED, 0x11, TWL_LED_LEDEN);
 	twl_i2c_write_u8(TWL4030_MODULE_PWMA, 0x01, TWL_PWMA_PWMAON);
diff -u -p a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
--- a/drivers/video/omap2/displays/panel-taal.c 2011-03-14 17:19:17.000000000 +0100
+++ b/drivers/video/omap2/displays/panel-taal.c 2011-03-20 21:01:55.000000000 +0100
@@ -753,14 +753,12 @@ static int taal_probe(struct omap_dss_de
 	if (panel_data->use_ext_te) {
 		int gpio = panel_data->ext_te_gpio;
 
-		r = gpio_request(gpio, "taal irq");
+		r = gpio_request_one(gpio, GPIOF_IN, "taal irq");
 		if (r) {
 			dev_err(&dssdev->dev, "GPIO request failed\n");
 			goto err_gpio;
 		}
 
-		gpio_direction_input(gpio);
-
 		r = request_irq(gpio_to_irq(gpio), taal_te_isr,
 				IRQF_DISABLED | IRQF_TRIGGER_RISING,
 				"taal vsync", dssdev);
diff -u -p a/sound/pci/cs5535audio/cs5535audio_olpc.c b/sound/pci/cs5535audio/cs5535audio_olpc.c
--- a/sound/pci/cs5535audio/cs5535audio_olpc.c 2009-12-17 08:30:15.000000000 +0100
+++ b/sound/pci/cs5535audio/cs5535audio_olpc.c 2011-03-20 21:01:54.000000000 +0100
@@ -152,11 +152,10 @@ int __devinit olpc_quirks(struct snd_car
 	if (!machine_is_olpc())
 		return 0;
 
-	if (gpio_request(OLPC_GPIO_MIC_AC, DRV_NAME)) {
+	if (gpio_request_one(OLPC_GPIO_MIC_AC, GPIOF_OUT_INIT_LOW, DRV_NAME)) {
 		printk(KERN_ERR DRV_NAME ": unable to allocate MIC GPIO\n");
 		return -EIO;
 	}
-	gpio_direction_output(OLPC_GPIO_MIC_AC, 0);
 
 	/* drop the original AD1888 HPF control */
 	memset(&elem, 0, sizeof(elem));
diff -u -p a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c
--- a/sound/soc/blackfin/bf5xx-ac97.c 2011-01-19 18:51:20.000000000 +0100
+++ b/sound/soc/blackfin/bf5xx-ac97.c 2011-03-20 21:01:53.000000000 +0100
@@ -215,8 +215,7 @@ static void bf5xx_ac97_warm_reset(struct
 	pr_debug("%s enter\n", __func__);
 
 	peripheral_free(per);
-	gpio_request(gpio, "bf5xx-ac97");
-	gpio_direction_output(gpio, 1);
+	gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "bf5xx-ac97");
 	udelay(2);
 	gpio_set_value(gpio, 0);
 	udelay(1);
@@ -321,13 +320,13 @@ static int bf5xx_ac97_probe(struct snd_s
 
 #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET
 	/* Request PB3 as reset pin */
-	if (gpio_request(CONFIG_SND_BF5XX_RESET_GPIO_NUM, "SND_AD198x RESET")) {
+	if (gpio_request_one(CONFIG_SND_BF5XX_RESET_GPIO_NUM,
+			     GPIOF_OUT_INIT_HIGH, "SND_AD198x RESET")) {
 		pr_err("Failed to request GPIO_%d for reset\n",
 				CONFIG_SND_BF5XX_RESET_GPIO_NUM);
 		ret =  -1;
 		goto gpio_err;
 	}
-	gpio_direction_output(CONFIG_SND_BF5XX_RESET_GPIO_NUM, 1);
 #endif
 	sport_handle = sport_init(&sport_params[sport_num], 2, \
 			sizeof(struct ac97_frame), NULL);
diff -u -p a/sound/soc/blackfin/bf5xx-ad73311.c b/sound/soc/blackfin/bf5xx-ad73311.c
--- a/sound/soc/blackfin/bf5xx-ad73311.c 2010-11-24 07:55:12.000000000 +0100
+++ b/sound/soc/blackfin/bf5xx-ad73311.c 2011-03-20 21:01:54.000000000 +0100
@@ -131,13 +131,11 @@ static int snd_ad73311_configure(void)
 static int bf5xx_probe(struct platform_device *pdev)
 {
 	int err;
-	if (gpio_request(GPIO_SE, "AD73311_SE")) {
+	if (gpio_request_one(GPIO_SE, GPIOF_OUT_INIT_LOW, "AD73311_SE")) {
 		printk(KERN_ERR "%s: Failed ro request GPIO_%d\n", __func__, GPIO_SE);
 		return -EBUSY;
 	}
 
-	gpio_direction_output(GPIO_SE, 0);
-
 	err = snd_ad73311_configure();
 	if (err < 0)
 		return -EFAULT;
diff -u -p a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
--- a/sound/soc/codecs/tlv320aic3x.c 2010-12-26 10:19:08.000000000 +0100
+++ b/sound/soc/codecs/tlv320aic3x.c 2011-03-20 21:01:52.000000000 +0100
@@ -1379,10 +1379,10 @@ static int aic3x_probe(struct snd_soc_co
 
 	if (gpio_is_valid(aic3x->gpio_reset) &&
 	    !aic3x_is_shared_reset(aic3x)) {
-		ret = gpio_request(aic3x->gpio_reset, "tlv320aic3x reset");
+		ret = gpio_request_one(aic3x->gpio_reset, GPIOF_OUT_INIT_LOW,
+				       "tlv320aic3x reset");
 		if (ret != 0)
 			goto err_gpio;
-		gpio_direction_output(aic3x->gpio_reset, 0);
 	}
 
 	for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++)
diff -u -p a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
--- a/sound/soc/codecs/tlv320dac33.c 2011-03-14 17:19:19.000000000 +0100
+++ b/sound/soc/codecs/tlv320dac33.c 2011-03-20 21:01:51.000000000 +0100
@@ -1553,14 +1553,14 @@ static int __devinit dac33_i2c_probe(str
 
 	/* Check if the reset GPIO number is valid and request it */
 	if (dac33->power_gpio >= 0) {
-		ret = gpio_request(dac33->power_gpio, "tlv320dac33 reset");
+		ret = gpio_request_one(dac33->power_gpio, GPIOF_OUT_INIT_LOW,
+				       "tlv320dac33 reset");
 		if (ret < 0) {
 			dev_err(&client->dev,
 				"Failed to request reset GPIO (%d)\n",
 				dac33->power_gpio);
 			goto err_gpio;
 		}
-		gpio_direction_output(dac33->power_gpio, 0);
 	}
 
 	for (i = 0; i < ARRAY_SIZE(dac33->supplies); i++)
diff -u -p a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
--- a/sound/soc/codecs/tpa6130a2.c 2011-01-19 18:51:20.000000000 +0100
+++ b/sound/soc/codecs/tpa6130a2.c 2011-03-20 21:01:51.000000000 +0100
@@ -393,13 +393,13 @@ static int __devinit tpa6130a2_probe(str
 						TPA6130A2_MUTE_L;
 
 	if (data->power_gpio >= 0) {
-		ret = gpio_request(data->power_gpio, "tpa6130a2 enable");
+		ret = gpio_request_one(data->power_gpio, GPIOF_OUT_INIT_LOW,
+				       "tpa6130a2 enable");
 		if (ret < 0) {
 			dev_err(dev, "Failed to request power GPIO (%d)\n",
 				data->power_gpio);
 			goto err_gpio;
 		}
-		gpio_direction_output(data->power_gpio, 0);
 	}
 
 	switch (data->id) {
diff -u -p a/sound/soc/jz4740/qi_lb60.c b/sound/soc/jz4740/qi_lb60.c
--- a/sound/soc/jz4740/qi_lb60.c 2010-11-24 07:55:12.000000000 +0100
+++ b/sound/soc/jz4740/qi_lb60.c 2011-03-20 21:01:53.000000000 +0100
@@ -106,23 +106,20 @@ static int __init qi_lb60_init(void)
 	if (!qi_lb60_snd_device)
 		return -ENOMEM;
 
-	ret = gpio_request(QI_LB60_SND_GPIO, "SND");
+	ret = gpio_request_one(QI_LB60_SND_GPIO, GPIOF_OUT_INIT_LOW, "SND");
 	if (ret) {
 		pr_err("qi_lb60 snd: Failed to request SND GPIO(%d): %d\n",
 				QI_LB60_SND_GPIO, ret);
 		goto err_device_put;
 	}
 
-	ret = gpio_request(QI_LB60_AMP_GPIO, "AMP");
+	ret = gpio_request_one(QI_LB60_AMP_GPIO, GPIOF_OUT_INIT_LOW, "AMP");
 	if (ret) {
 		pr_err("qi_lb60 snd: Failed to request AMP GPIO(%d): %d\n",
 				QI_LB60_AMP_GPIO, ret);
 		goto err_gpio_free_snd;
 	}
 
-	gpio_direction_output(QI_LB60_SND_GPIO, 0);
-	gpio_direction_output(QI_LB60_AMP_GPIO, 0);
-
 	platform_set_drvdata(qi_lb60_snd_device, &qi_lb60);
 
 	ret = platform_device_add(qi_lb60_snd_device);
diff -u -p a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c
--- a/sound/soc/omap/n810.c 2011-01-09 09:32:58.000000000 +0100
+++ b/sound/soc/omap/n810.c 2011-03-20 21:01:51.000000000 +0100
@@ -369,11 +369,10 @@ static int __init n810_soc_init(void)
 	clk_set_parent(sys_clkout2_src, func96m_clk);
 	clk_set_rate(sys_clkout2, 12000000);
 
-	BUG_ON((gpio_request(N810_HEADSET_AMP_GPIO, "hs_amp") < 0) ||
-	       (gpio_request(N810_SPEAKER_AMP_GPIO, "spk_amp") < 0));
-
-	gpio_direction_output(N810_HEADSET_AMP_GPIO, 0);
-	gpio_direction_output(N810_SPEAKER_AMP_GPIO, 0);
+	BUG_ON((gpio_request_one(N810_HEADSET_AMP_GPIO, GPIOF_OUT_INIT_LOW,
+				 "hs_amp") < 0) ||
+	       (gpio_request_one(N810_SPEAKER_AMP_GPIO, GPIOF_OUT_INIT_LOW,
+				 "spk_amp") < 0));
 
 	return 0;
 err4:
diff -u -p a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c
--- a/sound/soc/omap/zoom2.c 2010-11-24 07:55:12.000000000 +0100
+++ b/sound/soc/omap/zoom2.c 2011-03-20 21:01:51.000000000 +0100
@@ -260,11 +260,11 @@ static int __init zoom2_soc_init(void)
 	if (ret)
 		goto err1;
 
-	BUG_ON(gpio_request(ZOOM2_HEADSET_MUX_GPIO, "hs_mux") < 0);
-	gpio_direction_output(ZOOM2_HEADSET_MUX_GPIO, 0);
+	BUG_ON(gpio_request_one(ZOOM2_HEADSET_MUX_GPIO, GPIOF_OUT_INIT_LOW,
+				"hs_mux") < 0);
 
-	BUG_ON(gpio_request(ZOOM2_HEADSET_EXTMUTE_GPIO, "ext_mute") < 0);
-	gpio_direction_output(ZOOM2_HEADSET_EXTMUTE_GPIO, 0);
+	BUG_ON(gpio_request_one(ZOOM2_HEADSET_EXTMUTE_GPIO,
+				GPIOF_OUT_INIT_LOW, "ext_mute") < 0);
 
 	return 0;
 
diff -u -p a/sound/soc/samsung/s3c24xx_simtec.c b/sound/soc/samsung/s3c24xx_simtec.c
--- a/sound/soc/samsung/s3c24xx_simtec.c 2011-01-24 08:53:37.000000000 +0100
+++ b/sound/soc/samsung/s3c24xx_simtec.c 2011-03-20 21:01:53.000000000 +0100
@@ -247,21 +247,20 @@ static int attach_gpio_amp(struct device
 
 	/* attach gpio amp gain (if any) */
 	if (pdata->amp_gain[0] > 0) {
-		ret = gpio_request(pd->amp_gain[0], "gpio-amp-gain0");
+		ret = gpio_request_one(pd->amp_gain[0], GPIOF_OUT_INIT_LOW,
+				       "gpio-amp-gain0");
 		if (ret) {
 			dev_err(dev, "cannot get amp gpio gain0\n");
 			return ret;
 		}
 
-		ret = gpio_request(pd->amp_gain[1], "gpio-amp-gain1");
+		ret = gpio_request_one(pd->amp_gain[1], GPIOF_OUT_INIT_LOW,
+				       "gpio-amp-gain1");
 		if (ret) {
 			dev_err(dev, "cannot get amp gpio gain1\n");
 			gpio_free(pdata->amp_gain[0]);
 			return ret;
 		}
-
-		gpio_direction_output(pd->amp_gain[0], 0);
-		gpio_direction_output(pd->amp_gain[1], 0);
 	}
 
 	/* note, currently we assume GPA0 isn't valid amp */
diff -u -p a/sound/soc/samsung/s3c24xx_uda134x.c b/sound/soc/samsung/s3c24xx_uda134x.c
--- a/sound/soc/samsung/s3c24xx_uda134x.c 2011-02-02 17:27:40.000000000 +0100
+++ b/sound/soc/samsung/s3c24xx_uda134x.c 2011-03-20 21:01:53.000000000 +0100
@@ -266,12 +266,11 @@ static struct uda134x_platform_data s3c2
 
 static int s3c24xx_uda134x_setup_pin(int pin, char *fun)
 {
-	if (gpio_request(pin, "s3c24xx_uda134x") < 0) {
+	if (gpio_request_one(pin, GPIOF_OUT_INIT_LOW, "s3c24xx_uda134x") < 0) {
 		printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: "
 		       "l3 %s pin already in use", fun);
 		return -EBUSY;
 	}
-	gpio_direction_output(pin, 0);
 	return 0;
 }
 
diff -u -p a/sound/soc/tegra/harmony.c b/sound/soc/tegra/harmony.c
--- a/sound/soc/tegra/harmony.c 2011-02-19 08:28:53.000000000 +0100
+++ b/sound/soc/tegra/harmony.c 2011-03-20 21:01:50.000000000 +0100
@@ -201,35 +201,30 @@ static int harmony_asoc_init(struct snd_
 	struct harmony_audio_platform_data *pdata = harmony->pdata;
 	int ret;
 
-	ret = gpio_request(pdata->gpio_spkr_en, "spkr_en");
+	ret = gpio_request_one(pdata->gpio_spkr_en, GPIOF_OUT_INIT_LOW,
+			       "spkr_en");
 	if (ret) {
 		dev_err(card->dev, "cannot get spkr_en gpio\n");
 		return ret;
 	}
 	harmony->gpio_requested |= GPIO_SPKR_EN;
 
-	gpio_direction_output(pdata->gpio_spkr_en, 0);
-
-	ret = gpio_request(pdata->gpio_int_mic_en, "int_mic_en");
+	ret = gpio_request_one(pdata->gpio_int_mic_en, GPIOF_OUT_INIT_LOW,
+			       "int_mic_en");
 	if (ret) {
 		dev_err(card->dev, "cannot get int_mic_en gpio\n");
 		return ret;
 	}
 	harmony->gpio_requested |= GPIO_INT_MIC_EN;
 
-	/* Disable int mic; enable signal is active-high */
-	gpio_direction_output(pdata->gpio_int_mic_en, 0);
-
-	ret = gpio_request(pdata->gpio_ext_mic_en, "ext_mic_en");
+	ret = gpio_request_one(pdata->gpio_ext_mic_en, GPIOF_OUT_INIT_LOW,
+			       "ext_mic_en");
 	if (ret) {
 		dev_err(card->dev, "cannot get ext_mic_en gpio\n");
 		return ret;
 	}
 	harmony->gpio_requested |= GPIO_EXT_MIC_EN;
 
-	/* Enable ext mic; enable signal is active-low */
-	gpio_direction_output(pdata->gpio_ext_mic_en, 0);
-
 	ret = snd_soc_add_controls(codec, harmony_controls,
 				   ARRAY_SIZE(harmony_controls));
 	if (ret < 0)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-20 19:24               ` Wolfram Sang
  2011-03-20 20:51                 ` Julia Lawall
@ 2011-03-20 21:04                 ` Julia Lawall
  2011-03-21  7:43                   ` Grant Likely
  1 sibling, 1 reply; 20+ messages in thread
From: Julia Lawall @ 2011-03-20 21:04 UTC (permalink / raw)
  To: linux-arm-kernel

In this case, I also ignore the !GPIOLIB issue.  This semantic patch 
considers the case where the direction call has some error handling code.  
In this case, it just deletes that error handling code, so most of these 
cases are likely to need some manual cleanup, eg to get rid of unreachable 
error labels or to change the error message.

The semantic patch is as follows.  It modifies over 150 occurrences, as 
shown below.

@@
expression E1,E2,ret,E;
statement S;
@@

-      gpio_request(E1,E2)
+      gpio_request_one(E1,GPIOF_IN,E2)
       ... when != E1
-      ret = gpio_direction_input(E1);
       ... when != ret = E
-      if (\(ret != 0 \| ret < 0\)) S

@@
expression E1,E2,ret,E;
statement S;
@@

-      gpio_request(E1,E2)
+      gpio_request_one(E1,GPIOF_OUT_INIT_LOW,E2)
       ... when != E1
-      ret = gpio_direction_output(E1,0);
       ... when != ret = E
-      if (\(ret != 0 \| ret < 0\)) S

@@
expression E1,E2,ret,E;
statement S;
@@

-      gpio_request(E1,E2)
+      gpio_request_one(E1,GPIOF_OUT_INIT_HIGH,E2)
       ... when != E1
-      ret = gpio_direction_output(E1,1);
       ... when != ret = E
-      if (\(ret != 0 \| ret < 0\)) S

julia


diff -u -p a/arch/arm/mach-at91/board-gsia18s.c b/arch/arm/mach-at91/board-gsia18s.c
--- a/arch/arm/mach-at91/board-gsia18s.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/arm/mach-at91/board-gsia18s.c 2011-03-20 22:00:24.000000000 +0100
@@ -458,18 +458,13 @@ static int pcf8574x_0x20_setup(struct i2
 {
 	int status;
 
-	status = gpio_request(gpio + PCF_GPIO_ETH_DETECT, "eth_det");
+	status = gpio_request_one(gpio + PCF_GPIO_ETH_DETECT, GPIOF_IN,
+				  "eth_det");
 	if (status < 0) {
 		pr_err("error: can't request GPIO%d\n",
 			gpio + PCF_GPIO_ETH_DETECT);
 		return status;
 	}
-	status = gpio_direction_input(gpio + PCF_GPIO_ETH_DETECT);
-	if (status < 0) {
-		pr_err("error: can't setup GPIO%d as input\n",
-			gpio + PCF_GPIO_ETH_DETECT);
-		return status;
-	}
 	status = gpio_export(gpio + PCF_GPIO_ETH_DETECT, false);
 	if (status < 0) {
 		pr_err("error: can't export GPIO%d\n",
diff -u -p a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
--- a/arch/arm/mach-ep93xx/core.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-ep93xx/core.c 2011-03-20 22:00:22.000000000 +0100
@@ -598,13 +598,11 @@ int ep93xx_pwm_acquire_gpio(struct platf
 	if (pdev->id == 0) {
 		err = 0;
 	} else if (pdev->id == 1) {
-		err = gpio_request(EP93XX_GPIO_LINE_EGPIO14,
-				   dev_name(&pdev->dev));
+		err = gpio_request_one(EP93XX_GPIO_LINE_EGPIO14,
+				       GPIOF_OUT_INIT_LOW,
+				       dev_name(&pdev->dev));
 		if (err)
 			return err;
-		err = gpio_direction_output(EP93XX_GPIO_LINE_EGPIO14, 0);
-		if (err)
-			goto fail;
 
 		/* PWM 1 output on EGPIO[14] */
 		ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_PONG);
diff -u -p a/arch/arm/mach-mx3/mach-armadillo5x0.c b/arch/arm/mach-mx3/mach-armadillo5x0.c
--- a/arch/arm/mach-mx3/mach-armadillo5x0.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-armadillo5x0.c 2011-03-20 22:00:21.000000000 +0100
@@ -160,18 +160,13 @@ static int usbotg_init(struct platform_d
 
 	/* Chip already enabled by hardware */
 	/* OTG phy reset*/
-	err = gpio_request(OTG_RESET, "USB-OTG-RESET");
+	err = gpio_request_one(OTG_RESET, GPIOF_OUT_INIT_HIGH,
+			       "USB-OTG-RESET");
 	if (err) {
 		pr_err("Failed to request the usb otg reset gpio\n");
 		return err;
 	}
 
-	err = gpio_direction_output(OTG_RESET, 1/*HIGH*/);
-	if (err) {
-		pr_err("Failed to reset the usb otg phy\n");
-		goto otg_free_reset;
-	}
-
 	gpio_set_value(OTG_RESET, 0/*LOW*/);
 	mdelay(5);
 	gpio_set_value(OTG_RESET, 1/*HIGH*/);
@@ -206,31 +201,20 @@ static int usbh2_init(struct platform_de
 
 
 	/* Enable the chip */
-	err = gpio_request(USBH2_CS, "USB-H2-CS");
+	err = gpio_request_one(USBH2_CS, GPIOF_OUT_INIT_LOW, "USB-H2-CS");
 	if (err) {
 		pr_err("Failed to request the usb host 2 CS gpio\n");
 		return err;
 	}
 
-	err = gpio_direction_output(USBH2_CS, 0/*Enabled*/);
-	if (err) {
-		pr_err("Failed to drive the usb host 2 CS gpio\n");
-		goto h2_free_cs;
-	}
-
 	/* H2 phy reset*/
-	err = gpio_request(USBH2_RESET, "USB-H2-RESET");
+	err = gpio_request_one(USBH2_RESET, GPIOF_OUT_INIT_HIGH,
+			       "USB-H2-RESET");
 	if (err) {
 		pr_err("Failed to request the usb host 2 reset gpio\n");
 		goto h2_free_cs;
 	}
 
-	err = gpio_direction_output(USBH2_RESET, 1/*HIGH*/);
-	if (err) {
-		pr_err("Failed to reset the usb host 2 phy\n");
-		goto h2_free_reset;
-	}
-
 	gpio_set_value(USBH2_RESET, 0/*LOW*/);
 	mdelay(5);
 	gpio_set_value(USBH2_RESET, 1/*HIGH*/);
diff -u -p a/arch/arm/mach-mx3/mach-mx31_3ds.c b/arch/arm/mach-mx3/mach-mx31_3ds.c
--- a/arch/arm/mach-mx3/mach-mx31_3ds.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-mx31_3ds.c 2011-03-20 22:00:21.000000000 +0100
@@ -574,18 +574,13 @@ static int mx31_3ds_usbotg_init(void)
 	mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
 	mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
 
-	err = gpio_request(USBOTG_RST_B, "otgusb-reset");
+	err = gpio_request_one(USBOTG_RST_B, GPIOF_OUT_INIT_LOW,
+			       "otgusb-reset");
 	if (err) {
 		pr_err("Failed to request the USB OTG reset gpio\n");
 		return err;
 	}
 
-	err = gpio_direction_output(USBOTG_RST_B, 0);
-	if (err) {
-		pr_err("Failed to drive the USB OTG reset gpio\n");
-		goto usbotg_free_reset;
-	}
-
 	mdelay(1);
 	gpio_set_value(USBOTG_RST_B, 1);
 	return 0;
@@ -617,18 +612,12 @@ static int mx31_3ds_host2_init(struct pl
 	mxc_iomux_set_pad(MX31_PIN_IOIS16, USB_PAD_CFG);
 	mxc_iomux_set_pad(MX31_PIN_PC_RW_B, USB_PAD_CFG);
 
-	err = gpio_request(USBH2_RST_B, "usbh2-reset");
+	err = gpio_request_one(USBH2_RST_B, GPIOF_OUT_INIT_LOW, "usbh2-reset");
 	if (err) {
 		pr_err("Failed to request the USB Host 2 reset gpio\n");
 		return err;
 	}
 
-	err = gpio_direction_output(USBH2_RST_B, 0);
-	if (err) {
-		pr_err("Failed to drive the USB Host 2 reset gpio\n");
-		goto usbotg_free_reset;
-	}
-
 	mdelay(1);
 	gpio_set_value(USBH2_RST_B, 1);
 
diff -u -p a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
--- a/arch/arm/mach-mx3/mach-mx31moboard.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-mx31moboard.c 2011-03-20 22:00:22.000000000 +0100
@@ -123,14 +123,11 @@ static struct platform_device mx31moboar
 
 static int moboard_uart0_init(struct platform_device *pdev)
 {
-	int ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack");
+	int ret = gpio_request_one(IOMUX_TO_GPIO(MX31_PIN_CTS1),
+				   GPIOF_OUT_INIT_LOW, "uart0-cts-hack");
 	if (ret)
 		return ret;
 
-	ret = gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0);
-	if (ret)
-		gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1));
-
 	return ret;
 }
 
diff -u -p a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
--- a/arch/arm/mach-mxs/mach-mx28evk.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mxs/mach-mx28evk.c 2011-03-20 22:00:22.000000000 +0100
@@ -129,18 +129,13 @@ static void __init mx28evk_fec_reset(voi
 		clk_enable(clk);
 
 	/* Power up fec phy */
-	ret = gpio_request(MX28EVK_FEC_PHY_POWER, "fec-phy-power");
+	ret = gpio_request_one(MX28EVK_FEC_PHY_POWER, GPIOF_OUT_INIT_LOW,
+			       "fec-phy-power");
 	if (ret) {
 		pr_err("Failed to request gpio fec-phy-%s: %d\n", "power", ret);
 		return;
 	}
 
-	ret = gpio_direction_output(MX28EVK_FEC_PHY_POWER, 0);
-	if (ret) {
-		pr_err("Failed to drive gpio fec-phy-%s: %d\n", "power", ret);
-		return;
-	}
-
 	/* Reset fec phy */
 	ret = gpio_request(MX28EVK_FEC_PHY_RESET, "fec-phy-reset");
 	if (ret) {
diff -u -p a/arch/arm/mach-mxs/module-tx28.c b/arch/arm/mach-mxs/module-tx28.c
--- a/arch/arm/mach-mxs/module-tx28.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mxs/module-tx28.c 2011-03-20 22:00:23.000000000 +0100
@@ -72,19 +72,13 @@ int __init tx28_add_fec0(void)
 		unsigned int gpio = MXS_GPIO_NR(PAD_BANK(tx28_fec_gpio_pads[i]),
 			PAD_PIN(tx28_fec_gpio_pads[i]));
 
-		ret = gpio_request(gpio, "FEC");
+		ret = gpio_request_one(gpio, GPIOF_OUT_INIT_LOW, "FEC");
 		if (ret) {
 			pr_err("Failed to request GPIO_%d_%d: %d\n",
 				PAD_BANK(tx28_fec_gpio_pads[i]),
 				PAD_PIN(tx28_fec_gpio_pads[i]), ret);
 			goto free_gpios;
 		}
-		ret = gpio_direction_output(gpio, 0);
-		if (ret) {
-			pr_err("Failed to set direction of GPIO_%d_%d to output: %d\n",
-					gpio / 32 + 1, gpio % 32, ret);
-			goto free_gpios;
-		}
 	}
 
 	/* Power up fec phy */
diff -u -p a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
--- a/arch/arm/mach-omap2/board-4430sdp.c 2011-03-20 18:17:22.000000000 +0100
+++ b/arch/arm/mach-omap2/board-4430sdp.c 2011-03-20 22:00:22.000000000 +0100
@@ -257,44 +257,26 @@ static int omap_ethernet_init(void)
 
 	/* Request of GPIO lines */
 
-	status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
+	status = gpio_request_one(ETH_KS8851_POWER_ON, GPIOF_OUT_INIT_HIGH,
+				  "eth_power");
 	if (status) {
 		pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
 		return status;
 	}
 
-	status = gpio_request(ETH_KS8851_QUART, "quart");
+	status = gpio_request_one(ETH_KS8851_QUART, GPIOF_OUT_INIT_HIGH,
+				  "quart");
 	if (status) {
 		pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
 		goto error1;
 	}
 
-	status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
+	status = gpio_request_one(ETH_KS8851_IRQ, GPIOF_IN, "eth_irq");
 	if (status) {
 		pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
 		goto error2;
 	}
 
-	/* Configuration of requested GPIO lines */
-
-	status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
-	if (status) {
-		pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
-		goto error3;
-	}
-
-	status = gpio_direction_output(ETH_KS8851_QUART, 1);
-	if (status) {
-		pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
-		goto error3;
-	}
-
-	status = gpio_direction_input(ETH_KS8851_IRQ);
-	if (status) {
-		pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
-		goto error3;
-	}
-
 	return 0;
 
 error3:
@@ -616,19 +598,13 @@ static void __init omap_sfh7741prox_init
 {
 	int  error;
 
-	error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741");
+	error = gpio_request_one(OMAP4_SFH7741_ENABLE_GPIO,
+				 GPIOF_OUT_INIT_LOW, "sfh7741");
 	if (error < 0) {
 		pr_err("%s:failed to request GPIO %d, error %d\n",
 			__func__, OMAP4_SFH7741_ENABLE_GPIO, error);
 		return;
 	}
-
-	error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0);
-	if (error < 0) {
-		pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n",
-			 __func__, OMAP4_SFH7741_ENABLE_GPIO, error);
-		gpio_free(OMAP4_SFH7741_ENABLE_GPIO);
-	}
 }
 
 static void sdp4430_hdmi_mux_init(void)
diff -u -p a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c
--- a/arch/arm/mach-omap2/board-am3517crane.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-am3517crane.c 2011-03-20 22:00:23.000000000 +0100
@@ -89,19 +89,13 @@ static void __init am3517_crane_init(voi
 		return;
 	}
 
-	ret = gpio_request(GPIO_USB_POWER, "usb_ehci_enable");
+	ret = gpio_request_one(GPIO_USB_POWER, GPIOF_OUT_INIT_HIGH,
+			       "usb_ehci_enable");
 	if (ret < 0) {
 		pr_err("Can not request GPIO %d\n", GPIO_USB_POWER);
 		return;
 	}
 
-	ret = gpio_direction_output(GPIO_USB_POWER, 1);
-	if (ret < 0) {
-		gpio_free(GPIO_USB_POWER);
-		pr_err("Unable to initialize EHCI power\n");
-		return;
-	}
-
 	usbhs_init(&usbhs_bdata);
 }
 
diff -u -p a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
--- a/arch/arm/mach-omap2/board-am3517evm.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-am3517evm.c 2011-03-20 22:00:24.000000000 +0100
@@ -174,19 +174,12 @@ static void __init am3517_evm_rtc_init(v
 	int r;
 
 	omap_mux_init_gpio(GPIO_RTCS35390A_IRQ, OMAP_PIN_INPUT_PULLUP);
-	r = gpio_request(GPIO_RTCS35390A_IRQ, "rtcs35390a-irq");
+	r = gpio_request_one(GPIO_RTCS35390A_IRQ, GPIOF_IN, "rtcs35390a-irq");
 	if (r < 0) {
 		printk(KERN_WARNING "failed to request GPIO#%d\n",
 				GPIO_RTCS35390A_IRQ);
 		return;
 	}
-	r = gpio_direction_input(GPIO_RTCS35390A_IRQ);
-	if (r < 0) {
-		printk(KERN_WARNING "GPIO#%d cannot be configured as input\n",
-				GPIO_RTCS35390A_IRQ);
-		gpio_free(GPIO_RTCS35390A_IRQ);
-		return;
-	}
 	am3517evm_i2c1_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ);
 }
 
diff -u -p a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
--- a/arch/arm/mach-omap2/board-omap3pandora.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-omap3pandora.c 2011-03-20 22:00:23.000000000 +0100
@@ -305,18 +305,12 @@ static int omap3pandora_twl_gpio_setup(s
 
 	/* gpio + 13 drives 32kHz buffer for wifi module */
 	gpio_32khz = gpio + 13;
-	ret = gpio_request(gpio_32khz, "wifi 32kHz");
+	ret = gpio_request_one(gpio_32khz, GPIOF_OUT_INIT_HIGH, "wifi 32kHz");
 	if (ret < 0) {
 		pr_err("Cannot get GPIO line %d, ret=%d\n", gpio_32khz, ret);
 		goto fail;
 	}
 
-	ret = gpio_direction_output(gpio_32khz, 1);
-	if (ret < 0) {
-		pr_err("Cannot set GPIO line %d, ret=%d\n", gpio_32khz, ret);
-		goto fail_direction;
-	}
-
 	return 0;
 
 fail_direction:
@@ -639,14 +633,10 @@ static void __init pandora_wl1251_init(v
 
 	memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
 
-	ret = gpio_request(PANDORA_WIFI_IRQ_GPIO, "wl1251 irq");
+	ret = gpio_request_one(PANDORA_WIFI_IRQ_GPIO, GPIOF_IN, "wl1251 irq");
 	if (ret < 0)
 		goto fail;
 
-	ret = gpio_direction_input(PANDORA_WIFI_IRQ_GPIO);
-	if (ret < 0)
-		goto fail_irq;
-
 	pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO);
 	if (pandora_wl1251_pdata.irq < 0)
 		goto fail_irq;
diff -u -p a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c 2011-03-20 22:00:21.000000000 +0100
@@ -925,22 +925,15 @@ static void __init rx51_init_wl1251(void
 {
 	int irq, ret;
 
-	ret = gpio_request(RX51_WL1251_POWER_GPIO, "wl1251 power");
+	ret = gpio_request_one(RX51_WL1251_POWER_GPIO, GPIOF_OUT_INIT_LOW,
+			       "wl1251 power");
 	if (ret < 0)
 		goto error;
 
-	ret = gpio_direction_output(RX51_WL1251_POWER_GPIO, 0);
+	ret = gpio_request_one(RX51_WL1251_IRQ_GPIO, GPIOF_IN, "wl1251 irq");
 	if (ret < 0)
 		goto err_power;
 
-	ret = gpio_request(RX51_WL1251_IRQ_GPIO, "wl1251 irq");
-	if (ret < 0)
-		goto err_power;
-
-	ret = gpio_direction_input(RX51_WL1251_IRQ_GPIO);
-	if (ret < 0)
-		goto err_irq;
-
 	irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO);
 	if (irq < 0)
 		goto err_irq;
diff -u -p a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
--- a/arch/arm/mach-pxa/balloon3.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/balloon3.c 2011-03-20 22:00:21.000000000 +0100
@@ -250,18 +250,13 @@ static void __init balloon3_lcd_init(voi
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_lcd_pin_config));
 
-	ret = gpio_request(BALLOON3_GPIO_RUN_BACKLIGHT, "BKL-ON");
+	ret = gpio_request_one(BALLOON3_GPIO_RUN_BACKLIGHT,
+			       GPIOF_OUT_INIT_HIGH, "BKL-ON");
 	if (ret) {
 		pr_err("Requesting BKL-ON GPIO failed!\n");
 		goto err;
 	}
 
-	ret = gpio_direction_output(BALLOON3_GPIO_RUN_BACKLIGHT, 1);
-	if (ret) {
-		pr_err("Setting BKL-ON GPIO direction failed!\n");
-		goto err2;
-	}
-
 	balloon3_lcd_screen.pxafb_backlight_power = balloon3_backlight_power;
 	set_pxa_fb_info(&balloon3_lcd_screen);
 	return;
@@ -635,14 +630,11 @@ static int balloon3_nand_probe(struct pl
 			"NAND support might be broken in this version!", ver);
 
 	/* Power up the NAND chips */
-	ret = gpio_request(BALLOON3_GPIO_RUN_NAND, "NAND");
+	ret = gpio_request_one(BALLOON3_GPIO_RUN_NAND, GPIOF_OUT_INIT_HIGH,
+			       "NAND");
 	if (ret)
 		goto err1;
 
-	ret = gpio_direction_output(BALLOON3_GPIO_RUN_NAND, 1);
-	if (ret)
-		goto err2;
-
 	gpio_set_value(BALLOON3_GPIO_RUN_NAND, 1);
 
 	/* Deassert all nCE lines and write protect line */
diff -u -p a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
--- a/arch/arm/mach-pxa/cm-x270.c 2010-12-31 15:18:30.000000000 +0100
+++ b/arch/arm/mach-pxa/cm-x270.c 2011-03-20 22:00:23.000000000 +0100
@@ -327,22 +327,18 @@ static unsigned long cm_x270_libertas_pi
 
 static int cm_x270_libertas_setup(struct spi_device *spi)
 {
-	int err = gpio_request(GPIO19_WLAN_STRAP, "WLAN STRAP");
+	int err = gpio_request_one(GPIO19_WLAN_STRAP, GPIOF_OUT_INIT_HIGH,
+				   "WLAN STRAP");
 	if (err)
 		return err;
 
-	err = gpio_request(GPIO102_WLAN_RST, "WLAN RST");
+	err = gpio_request_one(GPIO102_WLAN_RST, GPIOF_OUT_INIT_LOW,
+			       "WLAN RST");
 	if (err)
 		goto err_free_strap;
 
-	err = gpio_direction_output(GPIO102_WLAN_RST, 0);
-	if (err)
-		goto err_free_strap;
 	msleep(100);
 
-	err = gpio_direction_output(GPIO19_WLAN_STRAP, 1);
-	if (err)
-		goto err_free_strap;
 	msleep(100);
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(cm_x270_libertas_pin_config));
diff -u -p a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
--- a/arch/arm/mach-pxa/gumstix.c 2010-12-28 18:26:02.000000000 +0100
+++ b/arch/arm/mach-pxa/gumstix.c 2011-03-20 22:00:24.000000000 +0100
@@ -152,17 +152,13 @@ static void __init gumstix_bluetooth_ini
 
 	gumstix_setup_bt_clock();
 
-	err = gpio_request(GPIO_GUMSTIX_BTRESET, "BTRST");
+	err = gpio_request_one(GPIO_GUMSTIX_BTRESET, GPIOF_OUT_INIT_HIGH,
+			       "BTRST");
 	if (err) {
 		pr_err("gumstix: failed request gpio for bluetooth reset\n");
 		return;
 	}
 
-	err = gpio_direction_output(GPIO_GUMSTIX_BTRESET, 1);
-	if (err) {
-		pr_err("gumstix: can't reset bluetooth\n");
-		return;
-	}
 	gpio_set_value(GPIO_GUMSTIX_BTRESET, 0);
 	udelay(100);
 	gpio_set_value(GPIO_GUMSTIX_BTRESET, 1);
diff -u -p a/arch/arm/mach-pxa/palm27x.c b/arch/arm/mach-pxa/palm27x.c
--- a/arch/arm/mach-pxa/palm27x.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/palm27x.c 2011-03-20 22:00:24.000000000 +0100
@@ -278,20 +278,15 @@ static int palm27x_backlight_init(struct
 {
 	int ret;
 
-	ret = gpio_request(palm_bl_power, "BL POWER");
+	ret = gpio_request_one(palm_bl_power, GPIOF_OUT_INIT_LOW, "BL POWER");
 	if (ret)
 		goto err;
-	ret = gpio_direction_output(palm_bl_power, 0);
-	if (ret)
-		goto err2;
 
 	if (gpio_is_valid(palm_lcd_power)) {
-		ret = gpio_request(palm_lcd_power, "LCD POWER");
+		ret = gpio_request_one(palm_lcd_power, GPIOF_OUT_INIT_LOW,
+				       "LCD POWER");
 		if (ret)
 			goto err2;
-		ret = gpio_direction_output(palm_lcd_power, 0);
-		if (ret)
-			goto err3;
 	}
 
 	return 0;
@@ -355,20 +350,14 @@ static int palm27x_power_supply_init(str
 {
 	int ret;
 
-	ret = gpio_request(palm_ac_state, "AC state");
+	ret = gpio_request_one(palm_ac_state, GPIOF_IN, "AC state");
 	if (ret)
 		goto err1;
-	ret = gpio_direction_input(palm_ac_state);
-	if (ret)
-		goto err2;
 
 	if (gpio_is_valid(palm_usb_state)) {
-		ret = gpio_request(palm_usb_state, "USB state");
+		ret = gpio_request_one(palm_usb_state, GPIOF_IN, "USB state");
 		if (ret)
 			goto err2;
-		ret = gpio_direction_input(palm_usb_state);
-		if (ret)
-			goto err3;
 	}
 
 	return 0;
diff -u -p a/arch/arm/mach-pxa/palmtc.c b/arch/arm/mach-pxa/palmtc.c
--- a/arch/arm/mach-pxa/palmtc.c 2010-12-28 18:26:02.000000000 +0100
+++ b/arch/arm/mach-pxa/palmtc.c 2011-03-20 22:00:23.000000000 +0100
@@ -171,12 +171,10 @@ static int palmtc_backlight_init(struct 
 {
 	int ret;
 
-	ret = gpio_request(GPIO_NR_PALMTC_BL_POWER, "BL POWER");
+	ret = gpio_request_one(GPIO_NR_PALMTC_BL_POWER, GPIOF_OUT_INIT_HIGH,
+			       "BL POWER");
 	if (ret)
 		goto err;
-	ret = gpio_direction_output(GPIO_NR_PALMTC_BL_POWER, 1);
-	if (ret)
-		goto err2;
 
 	return 0;
 
diff -u -p a/arch/arm/mach-pxa/palmte2.c b/arch/arm/mach-pxa/palmte2.c
--- a/arch/arm/mach-pxa/palmte2.c 2010-12-28 18:26:02.000000000 +0100
+++ b/arch/arm/mach-pxa/palmte2.c 2011-03-20 22:00:22.000000000 +0100
@@ -140,18 +140,14 @@ static int palmte2_backlight_init(struct
 {
 	int ret;
 
-	ret = gpio_request(GPIO_NR_PALMTE2_BL_POWER, "BL POWER");
+	ret = gpio_request_one(GPIO_NR_PALMTE2_BL_POWER, GPIOF_OUT_INIT_LOW,
+			       "BL POWER");
 	if (ret)
 		goto err;
-	ret = gpio_direction_output(GPIO_NR_PALMTE2_BL_POWER, 0);
+	ret = gpio_request_one(GPIO_NR_PALMTE2_LCD_POWER, GPIOF_OUT_INIT_LOW,
+			       "LCD POWER");
 	if (ret)
 		goto err2;
-	ret = gpio_request(GPIO_NR_PALMTE2_LCD_POWER, "LCD POWER");
-	if (ret)
-		goto err2;
-	ret = gpio_direction_output(GPIO_NR_PALMTE2_LCD_POWER, 0);
-	if (ret)
-		goto err3;
 
 	return 0;
 err3:
@@ -225,12 +221,10 @@ static int power_supply_init(struct devi
 {
 	int ret;
 
-	ret = gpio_request(GPIO_NR_PALMTE2_POWER_DETECT, "CABLE_STATE_AC");
+	ret = gpio_request_one(GPIO_NR_PALMTE2_POWER_DETECT, GPIOF_IN,
+			       "CABLE_STATE_AC");
 	if (ret)
 		goto err1;
-	ret = gpio_direction_input(GPIO_NR_PALMTE2_POWER_DETECT);
-	if (ret)
-		goto err2;
 
 	return 0;
 
diff -u -p a/arch/arm/mach-pxa/tosa-bt.c b/arch/arm/mach-pxa/tosa-bt.c
--- a/arch/arm/mach-pxa/tosa-bt.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/tosa-bt.c 2011-03-20 22:00:23.000000000 +0100
@@ -61,18 +61,14 @@ static int tosa_bt_probe(struct platform
 
 	struct tosa_bt_data *data = dev->dev.platform_data;
 
-	rc = gpio_request(data->gpio_reset, "Bluetooth reset");
+	rc = gpio_request_one(data->gpio_reset, GPIOF_OUT_INIT_LOW,
+			      "Bluetooth reset");
 	if (rc)
 		goto err_reset;
-	rc = gpio_direction_output(data->gpio_reset, 0);
-	if (rc)
-		goto err_reset_dir;
-	rc = gpio_request(data->gpio_pwr, "Bluetooth power");
+	rc = gpio_request_one(data->gpio_pwr, GPIOF_OUT_INIT_LOW,
+			      "Bluetooth power");
 	if (rc)
 		goto err_pwr;
-	rc = gpio_direction_output(data->gpio_pwr, 0);
-	if (rc)
-		goto err_pwr_dir;
 
 	rfk = rfkill_alloc("tosa-bt", &dev->dev, RFKILL_TYPE_BLUETOOTH,
 			   &tosa_bt_rfkill_ops, data);
diff -u -p a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
--- a/arch/arm/mach-pxa/tosa.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/tosa.c 2011-03-20 22:00:23.000000000 +0100
@@ -253,14 +253,11 @@ static int tosa_mci_init(struct device *
 {
 	int err;
 
-	err = gpio_request(TOSA_GPIO_nSD_INT, "SD Int");
+	err = gpio_request_one(TOSA_GPIO_nSD_INT, GPIOF_IN, "SD Int");
 	if (err) {
 		printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n");
 		goto err_gpio_int;
 	}
-	err = gpio_direction_input(TOSA_GPIO_nSD_INT);
-	if (err)
-		goto err_gpio_int_dir;
 
 	return 0;
 
@@ -304,21 +301,16 @@ static int tosa_irda_startup(struct devi
 {
 	int ret;
 
-	ret = gpio_request(TOSA_GPIO_IRDA_TX, "IrDA TX");
+	ret = gpio_request_one(TOSA_GPIO_IRDA_TX, GPIOF_OUT_INIT_LOW,
+			       "IrDA TX");
 	if (ret)
 		goto err_tx;
-	ret = gpio_direction_output(TOSA_GPIO_IRDA_TX, 0);
-	if (ret)
-		goto err_tx_dir;
 
-	ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown");
+	ret = gpio_request_one(TOSA_GPIO_IR_POWERDWN, GPIOF_OUT_INIT_LOW,
+			       "IrDA powerdown");
 	if (ret)
 		goto err_pwr;
 
-	ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0);
-	if (ret)
-		goto err_pwr_dir;
-
 	tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
 
 	return 0;
@@ -352,14 +344,10 @@ static struct pxaficp_platform_data tosa
  */
 static int tosa_power_init(struct device *dev)
 {
-	int ret = gpio_request(TOSA_GPIO_AC_IN, "ac in");
+	int ret = gpio_request_one(TOSA_GPIO_AC_IN, GPIOF_IN, "ac in");
 	if (ret)
 		goto err_gpio_req;
 
-	ret = gpio_direction_input(TOSA_GPIO_AC_IN);
-	if (ret)
-		goto err_gpio_in;
-
 	return 0;
 
 err_gpio_in:
@@ -622,24 +610,18 @@ static int tosa_tc6393xb_enable(struct p
 {
 	int rc;
 
-	rc = gpio_request(TOSA_GPIO_TC6393XB_REST_IN, "tc6393xb #pclr");
+	rc = gpio_request_one(TOSA_GPIO_TC6393XB_REST_IN, GPIOF_OUT_INIT_LOW,
+			      "tc6393xb #pclr");
 	if (rc)
 		goto err_req_pclr;
-	rc = gpio_request(TOSA_GPIO_TC6393XB_SUSPEND, "tc6393xb #suspend");
+	rc = gpio_request_one(TOSA_GPIO_TC6393XB_SUSPEND, GPIOF_OUT_INIT_LOW,
+			      "tc6393xb #suspend");
 	if (rc)
 		goto err_req_suspend;
-	rc = gpio_request(TOSA_GPIO_TC6393XB_L3V_ON, "tc6393xb l3v");
+	rc = gpio_request_one(TOSA_GPIO_TC6393XB_L3V_ON, GPIOF_OUT_INIT_LOW,
+			      "tc6393xb l3v");
 	if (rc)
 		goto err_req_l3v;
-	rc = gpio_direction_output(TOSA_GPIO_TC6393XB_L3V_ON, 0);
-	if (rc)
-		goto err_dir_l3v;
-	rc = gpio_direction_output(TOSA_GPIO_TC6393XB_SUSPEND, 0);
-	if (rc)
-		goto err_dir_suspend;
-	rc = gpio_direction_output(TOSA_GPIO_TC6393XB_REST_IN, 0);
-	if (rc)
-		goto err_dir_pclr;
 
 	mdelay(1);
 
@@ -726,14 +708,11 @@ static int tosa_tc6393xb_setup(struct pl
 {
 	int rc;
 
-	rc = gpio_request(TOSA_GPIO_CARD_VCC_ON, "CARD_VCC_ON");
+	rc = gpio_request_one(TOSA_GPIO_CARD_VCC_ON, GPIOF_OUT_INIT_HIGH,
+			      "CARD_VCC_ON");
 	if (rc)
 		goto err_req;
 
-	rc = gpio_direction_output(TOSA_GPIO_CARD_VCC_ON, 1);
-	if (rc)
-		goto err_dir;
-
 	return rc;
 
 err_dir:
diff -u -p a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
--- a/arch/arm/mach-pxa/viper.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/viper.c 2011-03-20 22:00:22.000000000 +0100
@@ -353,22 +353,15 @@ static int viper_backlight_init(struct d
 	int ret;
 
 	/* GPIO9 and 10 control FB backlight. Initialise to off */
-	ret = gpio_request(VIPER_BCKLIGHT_EN_GPIO, "Backlight");
+	ret = gpio_request_one(VIPER_BCKLIGHT_EN_GPIO, GPIOF_OUT_INIT_LOW,
+			       "Backlight");
 	if (ret)
 		goto err_request_bckl;
 
-	ret = gpio_request(VIPER_LCD_EN_GPIO, "LCD");
+	ret = gpio_request_one(VIPER_LCD_EN_GPIO, GPIOF_OUT_INIT_LOW, "LCD");
 	if (ret)
 		goto err_request_lcd;
 
-	ret = gpio_direction_output(VIPER_BCKLIGHT_EN_GPIO, 0);
-	if (ret)
-		goto err_dir;
-
-	ret = gpio_direction_output(VIPER_LCD_EN_GPIO, 0);
-	if (ret)
-		goto err_dir;
-
 	return 0;
 
 err_dir:
diff -u -p a/arch/arm/mach-pxa/vpac270.c b/arch/arm/mach-pxa/vpac270.c
--- a/arch/arm/mach-pxa/vpac270.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/vpac270.c 2011-03-20 22:00:23.000000000 +0100
@@ -559,18 +559,13 @@ static void __init vpac270_lcd_init(void
 {
 	int ret;
 
-	ret = gpio_request(GPIO81_VPAC270_BKL_ON, "BKL-ON");
+	ret = gpio_request_one(GPIO81_VPAC270_BKL_ON, GPIOF_OUT_INIT_HIGH,
+			       "BKL-ON");
 	if (ret) {
 		pr_err("Requesting BKL-ON GPIO failed!\n");
 		goto err;
 	}
 
-	ret = gpio_direction_output(GPIO81_VPAC270_BKL_ON, 1);
-	if (ret) {
-		pr_err("Setting BKL-ON GPIO direction failed!\n");
-		goto err2;
-	}
-
 	vpac270_lcd_screen.pxafb_lcd_power = vpac270_lcd_power;
 	set_pxa_fb_info(&vpac270_lcd_screen);
 	return;
diff -u -p a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
--- a/arch/arm/mach-pxa/z2.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/z2.c 2011-03-20 22:00:22.000000000 +0100
@@ -497,22 +497,16 @@ static int z2_lbs_spi_setup(struct spi_d
 {
 	int ret = 0;
 
-	ret = gpio_request(GPIO15_ZIPITZ2_WIFI_POWER, "WiFi Power");
+	ret = gpio_request_one(GPIO15_ZIPITZ2_WIFI_POWER,
+			       GPIOF_OUT_INIT_HIGH, "WiFi Power");
 	if (ret)
 		goto err;
 
-	ret = gpio_direction_output(GPIO15_ZIPITZ2_WIFI_POWER, 1);
+	ret = gpio_request_one(GPIO14_ZIPITZ2_WIFI_RESET, GPIOF_OUT_INIT_LOW,
+			       "WiFi Reset");
 	if (ret)
 		goto err2;
 
-	ret = gpio_request(GPIO14_ZIPITZ2_WIFI_RESET, "WiFi Reset");
-	if (ret)
-		goto err2;
-
-	ret = gpio_direction_output(GPIO14_ZIPITZ2_WIFI_RESET, 0);
-	if (ret)
-		goto err3;
-
 	/* Reset the card */
 	mdelay(180);
 	gpio_set_value(GPIO14_ZIPITZ2_WIFI_RESET, 1);
diff -u -p a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
--- a/arch/arm/mach-pxa/zeus.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/zeus.c 2011-03-20 22:00:23.000000000 +0100
@@ -393,16 +393,11 @@ static int zeus_mcp2515_setup(struct spi
 {
 	int err;
 
-	err = gpio_request(ZEUS_CAN_SHDN_GPIO, "CAN shutdown");
+	err = gpio_request_one(ZEUS_CAN_SHDN_GPIO, GPIOF_OUT_INIT_HIGH,
+			       "CAN shutdown");
 	if (err)
 		return err;
 
-	err = gpio_direction_output(ZEUS_CAN_SHDN_GPIO, 1);
-	if (err) {
-		gpio_free(ZEUS_CAN_SHDN_GPIO);
-		return err;
-	}
-
 	return 0;
 }
 
diff -u -p a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
--- a/arch/arm/mach-sa1100/collie.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-sa1100/collie.c 2011-03-20 22:00:24.000000000 +0100
@@ -95,14 +95,10 @@ static struct mcp_plat_data collie_mcp_d
  */
 static int collie_power_init(struct device *dev)
 {
-	int ret = gpio_request(COLLIE_GPIO_AC_IN, "ac in");
+	int ret = gpio_request_one(COLLIE_GPIO_AC_IN, GPIOF_IN, "ac in");
 	if (ret)
 		goto err_gpio_req;
 
-	ret = gpio_direction_input(COLLIE_GPIO_AC_IN);
-	if (ret)
-		goto err_gpio_in;
-
 	return 0;
 
 err_gpio_in:
@@ -273,14 +269,11 @@ static struct mtd_partition collie_parti
 
 static int collie_flash_init(void)
 {
-	int rc = gpio_request(COLLIE_GPIO_VPEN, "flash Vpp enable");
+	int rc = gpio_request_one(COLLIE_GPIO_VPEN, GPIOF_OUT_INIT_HIGH,
+				  "flash Vpp enable");
 	if (rc)
 		return rc;
 
-	rc = gpio_direction_output(COLLIE_GPIO_VPEN, 1);
-	if (rc)
-		gpio_free(COLLIE_GPIO_VPEN);
-
 	return rc;
 }
 
diff -u -p a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c
--- a/arch/arm/mach-sa1100/h3600.c 2010-10-23 19:40:31.000000000 +0200
+++ b/arch/arm/mach-sa1100/h3600.c 2011-03-20 22:00:24.000000000 +0100
@@ -79,18 +79,14 @@ static void h3600_irda_set_speed(struct 
 
 static int h3600_irda_startup(struct device *dev)
 {
-	int err = gpio_request(H3600_EGPIO_IR_ON, "IrDA power");
+	int err = gpio_request_one(H3600_EGPIO_IR_ON, GPIOF_OUT_INIT_LOW,
+				   "IrDA power");
 	if (err)
 		goto err1;
-	err = gpio_direction_output(H3600_EGPIO_IR_ON, 0);
+	err = gpio_request_one(H3600_EGPIO_IR_FSEL, GPIOF_OUT_INIT_LOW,
+			       "IrDA fsel");
 	if (err)
 		goto err2;
-	err = gpio_request(H3600_EGPIO_IR_FSEL, "IrDA fsel");
-	if (err)
-		goto err2;
-	err = gpio_direction_output(H3600_EGPIO_IR_FSEL, 0);
-	if (err)
-		goto err3;
 	return 0;
 
 err3:	gpio_free(H3600_EGPIO_IR_FSEL);
diff -u -p a/arch/arm/mach-sa1100/h3xxx.c b/arch/arm/mach-sa1100/h3xxx.c
--- a/arch/arm/mach-sa1100/h3xxx.c 2009-12-03 14:09:46.000000000 +0100
+++ b/arch/arm/mach-sa1100/h3xxx.c 2011-03-20 22:00:24.000000000 +0100
@@ -82,16 +82,13 @@ static void h3xxx_set_vpp(int vpp)
 
 static int h3xxx_flash_init(void)
 {
-	int err = gpio_request(H3XXX_EGPIO_VPP_ON, "Flash Vpp");
+	int err = gpio_request_one(H3XXX_EGPIO_VPP_ON, GPIOF_OUT_INIT_LOW,
+				   "Flash Vpp");
 	if (err) {
 		pr_err("%s: can't request H3XXX_EGPIO_VPP_ON\n", __func__);
 		return err;
 	}
 
-	err = gpio_direction_output(H3XXX_EGPIO_VPP_ON, 0);
-	if (err)
-		gpio_free(H3XXX_EGPIO_VPP_ON);
-
 	return err;
 }
 
diff -u -p a/arch/arm/mach-ux500/board-mop500-stuib.c b/arch/arm/mach-ux500/board-mop500-stuib.c
--- a/arch/arm/mach-ux500/board-mop500-stuib.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-ux500/board-mop500-stuib.c 2011-03-20 22:00:22.000000000 +0100
@@ -100,17 +100,12 @@ static int bu21013_gpio_board_init(int r
 
 	bu21013_devices++;
 	if (bu21013_devices == 1) {
-		retval = gpio_request(reset_pin, "touchp_reset");
+		retval = gpio_request_one(reset_pin, GPIOF_OUT_INIT_HIGH,
+					  "touchp_reset");
 		if (retval) {
 			printk(KERN_ERR "Unable to request gpio reset_pin");
 			return retval;
 		}
-		retval = gpio_direction_output(reset_pin, 1);
-		if (retval < 0) {
-			printk(KERN_ERR "%s: gpio direction failed\n",
-					__func__);
-			return retval;
-		}
 	}
 
 	return retval;
diff -u -p a/arch/m68knommu/platform/520x/config.c b/arch/m68knommu/platform/520x/config.c
--- a/arch/m68knommu/platform/520x/config.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/m68knommu/platform/520x/config.c 2011-03-20 22:00:24.000000000 +0100
@@ -99,38 +99,26 @@ static int m520x_cs_setup(struct mcfqspi
 {
 	int status;
 
-	status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0");
+	status = gpio_request_one(MCFQSPI_CS0, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS0");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS0 failed\n");
 		goto fail0;
 	}
-	status = gpio_direction_output(MCFQSPI_CS0, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n");
-		goto fail1;
-	}
 
-	status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1");
+	status = gpio_request_one(MCFQSPI_CS1, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS1");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS1 failed\n");
 		goto fail1;
 	}
-	status = gpio_direction_output(MCFQSPI_CS1, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n");
-		goto fail2;
-	}
 
-	status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2");
+	status = gpio_request_one(MCFQSPI_CS2, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS2");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS2 failed\n");
 		goto fail2;
 	}
-	status = gpio_direction_output(MCFQSPI_CS2, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n");
-		goto fail3;
-	}
 
 	return 0;
 
diff -u -p a/arch/m68knommu/platform/523x/config.c b/arch/m68knommu/platform/523x/config.c
--- a/arch/m68knommu/platform/523x/config.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/m68knommu/platform/523x/config.c 2011-03-20 22:00:24.000000000 +0100
@@ -101,49 +101,33 @@ static int m523x_cs_setup(struct mcfqspi
 {
 	int status;
 
-	status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0");
+	status = gpio_request_one(MCFQSPI_CS0, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS0");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS0 failed\n");
 		goto fail0;
 	}
-	status = gpio_direction_output(MCFQSPI_CS0, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n");
-		goto fail1;
-	}
 
-	status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1");
+	status = gpio_request_one(MCFQSPI_CS1, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS1");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS1 failed\n");
 		goto fail1;
 	}
-	status = gpio_direction_output(MCFQSPI_CS1, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n");
-		goto fail2;
-	}
 
-	status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2");
+	status = gpio_request_one(MCFQSPI_CS2, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS2");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS2 failed\n");
 		goto fail2;
 	}
-	status = gpio_direction_output(MCFQSPI_CS2, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n");
-		goto fail3;
-	}
 
-	status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3");
+	status = gpio_request_one(MCFQSPI_CS3, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS3");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS3 failed\n");
 		goto fail3;
 	}
-	status = gpio_direction_output(MCFQSPI_CS3, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n");
-		goto fail4;
-	}
 
 	return 0;
 
diff -u -p a/arch/m68knommu/platform/5249/config.c b/arch/m68knommu/platform/5249/config.c
--- a/arch/m68knommu/platform/5249/config.c 2010-05-27 15:47:03.000000000 +0200
+++ b/arch/m68knommu/platform/5249/config.c 2011-03-20 22:00:21.000000000 +0100
@@ -87,49 +87,33 @@ static int m5249_cs_setup(struct mcfqspi
 {
 	int status;
 
-	status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0");
+	status = gpio_request_one(MCFQSPI_CS0, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS0");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS0 failed\n");
 		goto fail0;
 	}
-	status = gpio_direction_output(MCFQSPI_CS0, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n");
-		goto fail1;
-	}
 
-	status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1");
+	status = gpio_request_one(MCFQSPI_CS1, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS1");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS1 failed\n");
 		goto fail1;
 	}
-	status = gpio_direction_output(MCFQSPI_CS1, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n");
-		goto fail2;
-	}
 
-	status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2");
+	status = gpio_request_one(MCFQSPI_CS2, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS2");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS2 failed\n");
 		goto fail2;
 	}
-	status = gpio_direction_output(MCFQSPI_CS2, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n");
-		goto fail3;
-	}
 
-	status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3");
+	status = gpio_request_one(MCFQSPI_CS3, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS3");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS3 failed\n");
 		goto fail3;
 	}
-	status = gpio_direction_output(MCFQSPI_CS3, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n");
-		goto fail4;
-	}
 
 	return 0;
 
diff -u -p a/arch/m68knommu/platform/527x/config.c b/arch/m68knommu/platform/527x/config.c
--- a/arch/m68knommu/platform/527x/config.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/m68knommu/platform/527x/config.c 2011-03-20 22:00:21.000000000 +0100
@@ -139,49 +139,33 @@ static int m527x_cs_setup(struct mcfqspi
 {
 	int status;
 
-	status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0");
+	status = gpio_request_one(MCFQSPI_CS0, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS0");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS0 failed\n");
 		goto fail0;
 	}
-	status = gpio_direction_output(MCFQSPI_CS0, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n");
-		goto fail1;
-	}
 
-	status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1");
+	status = gpio_request_one(MCFQSPI_CS1, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS1");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS1 failed\n");
 		goto fail1;
 	}
-	status = gpio_direction_output(MCFQSPI_CS1, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n");
-		goto fail2;
-	}
 
-	status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2");
+	status = gpio_request_one(MCFQSPI_CS2, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS2");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS2 failed\n");
 		goto fail2;
 	}
-	status = gpio_direction_output(MCFQSPI_CS2, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n");
-		goto fail3;
-	}
 
-	status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3");
+	status = gpio_request_one(MCFQSPI_CS3, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS3");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS3 failed\n");
 		goto fail3;
 	}
-	status = gpio_direction_output(MCFQSPI_CS3, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n");
-		goto fail4;
-	}
 
 	return 0;
 
diff -u -p a/arch/m68knommu/platform/528x/config.c b/arch/m68knommu/platform/528x/config.c
--- a/arch/m68knommu/platform/528x/config.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/m68knommu/platform/528x/config.c 2011-03-20 22:00:24.000000000 +0100
@@ -102,49 +102,33 @@ static int m528x_cs_setup(struct mcfqspi
 {
 	int status;
 
-	status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0");
+	status = gpio_request_one(MCFQSPI_CS0, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS0");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS0 failed\n");
 		goto fail0;
 	}
-	status = gpio_direction_output(MCFQSPI_CS0, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n");
-		goto fail1;
-	}
 
-	status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1");
+	status = gpio_request_one(MCFQSPI_CS1, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS1");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS1 failed\n");
 		goto fail1;
 	}
-	status = gpio_direction_output(MCFQSPI_CS1, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n");
-		goto fail2;
-	}
 
-	status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2");
+	status = gpio_request_one(MCFQSPI_CS2, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS2");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS2 failed\n");
 		goto fail2;
 	}
-	status = gpio_direction_output(MCFQSPI_CS2, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n");
-		goto fail3;
-	}
 
-	status = gpio_request(MCFQSPI_CS3, "MCFQSPI_CS3");
+	status = gpio_request_one(MCFQSPI_CS3, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS3");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS3 failed\n");
 		goto fail3;
 	}
-	status = gpio_direction_output(MCFQSPI_CS3, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS3 failed\n");
-		goto fail4;
-	}
 
 	return 0;
 
diff -u -p a/arch/m68knommu/platform/532x/config.c b/arch/m68knommu/platform/532x/config.c
--- a/arch/m68knommu/platform/532x/config.c 2010-01-29 18:29:07.000000000 +0100
+++ b/arch/m68knommu/platform/532x/config.c 2011-03-20 22:00:24.000000000 +0100
@@ -107,38 +107,26 @@ static int m532x_cs_setup(struct mcfqspi
 {
 	int status;
 
-	status = gpio_request(MCFQSPI_CS0, "MCFQSPI_CS0");
+	status = gpio_request_one(MCFQSPI_CS0, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS0");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS0 failed\n");
 		goto fail0;
 	}
-	status = gpio_direction_output(MCFQSPI_CS0, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS0 failed\n");
-		goto fail1;
-	}
 
-	status = gpio_request(MCFQSPI_CS1, "MCFQSPI_CS1");
+	status = gpio_request_one(MCFQSPI_CS1, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS1");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS1 failed\n");
 		goto fail1;
 	}
-	status = gpio_direction_output(MCFQSPI_CS1, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS1 failed\n");
-		goto fail2;
-	}
 
-	status = gpio_request(MCFQSPI_CS2, "MCFQSPI_CS2");
+	status = gpio_request_one(MCFQSPI_CS2, GPIOF_OUT_INIT_HIGH,
+				  "MCFQSPI_CS2");
 	if (status) {
 		pr_debug("gpio_request for MCFQSPI_CS2 failed\n");
 		goto fail2;
 	}
-	status = gpio_direction_output(MCFQSPI_CS2, 1);
-	if (status) {
-		pr_debug("gpio_direction_output for MCFQSPI_CS2 failed\n");
-		goto fail3;
-	}
 
 	return 0;
 
diff -u -p a/drivers/ata/pata_palmld.c b/drivers/ata/pata_palmld.c
--- a/drivers/ata/pata_palmld.c 2011-02-19 08:28:51.000000000 +0100
+++ b/drivers/ata/pata_palmld.c 2011-03-20 22:00:21.000000000 +0100
@@ -61,19 +61,15 @@ static __devinit int palmld_pata_probe(s
 		return -ENOMEM;
 
 	/* request and activate power GPIO, IRQ GPIO */
-	ret = gpio_request(GPIO_NR_PALMLD_IDE_PWEN, "HDD PWR");
+	ret = gpio_request_one(GPIO_NR_PALMLD_IDE_PWEN, GPIOF_OUT_INIT_HIGH,
+			       "HDD PWR");
 	if (ret)
 		goto err1;
-	ret = gpio_direction_output(GPIO_NR_PALMLD_IDE_PWEN, 1);
-	if (ret)
-		goto err2;
 
-	ret = gpio_request(GPIO_NR_PALMLD_IDE_RESET, "HDD RST");
+	ret = gpio_request_one(GPIO_NR_PALMLD_IDE_RESET, GPIOF_OUT_INIT_LOW,
+			       "HDD RST");
 	if (ret)
 		goto err2;
-	ret = gpio_direction_output(GPIO_NR_PALMLD_IDE_RESET, 0);
-	if (ret)
-		goto err3;
 
 	/* reset the drive */
 	gpio_set_value(GPIO_NR_PALMLD_IDE_RESET, 0);
diff -u -p a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c
--- a/drivers/hwmon/gpio-fan.c 2010-11-13 10:26:37.000000000 +0100
+++ b/drivers/hwmon/gpio-fan.c 2011-03-20 22:00:23.000000000 +0100
@@ -95,14 +95,10 @@ static int fan_alarm_init(struct gpio_fa
 
 	fan_data->alarm = alarm;
 
-	err = gpio_request(alarm->gpio, "GPIO fan alarm");
+	err = gpio_request_one(alarm->gpio, GPIOF_IN, "GPIO fan alarm");
 	if (err)
 		return err;
 
-	err = gpio_direction_input(alarm->gpio);
-	if (err)
-		goto err_free_gpio;
-
 	err = device_create_file(&pdev->dev, &dev_attr_fan1_alarm);
 	if (err)
 		goto err_free_gpio;
diff -u -p a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
--- a/drivers/input/keyboard/gpio_keys.c 2011-02-02 17:27:38.000000000 +0100
+++ b/drivers/input/keyboard/gpio_keys.c 2011-03-20 22:00:23.000000000 +0100
@@ -371,21 +371,13 @@ static int __devinit gpio_keys_setup_key
 	setup_timer(&bdata->timer, gpio_keys_timer, (unsigned long)bdata);
 	INIT_WORK(&bdata->work, gpio_keys_work_func);
 
-	error = gpio_request(button->gpio, desc);
+	error = gpio_request_one(button->gpio, GPIOF_IN, desc);
 	if (error < 0) {
 		dev_err(dev, "failed to request GPIO %d, error %d\n",
 			button->gpio, error);
 		goto fail2;
 	}
 
-	error = gpio_direction_input(button->gpio);
-	if (error < 0) {
-		dev_err(dev, "failed to configure"
-			" direction for GPIO %d, error %d\n",
-			button->gpio, error);
-		goto fail3;
-	}
-
 	if (button->debounce_interval) {
 		error = gpio_set_debounce(button->gpio,
 					  button->debounce_interval * 1000);
diff -u -p a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
--- a/drivers/input/keyboard/gpio_keys_polled.c 2010-12-26 10:19:06.000000000 +0100
+++ b/drivers/input/keyboard/gpio_keys_polled.c 2011-03-20 22:00:22.000000000 +0100
@@ -158,22 +158,14 @@ static int __devinit gpio_keys_polled_pr
 			goto err_free_gpio;
 		}
 
-		error = gpio_request(gpio,
-				     button->desc ? button->desc : DRV_NAME);
+		error = gpio_request_one(gpio, GPIOF_IN,
+					 button->desc ? button->desc : DRV_NAME);
 		if (error) {
 			dev_err(dev, "unable to claim gpio %u, err=%d\n",
 				gpio, error);
 			goto err_free_gpio;
 		}
 
-		error = gpio_direction_input(gpio);
-		if (error) {
-			dev_err(dev,
-				"unable to set direction on gpio %u, err=%d\n",
-				gpio, error);
-			goto err_free_gpio;
-		}
-
 		bdata->can_sleep = gpio_cansleep(gpio);
 		bdata->last_state = -1;
 		bdata->threshold = DIV_ROUND_UP(button->debounce_interval,
diff -u -p a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c
--- a/drivers/input/misc/rotary_encoder.c 2011-02-11 10:53:32.000000000 +0100
+++ b/drivers/input/misc/rotary_encoder.c 2011-03-20 22:00:22.000000000 +0100
@@ -146,34 +146,20 @@ static int __devinit rotary_encoder_prob
 	}
 
 	/* request the GPIOs */
-	err = gpio_request(pdata->gpio_a, DRV_NAME);
+	err = gpio_request_one(pdata->gpio_a, GPIOF_IN, DRV_NAME);
 	if (err) {
 		dev_err(&pdev->dev, "unable to request GPIO %d\n",
 			pdata->gpio_a);
 		goto exit_unregister_input;
 	}
 
-	err = gpio_direction_input(pdata->gpio_a);
-	if (err) {
-		dev_err(&pdev->dev, "unable to set GPIO %d for input\n",
-			pdata->gpio_a);
-		goto exit_unregister_input;
-	}
-
-	err = gpio_request(pdata->gpio_b, DRV_NAME);
+	err = gpio_request_one(pdata->gpio_b, GPIOF_IN, DRV_NAME);
 	if (err) {
 		dev_err(&pdev->dev, "unable to request GPIO %d\n",
 			pdata->gpio_b);
 		goto exit_free_gpio_a;
 	}
 
-	err = gpio_direction_input(pdata->gpio_b);
-	if (err) {
-		dev_err(&pdev->dev, "unable to set GPIO %d for input\n",
-			pdata->gpio_b);
-		goto exit_free_gpio_a;
-	}
-
 	/* request the IRQs */
 	err = request_irq(encoder->irq_a, &rotary_encoder_irq,
 			  IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
diff -u -p a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c
--- a/drivers/input/touchscreen/cy8ctmg110_ts.c 2011-01-19 18:51:19.000000000 +0100
+++ b/drivers/input/touchscreen/cy8ctmg110_ts.c 2011-03-20 22:00:22.000000000 +0100
@@ -223,7 +223,7 @@ static int __devinit cy8ctmg110_probe(st
 	cy8ctmg110_power(ts, true);
 	cy8ctmg110_set_sleepmode(ts, false);
 
-	err = gpio_request(ts->irq_pin, "touch_irq_key");
+	err = gpio_request_one(ts->irq_pin, GPIOF_IN, "touch_irq_key");
 	if (err < 0) {
 		dev_err(&client->dev,
 			"Failed to request GPIO %d, error %d\n",
@@ -231,14 +231,6 @@ static int __devinit cy8ctmg110_probe(st
 		goto err_shutoff_device;
 	}
 
-	err = gpio_direction_input(ts->irq_pin);
-	if (err < 0) {
-		dev_err(&client->dev,
-			"Failed to configure input direction for GPIO %d, error %d\n",
-			ts->irq_pin, err);
-		goto err_free_irq_gpio;
-	}
-
 	client->irq = gpio_to_irq(ts->irq_pin);
 	if (client->irq < 0) {
 		err = client->irq;
diff -u -p a/drivers/input/touchscreen/mainstone-wm97xx.c b/drivers/input/touchscreen/mainstone-wm97xx.c
--- a/drivers/input/touchscreen/mainstone-wm97xx.c 2010-02-03 15:05:01.000000000 +0100
+++ b/drivers/input/touchscreen/mainstone-wm97xx.c 2011-03-20 22:00:22.000000000 +0100
@@ -208,16 +208,10 @@ static int wm97xx_acc_startup(struct wm9
 		irq = 4;
 
 	if (irq) {
-		ret = gpio_request(irq, "Touchscreen IRQ");
+		ret = gpio_request_one(irq, GPIOF_IN, "Touchscreen IRQ");
 		if (ret)
 			goto out;
 
-		ret = gpio_direction_input(irq);
-		if (ret) {
-			gpio_free(irq);
-			goto out;
-		}
-
 		wm->pen_irq = gpio_to_irq(irq);
 		set_irq_type(wm->pen_irq, IRQ_TYPE_EDGE_BOTH);
 	} else /* pen irq not supported */
diff -u -p a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c
--- a/drivers/leds/leds-netxbig.c 2010-10-14 18:30:04.000000000 +0200
+++ b/drivers/leds/leds-netxbig.c 2011-03-20 22:00:21.000000000 +0100
@@ -81,35 +81,23 @@ static int __devinit gpio_ext_init(struc
 
 	/* Configure address GPIOs. */
 	for (i = 0; i < gpio_ext->num_addr; i++) {
-		err = gpio_request(gpio_ext->addr[i], "GPIO extension addr");
+		err = gpio_request_one(gpio_ext->addr[i], GPIOF_OUT_INIT_LOW,
+				       "GPIO extension addr");
 		if (err)
 			goto err_free_addr;
-		err = gpio_direction_output(gpio_ext->addr[i], 0);
-		if (err) {
-			gpio_free(gpio_ext->addr[i]);
-			goto err_free_addr;
-		}
 	}
 	/* Configure data GPIOs. */
 	for (i = 0; i < gpio_ext->num_data; i++) {
-		err = gpio_request(gpio_ext->data[i], "GPIO extension data");
+		err = gpio_request_one(gpio_ext->data[i], GPIOF_OUT_INIT_LOW,
+				       "GPIO extension data");
 		if (err)
 			goto err_free_data;
-		err = gpio_direction_output(gpio_ext->data[i], 0);
-		if (err) {
-			gpio_free(gpio_ext->data[i]);
-			goto err_free_data;
-		}
 	}
 	/* Configure "enable select" GPIO. */
-	err = gpio_request(gpio_ext->enable, "GPIO extension enable");
+	err = gpio_request_one(gpio_ext->enable, GPIOF_OUT_INIT_LOW,
+			       "GPIO extension enable");
 	if (err)
 		goto err_free_data;
-	err = gpio_direction_output(gpio_ext->enable, 0);
-	if (err) {
-		gpio_free(gpio_ext->enable);
-		goto err_free_data;
-	}
 
 	return 0;
 
diff -u -p a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
--- a/drivers/mmc/host/omap_hsmmc.c 2011-03-14 17:19:15.000000000 +0100
+++ b/drivers/mmc/host/omap_hsmmc.c 2011-03-20 22:00:24.000000000 +0100
@@ -506,23 +506,19 @@ static int omap_hsmmc_gpio_init(struct o
 			pdata->slots[0].card_detect = omap_hsmmc_card_detect;
 		pdata->slots[0].card_detect_irq =
 				gpio_to_irq(pdata->slots[0].switch_pin);
-		ret = gpio_request(pdata->slots[0].switch_pin, "mmc_cd");
+		ret = gpio_request_one(pdata->slots[0].switch_pin, GPIOF_IN,
+				       "mmc_cd");
 		if (ret)
 			return ret;
-		ret = gpio_direction_input(pdata->slots[0].switch_pin);
-		if (ret)
-			goto err_free_sp;
 	} else
 		pdata->slots[0].switch_pin = -EINVAL;
 
 	if (gpio_is_valid(pdata->slots[0].gpio_wp)) {
 		pdata->slots[0].get_ro = omap_hsmmc_get_wp;
-		ret = gpio_request(pdata->slots[0].gpio_wp, "mmc_wp");
+		ret = gpio_request_one(pdata->slots[0].gpio_wp, GPIOF_IN,
+				       "mmc_wp");
 		if (ret)
 			goto err_free_cd;
-		ret = gpio_direction_input(pdata->slots[0].gpio_wp);
-		if (ret)
-			goto err_free_wp;
 	} else
 		pdata->slots[0].gpio_wp = -EINVAL;
 
diff -u -p a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c
--- a/drivers/mmc/host/sdhci-spear.c 2010-05-29 09:25:20.000000000 +0200
+++ b/drivers/mmc/host/sdhci-spear.c 2011-03-20 22:00:23.000000000 +0100
@@ -182,19 +182,14 @@ static int __devinit sdhci_probe(struct 
 	}
 
 	if (sdhci->data->card_int_gpio >= 0) {
-		ret = gpio_request(sdhci->data->card_int_gpio, "sdhci");
+		ret = gpio_request_one(sdhci->data->card_int_gpio, GPIOF_IN,
+				       "sdhci");
 		if (ret < 0) {
 			dev_dbg(&pdev->dev, "gpio request fail: %d\n",
 					sdhci->data->card_int_gpio);
 			goto err_igpio_request;
 		}
 
-		ret = gpio_direction_input(sdhci->data->card_int_gpio);
-		if (ret) {
-			dev_dbg(&pdev->dev, "gpio set direction fail: %d\n",
-					sdhci->data->card_int_gpio);
-			goto err_igpio_direction;
-		}
 		ret = request_irq(gpio_to_irq(sdhci->data->card_int_gpio),
 				sdhci_gpio_irq, IRQF_TRIGGER_LOW,
 				mmc_hostname(host->mmc), pdev);
diff -u -p a/drivers/pcmcia/pxa2xx_colibri.c b/drivers/pcmcia/pxa2xx_colibri.c
--- a/drivers/pcmcia/pxa2xx_colibri.c 2011-03-14 17:19:16.000000000 +0100
+++ b/drivers/pcmcia/pxa2xx_colibri.c 2011-03-20 22:00:21.000000000 +0100
@@ -54,47 +54,35 @@ static int colibri_pcmcia_hw_init(struct
 {
 	int ret;
 
-	ret = gpio_request(colibri_pcmcia_gpio.detect_gpio, "DETECT");
+	ret = gpio_request_one(colibri_pcmcia_gpio.detect_gpio, GPIOF_IN,
+			       "DETECT");
 	if (ret)
 		goto err1;
-	ret = gpio_direction_input(colibri_pcmcia_gpio.detect_gpio);
-	if (ret)
-		goto err2;
 
-	ret = gpio_request(colibri_pcmcia_gpio.ready_gpio, "READY");
+	ret = gpio_request_one(colibri_pcmcia_gpio.ready_gpio, GPIOF_IN,
+			       "READY");
 	if (ret)
 		goto err2;
-	ret = gpio_direction_input(colibri_pcmcia_gpio.ready_gpio);
-	if (ret)
-		goto err3;
 
-	ret = gpio_request(colibri_pcmcia_gpio.bvd1_gpio, "BVD1");
+	ret = gpio_request_one(colibri_pcmcia_gpio.bvd1_gpio, GPIOF_IN,
+			       "BVD1");
 	if (ret)
 		goto err3;
-	ret = gpio_direction_input(colibri_pcmcia_gpio.bvd1_gpio);
-	if (ret)
-		goto err4;
 
-	ret = gpio_request(colibri_pcmcia_gpio.bvd2_gpio, "BVD2");
+	ret = gpio_request_one(colibri_pcmcia_gpio.bvd2_gpio, GPIOF_IN,
+			       "BVD2");
 	if (ret)
 		goto err4;
-	ret = gpio_direction_input(colibri_pcmcia_gpio.bvd2_gpio);
-	if (ret)
-		goto err5;
 
-	ret = gpio_request(colibri_pcmcia_gpio.ppen_gpio, "PPEN");
+	ret = gpio_request_one(colibri_pcmcia_gpio.ppen_gpio,
+			       GPIOF_OUT_INIT_LOW, "PPEN");
 	if (ret)
 		goto err5;
-	ret = gpio_direction_output(colibri_pcmcia_gpio.ppen_gpio, 0);
-	if (ret)
-		goto err6;
 
-	ret = gpio_request(colibri_pcmcia_gpio.reset_gpio, "RESET");
+	ret = gpio_request_one(colibri_pcmcia_gpio.reset_gpio,
+			       GPIOF_OUT_INIT_HIGH, "RESET");
 	if (ret)
 		goto err6;
-	ret = gpio_direction_output(colibri_pcmcia_gpio.reset_gpio, 1);
-	if (ret)
-		goto err7;
 
 	colibri_irqs[0].irq = gpio_to_irq(colibri_pcmcia_gpio.detect_gpio);
 	skt->socket.pci_irq = gpio_to_irq(colibri_pcmcia_gpio.ready_gpio);
diff -u -p a/drivers/pcmcia/pxa2xx_palmld.c b/drivers/pcmcia/pxa2xx_palmld.c
--- a/drivers/pcmcia/pxa2xx_palmld.c 2009-11-08 21:45:05.000000000 +0100
+++ b/drivers/pcmcia/pxa2xx_palmld.c 2011-03-20 22:00:25.000000000 +0100
@@ -24,26 +24,20 @@ static int palmld_pcmcia_hw_init(struct 
 {
 	int ret;
 
-	ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_POWER, "PCMCIA PWR");
+	ret = gpio_request_one(GPIO_NR_PALMLD_PCMCIA_POWER,
+			       GPIOF_OUT_INIT_LOW, "PCMCIA PWR");
 	if (ret)
 		goto err1;
-	ret = gpio_direction_output(GPIO_NR_PALMLD_PCMCIA_POWER, 0);
-	if (ret)
-		goto err2;
 
-	ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_RESET, "PCMCIA RST");
+	ret = gpio_request_one(GPIO_NR_PALMLD_PCMCIA_RESET,
+			       GPIOF_OUT_INIT_HIGH, "PCMCIA RST");
 	if (ret)
 		goto err2;
-	ret = gpio_direction_output(GPIO_NR_PALMLD_PCMCIA_RESET, 1);
-	if (ret)
-		goto err3;
 
-	ret = gpio_request(GPIO_NR_PALMLD_PCMCIA_READY, "PCMCIA RDY");
+	ret = gpio_request_one(GPIO_NR_PALMLD_PCMCIA_READY, GPIOF_IN,
+			       "PCMCIA RDY");
 	if (ret)
 		goto err3;
-	ret = gpio_direction_input(GPIO_NR_PALMLD_PCMCIA_READY);
-	if (ret)
-		goto err4;
 
 	skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY);
 	return 0;
diff -u -p a/drivers/pcmcia/pxa2xx_palmtc.c b/drivers/pcmcia/pxa2xx_palmtc.c
--- a/drivers/pcmcia/pxa2xx_palmtc.c 2009-12-17 08:30:14.000000000 +0100
+++ b/drivers/pcmcia/pxa2xx_palmtc.c 2011-03-20 22:00:21.000000000 +0100
@@ -25,47 +25,35 @@ static int palmtc_pcmcia_hw_init(struct 
 {
 	int ret;
 
-	ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER1, "PCMCIA PWR1");
+	ret = gpio_request_one(GPIO_NR_PALMTC_PCMCIA_POWER1,
+			       GPIOF_OUT_INIT_LOW, "PCMCIA PWR1");
 	if (ret)
 		goto err1;
-	ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER1, 0);
-	if (ret)
-		goto err2;
 
-	ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER2, "PCMCIA PWR2");
+	ret = gpio_request_one(GPIO_NR_PALMTC_PCMCIA_POWER2,
+			       GPIOF_OUT_INIT_LOW, "PCMCIA PWR2");
 	if (ret)
 		goto err2;
-	ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER2, 0);
-	if (ret)
-		goto err3;
 
-	ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_POWER3, "PCMCIA PWR3");
+	ret = gpio_request_one(GPIO_NR_PALMTC_PCMCIA_POWER3,
+			       GPIOF_OUT_INIT_LOW, "PCMCIA PWR3");
 	if (ret)
 		goto err3;
-	ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_POWER3, 0);
-	if (ret)
-		goto err4;
 
-	ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_RESET, "PCMCIA RST");
+	ret = gpio_request_one(GPIO_NR_PALMTC_PCMCIA_RESET,
+			       GPIOF_OUT_INIT_HIGH, "PCMCIA RST");
 	if (ret)
 		goto err4;
-	ret = gpio_direction_output(GPIO_NR_PALMTC_PCMCIA_RESET, 1);
-	if (ret)
-		goto err5;
 
-	ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_READY, "PCMCIA RDY");
+	ret = gpio_request_one(GPIO_NR_PALMTC_PCMCIA_READY, GPIOF_IN,
+			       "PCMCIA RDY");
 	if (ret)
 		goto err5;
-	ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_READY);
-	if (ret)
-		goto err6;
 
-	ret = gpio_request(GPIO_NR_PALMTC_PCMCIA_PWRREADY, "PCMCIA PWRRDY");
+	ret = gpio_request_one(GPIO_NR_PALMTC_PCMCIA_PWRREADY, GPIOF_IN,
+			       "PCMCIA PWRRDY");
 	if (ret)
 		goto err6;
-	ret = gpio_direction_input(GPIO_NR_PALMTC_PCMCIA_PWRREADY);
-	if (ret)
-		goto err7;
 
 	skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMTC_PCMCIA_READY);
 	return 0;
diff -u -p a/drivers/pcmcia/pxa2xx_palmtx.c b/drivers/pcmcia/pxa2xx_palmtx.c
--- a/drivers/pcmcia/pxa2xx_palmtx.c 2009-11-08 21:45:05.000000000 +0100
+++ b/drivers/pcmcia/pxa2xx_palmtx.c 2011-03-20 22:00:25.000000000 +0100
@@ -25,33 +25,25 @@ static int palmtx_pcmcia_hw_init(struct 
 {
 	int ret;
 
-	ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_POWER1, "PCMCIA PWR1");
+	ret = gpio_request_one(GPIO_NR_PALMTX_PCMCIA_POWER1,
+			       GPIOF_OUT_INIT_LOW, "PCMCIA PWR1");
 	if (ret)
 		goto err1;
-	ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_POWER1, 0);
-	if (ret)
-		goto err2;
 
-	ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_POWER2, "PCMCIA PWR2");
+	ret = gpio_request_one(GPIO_NR_PALMTX_PCMCIA_POWER2,
+			       GPIOF_OUT_INIT_LOW, "PCMCIA PWR2");
 	if (ret)
 		goto err2;
-	ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_POWER2, 0);
-	if (ret)
-		goto err3;
 
-	ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_RESET, "PCMCIA RST");
+	ret = gpio_request_one(GPIO_NR_PALMTX_PCMCIA_RESET,
+			       GPIOF_OUT_INIT_HIGH, "PCMCIA RST");
 	if (ret)
 		goto err3;
-	ret = gpio_direction_output(GPIO_NR_PALMTX_PCMCIA_RESET, 1);
-	if (ret)
-		goto err4;
 
-	ret = gpio_request(GPIO_NR_PALMTX_PCMCIA_READY, "PCMCIA RDY");
+	ret = gpio_request_one(GPIO_NR_PALMTX_PCMCIA_READY, GPIOF_IN,
+			       "PCMCIA RDY");
 	if (ret)
 		goto err4;
-	ret = gpio_direction_input(GPIO_NR_PALMTX_PCMCIA_READY);
-	if (ret)
-		goto err5;
 
 	skt->socket.pci_irq = gpio_to_irq(GPIO_NR_PALMTX_PCMCIA_READY);
 	return 0;
diff -u -p a/drivers/pcmcia/pxa2xx_vpac270.c b/drivers/pcmcia/pxa2xx_vpac270.c
--- a/drivers/pcmcia/pxa2xx_vpac270.c 2010-05-19 22:36:14.000000000 +0200
+++ b/drivers/pcmcia/pxa2xx_vpac270.c 2011-03-20 22:00:25.000000000 +0100
@@ -40,33 +40,25 @@ static int vpac270_pcmcia_hw_init(struct
 	int ret;
 
 	if (skt->nr == 0) {
-		ret = gpio_request(GPIO84_VPAC270_PCMCIA_CD, "PCMCIA CD");
+		ret = gpio_request_one(GPIO84_VPAC270_PCMCIA_CD, GPIOF_IN,
+				       "PCMCIA CD");
 		if (ret)
 			goto err1;
-		ret = gpio_direction_input(GPIO84_VPAC270_PCMCIA_CD);
-		if (ret)
-			goto err2;
 
-		ret = gpio_request(GPIO35_VPAC270_PCMCIA_RDY, "PCMCIA RDY");
+		ret = gpio_request_one(GPIO35_VPAC270_PCMCIA_RDY, GPIOF_IN,
+				       "PCMCIA RDY");
 		if (ret)
 			goto err2;
-		ret = gpio_direction_input(GPIO35_VPAC270_PCMCIA_RDY);
-		if (ret)
-			goto err3;
 
-		ret = gpio_request(GPIO107_VPAC270_PCMCIA_PPEN, "PCMCIA PPEN");
+		ret = gpio_request_one(GPIO107_VPAC270_PCMCIA_PPEN,
+				       GPIOF_OUT_INIT_LOW, "PCMCIA PPEN");
 		if (ret)
 			goto err3;
-		ret = gpio_direction_output(GPIO107_VPAC270_PCMCIA_PPEN, 0);
-		if (ret)
-			goto err4;
 
-		ret = gpio_request(GPIO11_VPAC270_PCMCIA_RESET, "PCMCIA RESET");
+		ret = gpio_request_one(GPIO11_VPAC270_PCMCIA_RESET,
+				       GPIOF_OUT_INIT_LOW, "PCMCIA RESET");
 		if (ret)
 			goto err4;
-		ret = gpio_direction_output(GPIO11_VPAC270_PCMCIA_RESET, 0);
-		if (ret)
-			goto err5;
 
 		skt->socket.pci_irq = gpio_to_irq(GPIO35_VPAC270_PCMCIA_RDY);
 
@@ -84,26 +76,20 @@ err1:
 		return ret;
 
 	} else {
-		ret = gpio_request(GPIO17_VPAC270_CF_CD, "CF CD");
+		ret = gpio_request_one(GPIO17_VPAC270_CF_CD, GPIOF_IN,
+				       "CF CD");
 		if (ret)
 			goto err6;
-		ret = gpio_direction_input(GPIO17_VPAC270_CF_CD);
-		if (ret)
-			goto err7;
 
-		ret = gpio_request(GPIO12_VPAC270_CF_RDY, "CF RDY");
+		ret = gpio_request_one(GPIO12_VPAC270_CF_RDY, GPIOF_IN,
+				       "CF RDY");
 		if (ret)
 			goto err7;
-		ret = gpio_direction_input(GPIO12_VPAC270_CF_RDY);
-		if (ret)
-			goto err8;
 
-		ret = gpio_request(GPIO16_VPAC270_CF_RESET, "CF RESET");
+		ret = gpio_request_one(GPIO16_VPAC270_CF_RESET,
+				       GPIOF_OUT_INIT_LOW, "CF RESET");
 		if (ret)
 			goto err8;
-		ret = gpio_direction_output(GPIO16_VPAC270_CF_RESET, 0);
-		if (ret)
-			goto err9;
 
 		skt->socket.pci_irq = gpio_to_irq(GPIO12_VPAC270_CF_RDY);
 
diff -u -p a/drivers/pcmcia/sa1100_h3600.c b/drivers/pcmcia/sa1100_h3600.c
--- a/drivers/pcmcia/sa1100_h3600.c 2010-11-13 10:26:38.000000000 +0100
+++ b/drivers/pcmcia/sa1100_h3600.c 2011-03-20 22:00:25.000000000 +0100
@@ -30,65 +30,50 @@ static int h3600_pcmcia_hw_init(struct s
 
 	switch (skt->nr) {
 	case 0:
-		err = gpio_request(H3XXX_GPIO_PCMCIA_IRQ0, "PCMCIA IRQ0");
+		err = gpio_request_one(H3XXX_GPIO_PCMCIA_IRQ0, GPIOF_IN,
+				       "PCMCIA IRQ0");
 		if (err)
 			goto err00;
-		err = gpio_direction_input(H3XXX_GPIO_PCMCIA_IRQ0);
-		if (err)
-			goto err01;
 		skt->socket.pci_irq = gpio_to_irq(H3XXX_GPIO_PCMCIA_IRQ0);
 
-		err = gpio_request(H3XXX_GPIO_PCMCIA_CD0, "PCMCIA CD0");
+		err = gpio_request_one(H3XXX_GPIO_PCMCIA_CD0, GPIOF_IN,
+				       "PCMCIA CD0");
 		if (err)
 			goto err01;
-		err = gpio_direction_input(H3XXX_GPIO_PCMCIA_CD0);
-		if (err)
-			goto err02;
 		irqs[0].irq = gpio_to_irq(H3XXX_GPIO_PCMCIA_CD0);
 
-		err = gpio_request(H3XXX_EGPIO_OPT_NVRAM_ON, "OPT NVRAM ON");
+		err = gpio_request_one(H3XXX_EGPIO_OPT_NVRAM_ON,
+				       GPIOF_OUT_INIT_LOW, "OPT NVRAM ON");
 		if (err)
 			goto err02;
-		err = gpio_direction_output(H3XXX_EGPIO_OPT_NVRAM_ON, 0);
+		err = gpio_request_one(H3XXX_EGPIO_OPT_ON,
+				       GPIOF_OUT_INIT_LOW, "OPT ON");
 		if (err)
 			goto err03;
-		err = gpio_request(H3XXX_EGPIO_OPT_ON, "OPT ON");
-		if (err)
-			goto err03;
-		err = gpio_direction_output(H3XXX_EGPIO_OPT_ON, 0);
-		if (err)
-			goto err04;
-		err = gpio_request(H3XXX_EGPIO_OPT_RESET, "OPT RESET");
+		err = gpio_request_one(H3XXX_EGPIO_OPT_RESET,
+				       GPIOF_OUT_INIT_LOW, "OPT RESET");
 		if (err)
 			goto err04;
-		err = gpio_direction_output(H3XXX_EGPIO_OPT_RESET, 0);
+		err = gpio_request_one(H3XXX_EGPIO_CARD_RESET,
+				       GPIOF_OUT_INIT_LOW,
+				       "PCMCIA CARD RESET");
 		if (err)
 			goto err05;
-		err = gpio_request(H3XXX_EGPIO_CARD_RESET, "PCMCIA CARD RESET");
-		if (err)
-			goto err05;
-		err = gpio_direction_output(H3XXX_EGPIO_CARD_RESET, 0);
-		if (err)
-			goto err06;
 		err = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
 		if (err)
 			goto err06;
 		break;
 	case 1:
-		err = gpio_request(H3XXX_GPIO_PCMCIA_IRQ1, "PCMCIA IRQ1");
+		err = gpio_request_one(H3XXX_GPIO_PCMCIA_IRQ1, GPIOF_IN,
+				       "PCMCIA IRQ1");
 		if (err)
 			goto err10;
-		err = gpio_direction_input(H3XXX_GPIO_PCMCIA_IRQ1);
-		if (err)
-			goto err11;
 		skt->socket.pci_irq = gpio_to_irq(H3XXX_GPIO_PCMCIA_IRQ1);
 
-		err = gpio_request(H3XXX_GPIO_PCMCIA_CD1, "PCMCIA CD1");
+		err = gpio_request_one(H3XXX_GPIO_PCMCIA_CD1, GPIOF_IN,
+				       "PCMCIA CD1");
 		if (err)
 			goto err11;
-		err = gpio_direction_input(H3XXX_GPIO_PCMCIA_CD1);
-		if (err)
-			goto err12;
 		irqs[1].irq = gpio_to_irq(H3XXX_GPIO_PCMCIA_CD1);
 
 		err = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
diff -u -p a/drivers/power/bq20z75.c b/drivers/power/bq20z75.c
--- a/drivers/power/bq20z75.c 2011-03-20 18:17:23.000000000 +0100
+++ b/drivers/power/bq20z75.c 2011-03-20 22:00:24.000000000 +0100
@@ -578,21 +578,14 @@ static int __devinit bq20z75_probe(struc
 	if (!bq20z75_device->gpio_detect)
 		goto skip_gpio;
 
-	rc = gpio_request(pdata->battery_detect, dev_name(&client->dev));
+	rc = gpio_request_one(pdata->battery_detect, GPIOF_IN,
+			      dev_name(&client->dev));
 	if (rc) {
 		dev_warn(&client->dev, "Failed to request gpio: %d\n", rc);
 		bq20z75_device->gpio_detect = false;
 		goto skip_gpio;
 	}
 
-	rc = gpio_direction_input(pdata->battery_detect);
-	if (rc) {
-		dev_warn(&client->dev, "Failed to get gpio as input: %d\n", rc);
-		gpio_free(pdata->battery_detect);
-		bq20z75_device->gpio_detect = false;
-		goto skip_gpio;
-	}
-
 	irq = gpio_to_irq(pdata->battery_detect);
 	if (irq <= 0) {
 		dev_warn(&client->dev, "Failed to get gpio as irq: %d\n", irq);
diff -u -p a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c
--- a/drivers/power/gpio-charger.c 2010-12-28 18:26:04.000000000 +0100
+++ b/drivers/power/gpio-charger.c 2011-03-20 22:00:24.000000000 +0100
@@ -102,16 +102,11 @@ static int __devinit gpio_charger_probe(
 	charger->supplied_to = pdata->supplied_to;
 	charger->num_supplicants = pdata->num_supplicants;
 
-	ret = gpio_request(pdata->gpio, dev_name(&pdev->dev));
+	ret = gpio_request_one(pdata->gpio, GPIOF_IN, dev_name(&pdev->dev));
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to request gpio pin: %d\n", ret);
 		goto err_free;
 	}
-	ret = gpio_direction_input(pdata->gpio);
-	if (ret) {
-		dev_err(&pdev->dev, "Failed to set gpio to input: %d\n", ret);
-		goto err_gpio_free;
-	}
 
 	gpio_charger->pdata = pdata;
 
diff -u -p a/drivers/power/jz4740-battery.c b/drivers/power/jz4740-battery.c
--- a/drivers/power/jz4740-battery.c 2011-03-14 17:19:16.000000000 +0100
+++ b/drivers/power/jz4740-battery.c 2011-03-20 22:00:24.000000000 +0100
@@ -316,16 +316,12 @@ static int __devinit jz_battery_probe(st
 	disable_irq(jz_battery->irq);
 
 	if (gpio_is_valid(pdata->gpio_charge)) {
-		ret = gpio_request(pdata->gpio_charge, dev_name(&pdev->dev));
+		ret = gpio_request_one(pdata->gpio_charge, GPIOF_IN,
+				       dev_name(&pdev->dev));
 		if (ret) {
 			dev_err(&pdev->dev, "charger state gpio request failed.\n");
 			goto err_free_irq;
 		}
-		ret = gpio_direction_input(pdata->gpio_charge);
-		if (ret) {
-			dev_err(&pdev->dev, "charger state gpio set direction failed.\n");
-			goto err_free_gpio;
-		}
 
 		jz_battery->charge_irq = gpio_to_irq(pdata->gpio_charge);
 
diff -u -p a/drivers/power/wm97xx_battery.c b/drivers/power/wm97xx_battery.c
--- a/drivers/power/wm97xx_battery.c 2010-12-28 18:26:04.000000000 +0100
+++ b/drivers/power/wm97xx_battery.c 2011-03-20 22:00:25.000000000 +0100
@@ -189,12 +189,10 @@ static int __devinit wm97xx_bat_probe(st
 	}
 
 	if (gpio_is_valid(pdata->charge_gpio)) {
-		ret = gpio_request(pdata->charge_gpio, "BATT CHRG");
+		ret = gpio_request_one(pdata->charge_gpio, GPIOF_IN,
+				       "BATT CHRG");
 		if (ret)
 			goto err;
-		ret = gpio_direction_input(pdata->charge_gpio);
-		if (ret)
-			goto err2;
 		ret = request_irq(gpio_to_irq(pdata->charge_gpio),
 				wm97xx_chrg_irq, IRQF_DISABLED,
 				"AC Detect", dev);
diff -u -p a/drivers/power/z2_battery.c b/drivers/power/z2_battery.c
--- a/drivers/power/z2_battery.c 2011-03-20 18:17:23.000000000 +0100
+++ b/drivers/power/z2_battery.c 2011-03-20 22:00:24.000000000 +0100
@@ -207,14 +207,11 @@ static int __devinit z2_batt_probe(struc
 	mutex_init(&charger->work_lock);
 
 	if (info->charge_gpio >= 0 && gpio_is_valid(info->charge_gpio)) {
-		ret = gpio_request(info->charge_gpio, "BATT CHRG");
+		ret = gpio_request_one(info->charge_gpio, GPIOF_IN,
+				       "BATT CHRG");
 		if (ret)
 			goto err;
 
-		ret = gpio_direction_input(info->charge_gpio);
-		if (ret)
-			goto err2;
-
 		set_irq_type(gpio_to_irq(info->charge_gpio),
 				IRQ_TYPE_EDGE_BOTH);
 		ret = request_irq(gpio_to_irq(info->charge_gpio),
diff -u -p a/drivers/staging/cptm1217/clearpad_tm1217.c b/drivers/staging/cptm1217/clearpad_tm1217.c
--- a/drivers/staging/cptm1217/clearpad_tm1217.c 2010-11-24 07:55:12.000000000 +0100
+++ b/drivers/staging/cptm1217/clearpad_tm1217.c 2011-03-20 22:00:24.000000000 +0100
@@ -378,22 +378,13 @@ static int cp_tm1217_setup_gpio_irq(stru
 	int retval;
 
 	/* Hook up the irq handler */
-	retval = gpio_request(ts->gpio, "cp_tm1217_touch");
+	retval = gpio_request_one(ts->gpio, GPIOF_IN, "cp_tm1217_touch");
 	if (retval < 0) {
 		dev_err(ts->dev, "cp_tm1217: GPIO request failed error %d\n",
 								retval);
 		return retval;
 	}
 
-	retval = gpio_direction_input(ts->gpio);
-	if (retval < 0) {
-		dev_err(ts->dev,
-		"cp_tm1217: GPIO direction configuration failed, error %d\n",
-								retval);
-		gpio_free(ts->gpio);
-		return retval;
-	}
-
 	retval = gpio_to_irq(ts->gpio);
 	if (retval < 0) {
 		dev_err(ts->dev, "cp_tm1217: GPIO to IRQ failedi,"
diff -u -p a/drivers/staging/iio/magnetometer/ak8975.c b/drivers/staging/iio/magnetometer/ak8975.c
--- a/drivers/staging/iio/magnetometer/ak8975.c 2010-09-18 08:59:06.000000000 +0200
+++ b/drivers/staging/iio/magnetometer/ak8975.c 2011-03-20 22:00:24.000000000 +0100
@@ -460,20 +460,13 @@ static int ak8975_probe(struct i2c_clien
 		goto exit_free;
 	}
 
-	err = gpio_request(data->eoc_gpio, "ak_8975");
+	err = gpio_request_one(data->eoc_gpio, GPIOF_IN, "ak_8975");
 	if (err < 0) {
 		dev_err(&client->dev, "failed to request GPIO %d, error %d\n",
 			data->eoc_gpio, err);
 		goto exit_free;
 	}
 
-	err = gpio_direction_input(data->eoc_gpio);
-	if (err < 0) {
-		dev_err(&client->dev, "Failed to configure input direction for"
-			" GPIO %d, error %d\n", data->eoc_gpio, err);
-		goto exit_gpio;
-	}
-
 	/* Perform some basic start-of-day setup of the device. */
 	err = ak8975_setup(client);
 	if (err < 0) {
diff -u -p a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c
--- a/drivers/video/backlight/l4f00242t03.c 2011-01-19 18:51:19.000000000 +0100
+++ b/drivers/video/backlight/l4f00242t03.c 2011-03-20 22:00:21.000000000 +0100
@@ -178,29 +178,22 @@ static int __devinit l4f00242t03_probe(s
 
 	priv->spi = spi;
 
-	ret = gpio_request(pdata->reset_gpio, "lcd l4f00242t03 reset");
+	ret = gpio_request_one(pdata->reset_gpio, GPIOF_OUT_INIT_HIGH,
+			       "lcd l4f00242t03 reset");
 	if (ret) {
 		dev_err(&spi->dev,
 			"Unable to get the lcd l4f00242t03 reset gpio.\n");
 		goto err;
 	}
 
-	ret = gpio_direction_output(pdata->reset_gpio, 1);
-	if (ret)
-		goto err2;
-
-	ret = gpio_request(pdata->data_enable_gpio,
-				"lcd l4f00242t03 data enable");
+	ret = gpio_request_one(pdata->data_enable_gpio, GPIOF_OUT_INIT_LOW,
+			       "lcd l4f00242t03 data enable");
 	if (ret) {
 		dev_err(&spi->dev,
 			"Unable to get the lcd l4f00242t03 data en gpio.\n");
 		goto err2;
 	}
 
-	ret = gpio_direction_output(pdata->data_enable_gpio, 0);
-	if (ret)
-		goto err3;
-
 	if (pdata->io_supply) {
 		priv->io_reg = regulator_get(NULL, pdata->io_supply);
 
diff -u -p a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c
--- a/drivers/video/backlight/tosa_bl.c 2010-06-04 16:56:16.000000000 +0200
+++ b/drivers/video/backlight/tosa_bl.c 2011-03-20 22:00:21.000000000 +0100
@@ -89,14 +89,12 @@ static int __devinit tosa_bl_probe(struc
 
 	data->comadj = sharpsl_param.comadj == -1 ? COMADJ_DEFAULT : sharpsl_param.comadj;
 
-	ret = gpio_request(TOSA_GPIO_BL_C20MA, "backlight");
+	ret = gpio_request_one(TOSA_GPIO_BL_C20MA, GPIOF_OUT_INIT_LOW,
+			       "backlight");
 	if (ret) {
 		dev_dbg(&data->bl->dev, "Unable to request gpio!\n");
 		goto err_gpio_bl;
 	}
-	ret = gpio_direction_output(TOSA_GPIO_BL_C20MA, 0);
-	if (ret)
-		goto err_gpio_dir;
 
 	i2c_set_clientdata(client, data);
 	data->i2c = client;
diff -u -p a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c
--- a/drivers/video/backlight/tosa_lcd.c 2010-03-29 19:27:58.000000000 +0200
+++ b/drivers/video/backlight/tosa_lcd.c 2011-03-20 22:00:21.000000000 +0100
@@ -192,16 +192,12 @@ static int __devinit tosa_lcd_probe(stru
 	data->spi = spi;
 	dev_set_drvdata(&spi->dev, data);
 
-	ret = gpio_request(TOSA_GPIO_TG_ON, "tg #pwr");
+	ret = gpio_request_one(TOSA_GPIO_TG_ON, GPIOF_OUT_INIT_LOW, "tg #pwr");
 	if (ret < 0)
 		goto err_gpio_tg;
 
 	mdelay(60);
 
-	ret = gpio_direction_output(TOSA_GPIO_TG_ON, 0);
-	if (ret < 0)
-		goto err_gpio_dir;
-
 	mdelay(60);
 	tosa_lcd_tg_init(data);
 
diff -u -p a/drivers/video/msm/mddi_client_nt35399.c b/drivers/video/msm/mddi_client_nt35399.c
--- a/drivers/video/msm/mddi_client_nt35399.c 2010-03-29 19:27:59.000000000 +0200
+++ b/drivers/video/msm/mddi_client_nt35399.c 2011-03-20 22:00:26.000000000 +0100
@@ -155,14 +155,10 @@ static int setup_vsync(struct panel_info
 		ret = 0;
 		goto uninit;
 	}
-	ret = gpio_request(gpio, "vsync");
+	ret = gpio_request_one(gpio, GPIOF_IN, "vsync");
 	if (ret)
 		goto err_request_gpio_failed;
 
-	ret = gpio_direction_input(gpio);
-	if (ret)
-		goto err_gpio_direction_input_failed;
-
 	ret = irq = gpio_to_irq(gpio);
 	if (ret < 0)
 		goto err_get_irq_num_failed;
diff -u -p a/drivers/video/msm/mddi_client_toshiba.c b/drivers/video/msm/mddi_client_toshiba.c
--- a/drivers/video/msm/mddi_client_toshiba.c 2010-03-29 19:27:59.000000000 +0200
+++ b/drivers/video/msm/mddi_client_toshiba.c 2011-03-20 22:00:26.000000000 +0100
@@ -186,14 +186,10 @@ static int setup_vsync(struct panel_info
 		ret = 0;
 		goto uninit;
 	}
-	ret = gpio_request(gpio, "vsync");
+	ret = gpio_request_one(gpio, GPIOF_IN, "vsync");
 	if (ret)
 		goto err_request_gpio_failed;
 
-	ret = gpio_direction_input(gpio);
-	if (ret)
-		goto err_gpio_direction_input_failed;
-
 	ret = irq = gpio_to_irq(gpio);
 	if (ret < 0)
 		goto err_get_irq_num_failed;
diff -u -p a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
--- a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c 2010-10-23 19:40:32.000000000 +0200
+++ b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c 2011-03-20 22:00:26.000000000 +0100
@@ -406,17 +406,12 @@ static int tpo_td043_probe(struct omap_d
 	}
 
 	if (gpio_is_valid(nreset_gpio)) {
-		ret = gpio_request(nreset_gpio, "lcd reset");
+		ret = gpio_request_one(nreset_gpio, GPIOF_OUT_INIT_LOW,
+				       "lcd reset");
 		if (ret < 0) {
 			dev_err(&dssdev->dev, "couldn't request reset GPIO\n");
 			goto fail_gpio_req;
 		}
-
-		ret = gpio_direction_output(nreset_gpio, 0);
-		if (ret < 0) {
-			dev_err(&dssdev->dev, "couldn't set GPIO direction\n");
-			goto fail_gpio_direction;
-		}
 	}
 
 	ret = sysfs_create_group(&dssdev->dev.kobj, &tpo_td043_attr_group);
diff -u -p a/drivers/watchdog/wm831x_wdt.c b/drivers/watchdog/wm831x_wdt.c
--- a/drivers/watchdog/wm831x_wdt.c 2010-03-05 23:55:32.000000000 +0100
+++ b/drivers/watchdog/wm831x_wdt.c 2011-03-20 22:00:25.000000000 +0100
@@ -350,8 +350,9 @@ static int __devinit wm831x_wdt_probe(st
 		reg |= pdata->software << WM831X_WDOG_RST_SRC_SHIFT;
 
 		if (pdata->update_gpio) {
-			ret = gpio_request(pdata->update_gpio,
-					   "Watchdog update");
+			ret = gpio_request_one(pdata->update_gpio,
+					       GPIOF_OUT_INIT_LOW,
+					       "Watchdog update");
 			if (ret < 0) {
 				dev_err(wm831x->dev,
 					"Failed to request update GPIO: %d\n",
@@ -359,14 +360,6 @@ static int __devinit wm831x_wdt_probe(st
 				goto err;
 			}
 
-			ret = gpio_direction_output(pdata->update_gpio, 0);
-			if (ret != 0) {
-				dev_err(wm831x->dev,
-					"gpio_direction_output returned: %d\n",
-					ret);
-				goto err_gpio;
-			}
-
 			update_gpio = pdata->update_gpio;
 
 			/* Make sure the watchdog takes hardware updates */
diff -u -p a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
--- a/sound/soc/codecs/twl6040.c 2011-02-02 17:27:40.000000000 +0100
+++ b/sound/soc/codecs/twl6040.c 2011-03-20 22:00:23.000000000 +0100
@@ -1641,14 +1641,11 @@ static int twl6040_probe(struct snd_soc_
 	init_completion(&priv->handsfree.ramp_done);
 
 	if (gpio_is_valid(audpwron)) {
-		ret = gpio_request(audpwron, "audpwron");
+		ret = gpio_request_one(audpwron, GPIOF_OUT_INIT_LOW,
+				       "audpwron");
 		if (ret)
 			goto gpio1_err;
 
-		ret = gpio_direction_output(audpwron, 0);
-		if (ret)
-			goto gpio2_err;
-
 		priv->codec_powered = 0;
 
 		/* enable only codec ready interrupt */
diff -u -p a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c
--- a/sound/soc/codecs/uda1380.c 2010-12-31 15:18:31.000000000 +0100
+++ b/sound/soc/codecs/uda1380.c 2011-03-20 22:00:24.000000000 +0100
@@ -732,21 +732,17 @@ static int uda1380_probe(struct snd_soc_
 		return -EINVAL;
 
 	if (gpio_is_valid(pdata->gpio_reset)) {
-		ret = gpio_request(pdata->gpio_reset, "uda1380 reset");
+		ret = gpio_request_one(pdata->gpio_reset, GPIOF_OUT_INIT_LOW,
+				       "uda1380 reset");
 		if (ret)
 			goto err_out;
-		ret = gpio_direction_output(pdata->gpio_reset, 0);
-		if (ret)
-			goto err_gpio_reset_conf;
 	}
 
 	if (gpio_is_valid(pdata->gpio_power)) {
-		ret = gpio_request(pdata->gpio_power, "uda1380 power");
+		ret = gpio_request_one(pdata->gpio_power, GPIOF_OUT_INIT_LOW,
+				       "uda1380 power");
 		if (ret)
 			goto err_gpio;
-		ret = gpio_direction_output(pdata->gpio_power, 0);
-		if (ret)
-			goto err_gpio_power_conf;
 	} else {
 		ret = uda1380_reset(codec);
 		if (ret) {
diff -u -p a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c
--- a/sound/soc/omap/omap3pandora.c 2010-12-04 18:54:36.000000000 +0100
+++ b/sound/soc/omap/omap3pandora.c 2011-03-20 22:00:22.000000000 +0100
@@ -263,30 +263,20 @@ static int __init omap3pandora_soc_init(
 
 	pr_info("OMAP3 Pandora SoC init\n");
 
-	ret = gpio_request(OMAP3_PANDORA_DAC_POWER_GPIO, "dac_power");
+	ret = gpio_request_one(OMAP3_PANDORA_DAC_POWER_GPIO,
+			       GPIOF_OUT_INIT_LOW, "dac_power");
 	if (ret) {
 		pr_err(PREFIX "Failed to get DAC power GPIO\n");
 		return ret;
 	}
 
-	ret = gpio_direction_output(OMAP3_PANDORA_DAC_POWER_GPIO, 0);
-	if (ret) {
-		pr_err(PREFIX "Failed to set DAC power GPIO direction\n");
-		goto fail0;
-	}
-
-	ret = gpio_request(OMAP3_PANDORA_AMP_POWER_GPIO, "amp_power");
+	ret = gpio_request_one(OMAP3_PANDORA_AMP_POWER_GPIO,
+			       GPIOF_OUT_INIT_LOW, "amp_power");
 	if (ret) {
 		pr_err(PREFIX "Failed to get amp power GPIO\n");
 		goto fail0;
 	}
 
-	ret = gpio_direction_output(OMAP3_PANDORA_AMP_POWER_GPIO, 0);
-	if (ret) {
-		pr_err(PREFIX "Failed to set amp power GPIO direction\n");
-		goto fail1;
-	}
-
 	omap3pandora_snd_device = platform_device_alloc("soc-audio", -1);
 	if (omap3pandora_snd_device == NULL) {
 		pr_err(PREFIX "Platform device allocation failed\n");
diff -u -p a/sound/soc/pxa/e740_wm9705.c b/sound/soc/pxa/e740_wm9705.c
--- a/sound/soc/pxa/e740_wm9705.c 2011-03-14 17:19:19.000000000 +0100
+++ b/sound/soc/pxa/e740_wm9705.c 2011-03-20 22:00:22.000000000 +0100
@@ -148,29 +148,21 @@ static int __init e740_init(void)
 	if (!machine_is_e740())
 		return -ENODEV;
 
-	ret = gpio_request(GPIO_E740_MIC_ON,  "Mic amp");
+	ret = gpio_request_one(GPIO_E740_MIC_ON, GPIOF_OUT_INIT_LOW,
+			       "Mic amp");
 	if (ret)
 		return ret;
 
-	ret = gpio_request(GPIO_E740_AMP_ON, "Output amp");
+	ret = gpio_request_one(GPIO_E740_AMP_ON, GPIOF_OUT_INIT_LOW,
+			       "Output amp");
 	if (ret)
 		goto free_mic_amp_gpio;
 
-	ret = gpio_request(GPIO_E740_WM9705_nAVDD2, "Audio power");
+	ret = gpio_request_one(GPIO_E740_WM9705_nAVDD2, GPIOF_OUT_INIT_HIGH,
+			       "Audio power");
 	if (ret)
 		goto free_op_amp_gpio;
 
-	/* Disable audio */
-	ret = gpio_direction_output(GPIO_E740_MIC_ON, 0);
-	if (ret)
-		goto free_apwr_gpio;
-	ret = gpio_direction_output(GPIO_E740_AMP_ON, 0);
-	if (ret)
-		goto free_apwr_gpio;
-	ret = gpio_direction_output(GPIO_E740_WM9705_nAVDD2, 1);
-	if (ret)
-		goto free_apwr_gpio;
-
 	e740_snd_device = platform_device_alloc("soc-audio", -1);
 	if (!e740_snd_device) {
 		ret = -ENOMEM;
diff -u -p a/sound/soc/pxa/e750_wm9705.c b/sound/soc/pxa/e750_wm9705.c
--- a/sound/soc/pxa/e750_wm9705.c 2011-03-14 17:19:19.000000000 +0100
+++ b/sound/soc/pxa/e750_wm9705.c 2011-03-20 22:00:22.000000000 +0100
@@ -131,22 +131,16 @@ static int __init e750_init(void)
 	if (!machine_is_e750())
 		return -ENODEV;
 
-	ret = gpio_request(GPIO_E750_HP_AMP_OFF,  "Headphone amp");
+	ret = gpio_request_one(GPIO_E750_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH,
+			       "Headphone amp");
 	if (ret)
 		return ret;
 
-	ret = gpio_request(GPIO_E750_SPK_AMP_OFF, "Speaker amp");
+	ret = gpio_request_one(GPIO_E750_SPK_AMP_OFF, GPIOF_OUT_INIT_HIGH,
+			       "Speaker amp");
 	if (ret)
 		goto free_hp_amp_gpio;
 
-	ret = gpio_direction_output(GPIO_E750_HP_AMP_OFF, 1);
-	if (ret)
-		goto free_spk_amp_gpio;
-
-	ret = gpio_direction_output(GPIO_E750_SPK_AMP_OFF, 1);
-	if (ret)
-		goto free_spk_amp_gpio;
-
 	e750_snd_device = platform_device_alloc("soc-audio", -1);
 	if (!e750_snd_device) {
 		ret = -ENOMEM;
diff -u -p a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c
--- a/sound/soc/pxa/e800_wm9712.c 2011-03-14 17:19:19.000000000 +0100
+++ b/sound/soc/pxa/e800_wm9712.c 2011-03-20 22:00:22.000000000 +0100
@@ -120,22 +120,16 @@ static int __init e800_init(void)
 	if (!machine_is_e800())
 		return -ENODEV;
 
-	ret = gpio_request(GPIO_E800_HP_AMP_OFF,  "Headphone amp");
+	ret = gpio_request_one(GPIO_E800_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH,
+			       "Headphone amp");
 	if (ret)
 		return ret;
 
-	ret = gpio_request(GPIO_E800_SPK_AMP_ON, "Speaker amp");
+	ret = gpio_request_one(GPIO_E800_SPK_AMP_ON, GPIOF_OUT_INIT_HIGH,
+			       "Speaker amp");
 	if (ret)
 		goto free_hp_amp_gpio;
 
-	ret = gpio_direction_output(GPIO_E800_HP_AMP_OFF, 1);
-	if (ret)
-		goto free_spk_amp_gpio;
-
-	ret = gpio_direction_output(GPIO_E800_SPK_AMP_ON, 1);
-	if (ret)
-		goto free_spk_amp_gpio;
-
 	e800_snd_device = platform_device_alloc("soc-audio", -1);
 	if (!e800_snd_device)
 		return -ENOMEM;
diff -u -p a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
--- a/sound/soc/pxa/tosa.c 2011-03-14 17:19:19.000000000 +0100
+++ b/sound/soc/pxa/tosa.c 2011-03-20 22:00:22.000000000 +0100
@@ -241,12 +241,10 @@ static int tosa_probe(struct snd_soc_car
 {
 	int ret;
 
-	ret = gpio_request(TOSA_GPIO_L_MUTE, "Headphone Jack");
+	ret = gpio_request_one(TOSA_GPIO_L_MUTE, GPIOF_OUT_INIT_LOW,
+			       "Headphone Jack");
 	if (ret)
 		return ret;
-	ret = gpio_direction_output(TOSA_GPIO_L_MUTE, 0);
-	if (ret)
-		gpio_free(TOSA_GPIO_L_MUTE);
 
 	return ret;
 }
diff -u -p a/sound/soc/samsung/h1940_uda1380.c b/sound/soc/samsung/h1940_uda1380.c
--- a/sound/soc/samsung/h1940_uda1380.c 2011-01-24 08:53:37.000000000 +0100
+++ b/sound/soc/samsung/h1940_uda1380.c 2011-03-20 22:00:24.000000000 +0100
@@ -239,14 +239,11 @@ static int __init h1940_init(void)
 		return -ENODEV;
 
 	/* configure some gpios */
-	ret = gpio_request(H1940_LATCH_AUDIO_POWER, "speaker-power");
+	ret = gpio_request_one(H1940_LATCH_AUDIO_POWER, GPIOF_OUT_INIT_LOW,
+			       "speaker-power");
 	if (ret)
 		goto err_out;
 
-	ret = gpio_direction_output(H1940_LATCH_AUDIO_POWER, 0);
-	if (ret)
-		goto err_gpio;
-
 	s3c24xx_snd_device = platform_device_alloc("soc-audio", -1);
 	if (!s3c24xx_snd_device) {
 		ret = -ENOMEM;
diff -u -p a/sound/soc/samsung/rx1950_uda1380.c b/sound/soc/samsung/rx1950_uda1380.c
--- a/sound/soc/samsung/rx1950_uda1380.c 2011-01-24 08:53:37.000000000 +0100
+++ b/sound/soc/samsung/rx1950_uda1380.c 2011-03-20 22:00:24.000000000 +0100
@@ -259,14 +259,11 @@ static int __init rx1950_init(void)
 		return -ENODEV;
 
 	/* configure some gpios */
-	ret = gpio_request(S3C2410_GPA(1), "speaker-power");
+	ret = gpio_request_one(S3C2410_GPA(1), GPIOF_OUT_INIT_LOW,
+			       "speaker-power");
 	if (ret)
 		goto err_gpio;
 
-	ret = gpio_direction_output(S3C2410_GPA(1), 0);
-	if (ret)
-		goto err_gpio_conf;
-
 	s3c24xx_snd_device = platform_device_alloc("soc-audio", -1);
 	if (!s3c24xx_snd_device) {
 		ret = -ENOMEM;
diff -u -p a/sound/soc/samsung/smartq_wm8987.c b/sound/soc/samsung/smartq_wm8987.c
--- a/sound/soc/samsung/smartq_wm8987.c 2011-01-24 08:53:37.000000000 +0100
+++ b/sound/soc/samsung/smartq_wm8987.c 2011-03-20 22:00:24.000000000 +0100
@@ -243,19 +243,13 @@ static int __init smartq_init(void)
 	}
 
 	/* Initialise GPIOs used by amplifiers */
-	ret = gpio_request(S3C64XX_GPK(12), "amplifiers shutdown");
+	ret = gpio_request_one(S3C64XX_GPK(12), GPIOF_OUT_INIT_HIGH,
+			       "amplifiers shutdown");
 	if (ret) {
 		dev_err(&smartq_snd_device->dev, "Failed to register GPK12\n");
 		goto err_unregister_device;
 	}
 
-	/* Disable amplifiers */
-	ret = gpio_direction_output(S3C64XX_GPK(12), 1);
-	if (ret) {
-		dev_err(&smartq_snd_device->dev, "Failed to configure GPK12\n");
-		goto err_free_gpio_amp_shut;
-	}
-
 	return 0;
 
 err_free_gpio_amp_shut:
diff -u -p a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
--- a/sound/soc/soc-jack.c 2011-03-14 17:19:19.000000000 +0100
+++ b/sound/soc/soc-jack.c 2011-03-20 22:00:25.000000000 +0100
@@ -310,14 +310,10 @@ int snd_soc_jack_add_gpios(struct snd_so
 			goto undo;
 		}
 
-		ret = gpio_request(gpios[i].gpio, gpios[i].name);
+		ret = gpio_request_one(gpios[i].gpio, GPIOF_IN, gpios[i].name);
 		if (ret)
 			goto undo;
 
-		ret = gpio_direction_input(gpios[i].gpio);
-		if (ret)
-			goto err;
-
 		INIT_DELAYED_WORK(&gpios[i].work, gpio_work);
 		gpios[i].jack = jack;
 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-20 20:51                 ` Julia Lawall
@ 2011-03-20 21:30                   ` Wolfram Sang
  2011-03-20 21:42                     ` Julia Lawall
  0 siblings, 1 reply; 20+ messages in thread
From: Wolfram Sang @ 2011-03-20 21:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Mar 20, 2011 at 09:51:32PM +0100, Julia Lawall wrote:
> I guess that the !GPIOLIB issue is related to a configuration option, that 
> can't very easily be detected from looking at the C file alone?

Yes, that is a configuration option at the moment. It shouldn't be IMO, that's
what my patch is addressing.

> Ignoring that issue, the following semantic patch addresses the common 

Sigh, here goes my chance to play with coccinelle again ;)

> case where there is no error checking for the input or output call, but 
> there may be error checking for the gpio_request call.  This transforms 
> over 500 occurrences.

In my book, converting the ones which do not check errors at all is not worth
the trouble. Proper error-checking should be the main benefit, not one saved
line. So, this is mindwork. If gpio_request is checked, merging seems sensible
(but should be audited).

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110320/a9fbf2da/attachment.sig>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-20 21:30                   ` Wolfram Sang
@ 2011-03-20 21:42                     ` Julia Lawall
  0 siblings, 0 replies; 20+ messages in thread
From: Julia Lawall @ 2011-03-20 21:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, 20 Mar 2011, Wolfram Sang wrote:

> On Sun, Mar 20, 2011 at 09:51:32PM +0100, Julia Lawall wrote:
> > I guess that the !GPIOLIB issue is related to a configuration option, that 
> > can't very easily be detected from looking at the C file alone?
> 
> Yes, that is a configuration option at the moment. It shouldn't be IMO, that's
> what my patch is addressing.
> 
> > Ignoring that issue, the following semantic patch addresses the common 
> 
> Sigh, here goes my chance to play with coccinelle again ;)

Well, there are still 300 or so cases that my rules don't catch :)

> > case where there is no error checking for the input or output call, but 
> > there may be error checking for the gpio_request call.  This transforms 
> > over 500 occurrences.
> 
> In my book, converting the ones which do not check errors at all is not worth
> the trouble. Proper error-checking should be the main benefit, not one saved
> line. So, this is mindwork. If gpio_request is checked, merging seems sensible
> (but should be audited).

OK.  One could put rules like:

@@
expression E1,E2;
@@

-      gpio_request(E1,E2);
+      BAD_CALL(gpio_request_one(E1,GPIOF_IN,E2));
       ... when != E1
-      gpio_direction_input(E1);

to more easily find those cases.  There are 265 of them.

julia

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-20 21:04                 ` Julia Lawall
@ 2011-03-21  7:43                   ` Grant Likely
  2011-03-21  7:59                     ` Julia Lawall
  0 siblings, 1 reply; 20+ messages in thread
From: Grant Likely @ 2011-03-21  7:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Mar 20, 2011 at 3:04 PM, Julia Lawall <julia@diku.dk> wrote:
> In this case, I also ignore the !GPIOLIB issue. ?This semantic patch
> considers the case where the direction call has some error handling code.
> In this case, it just deletes that error handling code, so most of these
> cases are likely to need some manual cleanup, eg to get rid of unreachable
> error labels or to change the error message.
>
[...]
> diff -u -p a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
> --- a/arch/arm/mach-omap2/board-4430sdp.c 2011-03-20 18:17:22.000000000 +0100
> +++ b/arch/arm/mach-omap2/board-4430sdp.c 2011-03-20 22:00:22.000000000 +0100
> @@ -257,44 +257,26 @@ static int omap_ethernet_init(void)
>
> ? ? ? ?/* Request of GPIO lines */
>
> - ? ? ? status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
> + ? ? ? status = gpio_request_one(ETH_KS8851_POWER_ON, GPIOF_OUT_INIT_HIGH,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "eth_power");
> ? ? ? ?if (status) {
> ? ? ? ? ? ? ? ?pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
> ? ? ? ? ? ? ? ?return status;
> ? ? ? ?}
>
> - ? ? ? status = gpio_request(ETH_KS8851_QUART, "quart");
> + ? ? ? status = gpio_request_one(ETH_KS8851_QUART, GPIOF_OUT_INIT_HIGH,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "quart");
> ? ? ? ?if (status) {
> ? ? ? ? ? ? ? ?pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
> ? ? ? ? ? ? ? ?goto error1;
> ? ? ? ?}
>
> - ? ? ? status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
> + ? ? ? status = gpio_request_one(ETH_KS8851_IRQ, GPIOF_IN, "eth_irq");
> ? ? ? ?if (status) {
> ? ? ? ? ? ? ? ?pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
> ? ? ? ? ? ? ? ?goto error2;
> ? ? ? ?}
>
> - ? ? ? /* Configuration of requested GPIO lines */
> -
> - ? ? ? status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
> - ? ? ? if (status) {
> - ? ? ? ? ? ? ? pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
> - ? ? ? ? ? ? ? goto error3;
> - ? ? ? }
> -
> - ? ? ? status = gpio_direction_output(ETH_KS8851_QUART, 1);
> - ? ? ? if (status) {
> - ? ? ? ? ? ? ? pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
> - ? ? ? ? ? ? ? goto error3;
> - ? ? ? }
> -
> - ? ? ? status = gpio_direction_input(ETH_KS8851_IRQ);
> - ? ? ? if (status) {
> - ? ? ? ? ? ? ? pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
> - ? ? ? ? ? ? ? goto error3;
> - ? ? ? }
> -
> ? ? ? ?return 0;

This hunk is probably wrong.  If gpio pins are being requested, it is
important to verify that all gpios have been requested successfully
before actively changing the state on any of them.  This hunk changes
the behaviour.

> diff -u -p a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
> --- a/arch/arm/mach-pxa/cm-x270.c 2010-12-31 15:18:30.000000000 +0100
> +++ b/arch/arm/mach-pxa/cm-x270.c 2011-03-20 22:00:23.000000000 +0100
> @@ -327,22 +327,18 @@ static unsigned long cm_x270_libertas_pi
>
> ?static int cm_x270_libertas_setup(struct spi_device *spi)
> ?{
> - ? ? ? int err = gpio_request(GPIO19_WLAN_STRAP, "WLAN STRAP");
> + ? ? ? int err = gpio_request_one(GPIO19_WLAN_STRAP, GPIOF_OUT_INIT_HIGH,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"WLAN STRAP");
> ? ? ? ?if (err)
> ? ? ? ? ? ? ? ?return err;
>
> - ? ? ? err = gpio_request(GPIO102_WLAN_RST, "WLAN RST");
> + ? ? ? err = gpio_request_one(GPIO102_WLAN_RST, GPIOF_OUT_INIT_LOW,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"WLAN RST");
> ? ? ? ?if (err)
> ? ? ? ? ? ? ? ?goto err_free_strap;
>
> - ? ? ? err = gpio_direction_output(GPIO102_WLAN_RST, 0);
> - ? ? ? if (err)
> - ? ? ? ? ? ? ? goto err_free_strap;
> ? ? ? ?msleep(100);
>
> - ? ? ? err = gpio_direction_output(GPIO19_WLAN_STRAP, 1);
> - ? ? ? if (err)
> - ? ? ? ? ? ? ? goto err_free_strap;
> ? ? ? ?msleep(100);

Ditto here, and it also loses the msleep delays.

Overall, I'm nervious about this change.  Most of the *should* be
okay, but the original code isn't exactly wrong either.  I'd rather
just leave them be unless it can be tested.  I certainly don't want to
change them all wholesale.

g.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-15 10:19         ` Julia Lawall
  2011-03-15 10:29           ` Wolfram Sang
  2011-03-16  8:33           ` Uwe Kleine-König
@ 2011-03-21  7:48           ` Grant Likely
  2011-03-21  8:01             ` Julia Lawall
  2 siblings, 1 reply; 20+ messages in thread
From: Grant Likely @ 2011-03-21  7:48 UTC (permalink / raw)
  To: linux-arm-kernel

2011/3/15 Julia Lawall <julia@diku.dk>:
> On Tue, 15 Mar 2011, Uwe Kleine-K?nig wrote:
>
>> On Tue, Mar 15, 2011 at 10:41:37AM +0100, Julia Lawall wrote:
>> > I tried the following
>> >
>> > @@
>> > expression E1,E2;
>> > @@
>> >
>> > ? ? ? gpio_direction_output(E1,E2);
>> > ? ? ? ...
>> > - ? ? gpio_set_value(E1,E2);
>> >
>> > and found occurrences in 15 files. ?In some cases there seems to be some
>> > delay before the call to gpio_set_value. ?Does that have any impacton
>> > whether it is needed?
>> gpio_direction_output(E1,E2) implies gpio_set_value(E1,E2), so unless
>> there is a gpio_set_value(E1,!E2) before gpio_set_value(E1,E2) is a
>> noop.
>>
>> I still don't know how to work with coccinelle, so if you point me to a
>> concrete location I can be more specific.
>
> OK. ?I have changed the semantic patch to the following:
>
> @@
> expression E1,E2,E3;
> @@
>
> ? ? ?gpio_direction_output(E1,E2);
> ? ? ?... when != gpio_set_value(E1,E3)
> - ? ? gpio_set_value(E1,E2);
>
> Now it doesn't do all the cases where there is an earlier set ofr some
> other value. ?The patch I obtain is below. ?This only concerns 5 files.
> I haven't checked the result at all.
>
> julia

Hi Julia,

Similar to my other reply, even though this patch is much smaller, I'm
not particularly excited about changing all the drivers wholesale
unless someone with hardware can give it a test.

g.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-21  7:43                   ` Grant Likely
@ 2011-03-21  7:59                     ` Julia Lawall
  0 siblings, 0 replies; 20+ messages in thread
From: Julia Lawall @ 2011-03-21  7:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 21 Mar 2011, Grant Likely wrote:

> On Sun, Mar 20, 2011 at 3:04 PM, Julia Lawall <julia@diku.dk> wrote:
> > In this case, I also ignore the !GPIOLIB issue. ?This semantic patch
> > considers the case where the direction call has some error handling code.
> > In this case, it just deletes that error handling code, so most of these
> > cases are likely to need some manual cleanup, eg to get rid of unreachable
> > error labels or to change the error message.
> >
> [...]
> > diff -u -p a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
> > --- a/arch/arm/mach-omap2/board-4430sdp.c 2011-03-20 18:17:22.000000000 +0100
> > +++ b/arch/arm/mach-omap2/board-4430sdp.c 2011-03-20 22:00:22.000000000 +0100
> > @@ -257,44 +257,26 @@ static int omap_ethernet_init(void)
> >
> > ? ? ? ?/* Request of GPIO lines */
> >
> > - ? ? ? status = gpio_request(ETH_KS8851_POWER_ON, "eth_power");
> > + ? ? ? status = gpio_request_one(ETH_KS8851_POWER_ON, GPIOF_OUT_INIT_HIGH,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "eth_power");
> > ? ? ? ?if (status) {
> > ? ? ? ? ? ? ? ?pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON);
> > ? ? ? ? ? ? ? ?return status;
> > ? ? ? ?}
> >
> > - ? ? ? status = gpio_request(ETH_KS8851_QUART, "quart");
> > + ? ? ? status = gpio_request_one(ETH_KS8851_QUART, GPIOF_OUT_INIT_HIGH,
> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? "quart");
> > ? ? ? ?if (status) {
> > ? ? ? ? ? ? ? ?pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART);
> > ? ? ? ? ? ? ? ?goto error1;
> > ? ? ? ?}
> >
> > - ? ? ? status = gpio_request(ETH_KS8851_IRQ, "eth_irq");
> > + ? ? ? status = gpio_request_one(ETH_KS8851_IRQ, GPIOF_IN, "eth_irq");
> > ? ? ? ?if (status) {
> > ? ? ? ? ? ? ? ?pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ);
> > ? ? ? ? ? ? ? ?goto error2;
> > ? ? ? ?}
> >
> > - ? ? ? /* Configuration of requested GPIO lines */
> > -
> > - ? ? ? status = gpio_direction_output(ETH_KS8851_POWER_ON, 1);
> > - ? ? ? if (status) {
> > - ? ? ? ? ? ? ? pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ);
> > - ? ? ? ? ? ? ? goto error3;
> > - ? ? ? }
> > -
> > - ? ? ? status = gpio_direction_output(ETH_KS8851_QUART, 1);
> > - ? ? ? if (status) {
> > - ? ? ? ? ? ? ? pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART);
> > - ? ? ? ? ? ? ? goto error3;
> > - ? ? ? }
> > -
> > - ? ? ? status = gpio_direction_input(ETH_KS8851_IRQ);
> > - ? ? ? if (status) {
> > - ? ? ? ? ? ? ? pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ);
> > - ? ? ? ? ? ? ? goto error3;
> > - ? ? ? }
> > -
> > ? ? ? ?return 0;
> 
> This hunk is probably wrong.  If gpio pins are being requested, it is
> important to verify that all gpios have been requested successfully
> before actively changing the state on any of them.  This hunk changes
> the behaviour.

Thanks for the feedback.  I can also check that there is no call to 
gpio_request or either of the direction functions between the call to 
gpio_request and the call to the direction function to transform.  The 
semantic patch and the result for the case where there is no error 
handling on the direction function are below.

On the other hand, the constraint that everything should be requested 
before initialization is not always respected, eg:

arch/arm/mach-mx3/mx31moboard-smartbot.c

Perhaps code like this should be changed to move up the requests?

julia

@@
expression E1,E2;
@@

-      gpio_request(E1,E2)
+      gpio_request_one(E1,GPIOF_IN,E2)
       ... when != E1
           when != gpio_request(...)
           when != gpio_direction_output(...)
           when != gpio_direction_input(...)
-      gpio_direction_input(E1);


@@
expression E1,E2;
@@

-      gpio_request(E1,E2)
+      gpio_request_one(E1,GPIOF_OUT_INIT_LOW,E2)
       ... when != E1
           when != gpio_request(...)
           when != gpio_direction_output(...)
           when != gpio_direction_input(...)
-      gpio_direction_output(E1,0);

@@
expression E1,E2;
@@

-      gpio_request(E1,E2)
+      gpio_request_one(E1,GPIOF_OUT_INIT_HIGH,E2)
       ... when != E1
           when != gpio_request(...)
           when != gpio_direction_output(...)
           when != gpio_direction_input(...)
-      gpio_direction_output(E1,1);

----------------------------------

diff -u -p a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
--- a/arch/arm/mach-davinci/board-da830-evm.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-davinci/board-da830-evm.c 2011-03-21 08:55:21.000000000 +0100
@@ -163,21 +163,20 @@ static __init void da830_evm_usb_init(vo
 		return;
 	}
 
-	ret = gpio_request(ON_BD_USB_DRV, "ON_BD_USB_DRV");
+	ret = gpio_request_one(ON_BD_USB_DRV, GPIOF_OUT_INIT_LOW,
+			       "ON_BD_USB_DRV");
 	if (ret) {
 		printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
 		       "power control: %d\n", __func__, ret);
 		return;
 	}
-	gpio_direction_output(ON_BD_USB_DRV, 0);
 
-	ret = gpio_request(ON_BD_USB_OVC, "ON_BD_USB_OVC");
+	ret = gpio_request_one(ON_BD_USB_OVC, GPIOF_IN, "ON_BD_USB_OVC");
 	if (ret) {
 		printk(KERN_ERR "%s: failed to request GPIO for USB 1.1 port "
 		       "over-current indicator: %d\n", __func__, ret);
 		return;
 	}
-	gpio_direction_input(ON_BD_USB_OVC);
 
 	ret = da8xx_register_usb11(&da830_evm_usb11_pdata);
 	if (ret)
@@ -260,21 +259,19 @@ static inline void da830_evm_init_mmc(vo
 		return;
 	}
 
-	ret = gpio_request(DA830_MMCSD_WP_PIN, "MMC WP");
+	ret = gpio_request_one(DA830_MMCSD_WP_PIN, GPIOF_IN, "MMC WP");
 	if (ret) {
 		pr_warning("da830_evm_init: can not open GPIO %d\n",
 			   DA830_MMCSD_WP_PIN);
 		return;
 	}
-	gpio_direction_input(DA830_MMCSD_WP_PIN);
 
-	ret = gpio_request(DA830_MMCSD_CD_PIN, "MMC CD\n");
+	ret = gpio_request_one(DA830_MMCSD_CD_PIN, GPIOF_IN, "MMC CD\n");
 	if (ret) {
 		pr_warning("da830_evm_init: can not open GPIO %d\n",
 			   DA830_MMCSD_CD_PIN);
 		return;
 	}
-	gpio_direction_input(DA830_MMCSD_CD_PIN);
 
 	ret = da8xx_register_mmcsd0(&da830_evm_mmc_config);
 	if (ret) {
@@ -463,10 +460,7 @@ static struct at24_platform_data da830_e
 static int __init da830_evm_ui_expander_setup(struct i2c_client *client,
 		int gpio, unsigned ngpio, void *context)
 {
-	gpio_request(gpio + 6, "UI MUX_MODE");
-
-	/* Drive mux mode low to match the default without UI card */
-	gpio_direction_output(gpio + 6, 0);
+	gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "UI MUX_MODE");
 
 	da830_evm_init_lcdc(gpio + 6);
 
diff -u -p a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
--- a/arch/arm/mach-davinci/board-dm355-evm.c 2010-10-23 19:40:31.000000000 +0200
+++ b/arch/arm/mach-davinci/board-dm355-evm.c 2011-03-21 08:55:21.000000000 +0100
@@ -142,8 +142,7 @@ static void __init evm_init_i2c(void)
 {
 	davinci_init_i2c(&i2c_pdata);
 
-	gpio_request(5, "dm355evm_msp");
-	gpio_direction_input(5);
+	gpio_request_one(5, GPIOF_IN, "dm355evm_msp");
 	dm355evm_i2c_info[0].irq = gpio_to_irq(5);
 
 	i2c_register_board_info(1, dm355evm_i2c_info,
@@ -315,8 +314,7 @@ static __init void dm355_evm_init(void)
 {
 	struct clk *aemif;
 
-	gpio_request(1, "dm9000");
-	gpio_direction_input(1);
+	gpio_request_one(1, GPIOF_IN, "dm9000");
 	dm355evm_dm9000_rsrc[2].start = gpio_to_irq(1);
 
 	aemif = clk_get(&dm355evm_dm9000.dev, "aemif");
diff -u -p a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
--- a/arch/arm/mach-davinci/board-dm355-leopard.c 2010-10-23 19:40:31.000000000 +0200
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c 2011-03-21 08:55:21.000000000 +0100
@@ -134,8 +134,7 @@ static void __init leopard_init_i2c(void
 {
 	davinci_init_i2c(&i2c_pdata);
 
-	gpio_request(5, "dm355leopard_msp");
-	gpio_direction_input(5);
+	gpio_request_one(5, GPIOF_IN, "dm355leopard_msp");
 	dm355leopard_i2c_info[0].irq = gpio_to_irq(5);
 
 	i2c_register_board_info(1, dm355leopard_i2c_info,
@@ -237,8 +236,7 @@ static __init void dm355_leopard_init(vo
 {
 	struct clk *aemif;
 
-	gpio_request(9, "dm9000");
-	gpio_direction_input(9);
+	gpio_request_one(9, GPIOF_IN, "dm9000");
 	dm355leopard_dm9000_rsrc[2].start = gpio_to_irq(9);
 
 	aemif = clk_get(&dm355leopard_dm9000.dev, "aemif");
diff -u -p a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
--- a/arch/arm/mach-davinci/board-dm644x-evm.c 2011-03-20 18:17:22.000000000 +0100
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c 2011-03-21 08:55:27.000000000 +0100
@@ -371,14 +371,11 @@ evm_u18_setup(struct i2c_client *client,
 		sw_gpio = -EINVAL;
 
 	/* audio PLL:  48 kHz (vs 44.1 or 32), single rate (vs double) */
-	gpio_request(gpio + 3, "pll_fs2");
-	gpio_direction_output(gpio + 3, 0);
+	gpio_request_one(gpio + 3, GPIOF_OUT_INIT_LOW, "pll_fs2");
 
-	gpio_request(gpio + 2, "pll_fs1");
-	gpio_direction_output(gpio + 2, 0);
+	gpio_request_one(gpio + 2, GPIOF_OUT_INIT_LOW, "pll_fs1");
 
-	gpio_request(gpio + 1, "pll_sr");
-	gpio_direction_output(gpio + 1, 0);
+	gpio_request_one(gpio + 1, GPIOF_OUT_INIT_LOW, "pll_sr");
 
 	return 0;
 }
@@ -411,34 +408,27 @@ static int
 evm_u35_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
 {
 	/* p0 = nDRV_VBUS (initial:  don't supply it) */
-	gpio_request(gpio + 0, "nDRV_VBUS");
-	gpio_direction_output(gpio + 0, 1);
+	gpio_request_one(gpio + 0, GPIOF_OUT_INIT_HIGH, "nDRV_VBUS");
 
 	/* p1 = VDDIMX_EN */
-	gpio_request(gpio + 1, "VDDIMX_EN");
-	gpio_direction_output(gpio + 1, 1);
+	gpio_request_one(gpio + 1, GPIOF_OUT_INIT_HIGH, "VDDIMX_EN");
 
 	/* p2 = VLYNQ_EN */
-	gpio_request(gpio + 2, "VLYNQ_EN");
-	gpio_direction_output(gpio + 2, 1);
+	gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH, "VLYNQ_EN");
 
 	/* p3 = n3V3_CF_RESET (initial: stay in reset) */
-	gpio_request(gpio + 3, "nCF_RESET");
-	gpio_direction_output(gpio + 3, 0);
+	gpio_request_one(gpio + 3, GPIOF_OUT_INIT_LOW, "nCF_RESET");
 
 	/* (p4 unused) */
 
 	/* p5 = 1V8_WLAN_RESET (initial: stay in reset) */
-	gpio_request(gpio + 5, "WLAN_RESET");
-	gpio_direction_output(gpio + 5, 1);
+	gpio_request_one(gpio + 5, GPIOF_OUT_INIT_HIGH, "WLAN_RESET");
 
 	/* p6 = nATA_SEL (initial: select) */
-	gpio_request(gpio + 6, "nATA_SEL");
-	gpio_direction_output(gpio + 6, 0);
+	gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "nATA_SEL");
 
 	/* p7 = nCF_SEL (initial: deselect) */
-	gpio_request(gpio + 7, "nCF_SEL");
-	gpio_direction_output(gpio + 7, 1);
+	gpio_request_one(gpio + 7, GPIOF_OUT_INIT_HIGH, "nCF_SEL");
 
 	return 0;
 }
diff -u -p a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c
--- a/arch/arm/mach-davinci/board-tnetv107x-evm.c 2011-03-20 18:17:22.000000000 +0100
+++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c 2011-03-21 08:55:21.000000000 +0100
@@ -44,12 +44,11 @@ static int initialize_gpio(int gpio, cha
 {
 	int ret;
 
-	ret = gpio_request(gpio, desc);
+	ret = gpio_request_one(gpio, GPIOF_IN, desc);
 	if (ret < 0) {
 		pr_err_ratelimited("cannot open %s gpio\n", desc);
 		return -ENOSYS;
 	}
-	gpio_direction_input(gpio);
 	return gpio;
 }
 
diff -u -p a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
--- a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c 2011-03-21 08:55:22.000000000 +0100
@@ -251,11 +251,10 @@ static const struct imxuart_platform_dat
 
 static void __maybe_unused ads7846_dev_init(void)
 {
-	if (gpio_request(ADS7846_PENDOWN, "ADS7846 pendown") < 0) {
+	if (gpio_request_one(ADS7846_PENDOWN, GPIOF_IN, "ADS7846 pendown") < 0) {
 		printk(KERN_ERR "can't get ads746 pen down GPIO\n");
 		return;
 	}
-	gpio_direction_input(ADS7846_PENDOWN);
 }
 
 static int ads7846_get_pendown_state(void)
diff -u -p a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
--- a/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c 2010-12-04 18:54:35.000000000 +0100
+++ b/arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c 2011-03-21 08:55:21.000000000 +0100
@@ -277,16 +277,13 @@ void __init eukrea_mbimxsd25_baseboard_i
 	imx25_add_flexcan1(NULL);
 	imx25_add_sdhci_esdhc_imx(0, NULL);
 
-	gpio_request(GPIO_LED1, "LED1");
-	gpio_direction_output(GPIO_LED1, 1);
+	gpio_request_one(GPIO_LED1, GPIOF_OUT_INIT_HIGH, "LED1");
 	gpio_free(GPIO_LED1);
 
-	gpio_request(GPIO_SWITCH1, "SWITCH1");
-	gpio_direction_input(GPIO_SWITCH1);
+	gpio_request_one(GPIO_SWITCH1, GPIOF_IN, "SWITCH1");
 	gpio_free(GPIO_SWITCH1);
 
-	gpio_request(GPIO_LCDPWR, "LCDPWR");
-	gpio_direction_output(GPIO_LCDPWR, 1);
+	gpio_request_one(GPIO_LCDPWR, GPIOF_OUT_INIT_HIGH, "LCDPWR");
 	gpio_free(GPIO_SWITCH1);
 
 	i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
diff -u -p a/arch/arm/mach-imx/pcm970-baseboard.c b/arch/arm/mach-imx/pcm970-baseboard.c
--- a/arch/arm/mach-imx/pcm970-baseboard.c 2010-12-04 18:54:35.000000000 +0100
+++ b/arch/arm/mach-imx/pcm970-baseboard.c 2011-03-21 08:55:22.000000000 +0100
@@ -100,14 +100,12 @@ static int pcm970_sdhc2_init(struct devi
 	if (ret)
 		return ret;
 
-	ret = gpio_request(GPIO_PORTC + 28, "imx-mmc-ro");
+	ret = gpio_request_one(GPIO_PORTC + 28, GPIOF_IN, "imx-mmc-ro");
 	if (ret) {
 		free_irq(IRQ_GPIOC(29), data);
 		return ret;
 	}
 
-	gpio_direction_input(GPIO_PORTC + 28);
-
 	return 0;
 }
 
diff -u -p a/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c
--- a/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c 2011-02-26 13:17:46.000000000 +0100
+++ b/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c 2011-03-21 08:55:26.000000000 +0100
@@ -291,16 +291,13 @@ void __init eukrea_mbimxsd35_baseboard_i
 	imx35_add_flexcan1(NULL);
 	imx35_add_sdhci_esdhc_imx(0, NULL);
 
-	gpio_request(GPIO_LED1, "LED1");
-	gpio_direction_output(GPIO_LED1, 1);
+	gpio_request_one(GPIO_LED1, GPIOF_OUT_INIT_HIGH, "LED1");
 	gpio_free(GPIO_LED1);
 
-	gpio_request(GPIO_SWITCH1, "SWITCH1");
-	gpio_direction_input(GPIO_SWITCH1);
+	gpio_request_one(GPIO_SWITCH1, GPIOF_IN, "SWITCH1");
 	gpio_free(GPIO_SWITCH1);
 
-	gpio_request(GPIO_LCDPWR, "LCDPWR");
-	gpio_direction_output(GPIO_LCDPWR, 1);
+	gpio_request_one(GPIO_LCDPWR, GPIOF_OUT_INIT_HIGH, "LCDPWR");
 	gpio_free(GPIO_LCDPWR);
 
 	i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
diff -u -p a/arch/arm/mach-mx3/mach-armadillo5x0.c b/arch/arm/mach-mx3/mach-armadillo5x0.c
--- a/arch/arm/mach-mx3/mach-armadillo5x0.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-armadillo5x0.c 2011-03-21 08:55:21.000000000 +0100
@@ -412,18 +412,14 @@ static int armadillo5x0_sdhc1_init(struc
 	gpio_det = IOMUX_TO_GPIO(MX31_PIN_ATA_DMACK);
 	gpio_wp = IOMUX_TO_GPIO(MX31_PIN_ATA_RESET_B);
 
-	ret = gpio_request(gpio_det, "sdhc-card-detect");
+	ret = gpio_request_one(gpio_det, GPIOF_IN, "sdhc-card-detect");
 	if (ret)
 		return ret;
 
-	gpio_direction_input(gpio_det);
-
-	ret = gpio_request(gpio_wp, "sdhc-write-protect");
+	ret = gpio_request_one(gpio_wp, GPIOF_IN, "sdhc-write-protect");
 	if (ret)
 		goto err_gpio_free;
 
-	gpio_direction_input(gpio_wp);
-
 	/* When supported the trigger type have to be BOTH */
 	ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_ATA_DMACK), detect_irq,
 			  IRQF_DISABLED | IRQF_TRIGGER_FALLING,
diff -u -p a/arch/arm/mach-mx3/mach-kzm_arm11_01.c b/arch/arm/mach-mx3/mach-kzm_arm11_01.c
--- a/arch/arm/mach-mx3/mach-kzm_arm11_01.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-kzm_arm11_01.c 2011-03-21 08:55:22.000000000 +0100
@@ -113,8 +113,8 @@ static int __init kzm_init_ext_uart(void
 	 * GPIO 1-1: external UART interrupt line
 	 */
 	mxc_iomux_mode(IOMUX_MODE(MX31_PIN_GPIO1_1, IOMUX_CONFIG_GPIO));
-	gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1), "ext-uart-int");
-	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1));
+	gpio_request_one(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1), GPIOF_IN,
+			 "ext-uart-int");
 
 	/*
 	 * Unmask UART interrupt
@@ -172,8 +172,8 @@ static int __init kzm_init_smsc9118(void
 	 * GPIO 1-2: SMSC9118 interrupt line
 	 */
 	mxc_iomux_mode(IOMUX_MODE(MX31_PIN_GPIO1_2, IOMUX_CONFIG_GPIO));
-	gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2), "smsc9118-int");
-	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2));
+	gpio_request_one(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2), GPIOF_IN,
+			 "smsc9118-int");
 
 	return platform_device_register(&kzm_smsc9118_device);
 }
diff -u -p a/arch/arm/mach-mx3/mach-mx31lilly.c b/arch/arm/mach-mx3/mach-mx31lilly.c
--- a/arch/arm/mach-mx3/mach-mx31lilly.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-mx31lilly.c 2011-03-21 08:55:21.000000000 +0100
@@ -175,8 +175,8 @@ static int usbh2_init(struct platform_de
 	/* chip select */
 	mxc_iomux_alloc_pin(IOMUX_MODE(MX31_PIN_DTR_DCE1, IOMUX_CONFIG_GPIO),
 				"USBH2_CS");
-	gpio_request(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), "USBH2 CS");
-	gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), 0);
+	gpio_request_one(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1),
+			 GPIOF_OUT_INIT_LOW, "USBH2 CS");
 
 	mdelay(10);
 
diff -u -p a/arch/arm/mach-mx3/mach-mx31lite.c b/arch/arm/mach-mx3/mach-mx31lite.c
--- a/arch/arm/mach-mx3/mach-mx31lite.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-mx31lite.c 2011-03-21 08:55:21.000000000 +0100
@@ -164,8 +164,8 @@ static int usbh2_init(struct platform_de
 	/* chip select */
 	mxc_iomux_alloc_pin(IOMUX_MODE(MX31_PIN_DTR_DCE1, IOMUX_CONFIG_GPIO),
 				"USBH2_CS");
-	gpio_request(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), "USBH2 CS");
-	gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), 0);
+	gpio_request_one(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1),
+			 GPIOF_OUT_INIT_LOW, "USBH2 CS");
 
 	mdelay(10);
 
diff -u -p a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
--- a/arch/arm/mach-mx3/mach-mx31moboard.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-mx31moboard.c 2011-03-21 08:55:22.000000000 +0100
@@ -311,16 +311,13 @@ static int moboard_sdhc1_init(struct dev
 {
 	int ret;
 
-	ret = gpio_request(SDHC1_CD, "sdhc-detect");
+	ret = gpio_request_one(SDHC1_CD, GPIOF_IN, "sdhc-detect");
 	if (ret)
 		return ret;
 
-	gpio_direction_input(SDHC1_CD);
-
-	ret = gpio_request(SDHC1_WP, "sdhc-wp");
+	ret = gpio_request_one(SDHC1_WP, GPIOF_IN, "sdhc-wp");
 	if (ret)
 		goto err_gpio_free;
-	gpio_direction_input(SDHC1_WP);
 
 	ret = request_irq(gpio_to_irq(SDHC1_CD), detect_irq,
 		IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
@@ -390,13 +387,11 @@ static void usb_xcvr_reset(void)
 	mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
 	mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
 
-	gpio_request(OTG_EN_B, "usb-udc-en");
-	gpio_direction_output(OTG_EN_B, 0);
-	gpio_request(USBH2_EN_B, "usbh2-en");
-	gpio_direction_output(USBH2_EN_B, 0);
+	gpio_request_one(OTG_EN_B, GPIOF_OUT_INIT_LOW, "usb-udc-en");
+	
+	gpio_request_one(USBH2_EN_B, GPIOF_OUT_INIT_LOW, "usbh2-en");
 
-	gpio_request(USB_RESET_B, "usb-reset");
-	gpio_direction_output(USB_RESET_B, 0);
+	gpio_request_one(USB_RESET_B, GPIOF_OUT_INIT_LOW, "usb-reset");
 	mdelay(1);
 	gpio_set_value(USB_RESET_B, 1);
 	mdelay(1);
@@ -522,8 +517,8 @@ static void __init mx31moboard_init(void
 	imx31_add_spi_imx1(&moboard_spi1_pdata);
 	imx31_add_spi_imx2(&moboard_spi2_pdata);
 
-	gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq");
-	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
+	gpio_request_one(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), GPIOF_IN,
+			 "pmic-irq");
 	spi_register_board_info(moboard_spi_board_info,
 		ARRAY_SIZE(moboard_spi_board_info));
 
diff -u -p a/arch/arm/mach-mx3/mach-pcm037.c b/arch/arm/mach-mx3/mach-pcm037.c
--- a/arch/arm/mach-mx3/mach-pcm037.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-pcm037.c 2011-03-21 08:55:21.000000000 +0100
@@ -358,17 +358,14 @@ static int pcm970_sdhc1_init(struct devi
 {
 	int ret;
 
-	ret = gpio_request(SDHC1_GPIO_DET, "sdhc-detect");
+	ret = gpio_request_one(SDHC1_GPIO_DET, GPIOF_IN, "sdhc-detect");
 	if (ret)
 		return ret;
 
-	gpio_direction_input(SDHC1_GPIO_DET);
-
 #ifdef PCM970_SDHC_RW_SWITCH
-	ret = gpio_request(SDHC1_GPIO_WP, "sdhc-wp");
+	ret = gpio_request_one(SDHC1_GPIO_WP, GPIOF_IN, "sdhc-wp");
 	if (ret)
 		goto err_gpio_free;
-	gpio_direction_input(SDHC1_GPIO_WP);
 #endif
 
 	ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_SCK6), detect_irq,
diff -u -p a/arch/arm/mach-mx3/mach-pcm043.c b/arch/arm/mach-mx3/mach-pcm043.c
--- a/arch/arm/mach-mx3/mach-pcm043.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mach-pcm043.c 2011-03-21 08:55:21.000000000 +0100
@@ -229,7 +229,7 @@ static void pcm043_ac97_warm_reset(struc
 	iomux_v3_cfg_t txfs = MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS;
 	int ret;
 
-	ret = gpio_request(AC97_GPIO_TXFS, "SSI");
+	ret = gpio_request_one(AC97_GPIO_TXFS, GPIOF_OUT_INIT_HIGH, "SSI");
 	if (ret) {
 		printk("failed to get GPIO_TXFS: %d\n", ret);
 		return;
@@ -238,7 +238,6 @@ static void pcm043_ac97_warm_reset(struc
 	mxc_iomux_v3_setup_pad(txfs_gpio);
 
 	/* warm reset */
-	gpio_direction_output(AC97_GPIO_TXFS, 1);
 	udelay(2);
 	gpio_set_value(AC97_GPIO_TXFS, 0);
 
diff -u -p a/arch/arm/mach-mx3/mx31lilly-db.c b/arch/arm/mach-mx3/mx31lilly-db.c
--- a/arch/arm/mach-mx3/mx31lilly-db.c 2010-12-04 18:54:35.000000000 +0100
+++ b/arch/arm/mach-mx3/mx31lilly-db.c 2011-03-21 08:55:26.000000000 +0100
@@ -197,14 +197,14 @@ static struct mx3fb_platform_data fb_pda
 
 static void __init mx31lilly_init_fb(void)
 {
-	if (gpio_request(LCD_VCC_EN_GPIO, "LCD enable") != 0) {
+	if (gpio_request_one(LCD_VCC_EN_GPIO, GPIOF_OUT_INIT_HIGH,
+			     "LCD enable") != 0) {
 		printk(KERN_WARNING "unable to request LCD_VCC_EN pin.\n");
 		return;
 	}
 
 	mxc_register_device(&mx3_ipu, &ipu_data);
 	mxc_register_device(&mx3_fb, &fb_pdata);
-	gpio_direction_output(LCD_VCC_EN_GPIO, 1);
 }
 
 void __init mx31lilly_db_init(void)
diff -u -p a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
--- a/arch/arm/mach-mx3/mx31moboard-devboard.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-mx3/mx31moboard-devboard.c 2011-03-21 08:55:21.000000000 +0100
@@ -67,16 +67,13 @@ static int devboard_sdhc2_init(struct de
 {
 	int ret;
 
-	ret = gpio_request(SDHC2_CD, "sdhc-detect");
+	ret = gpio_request_one(SDHC2_CD, GPIOF_IN, "sdhc-detect");
 	if (ret)
 		return ret;
 
-	gpio_direction_input(SDHC2_CD);
-
-	ret = gpio_request(SDHC2_WP, "sdhc-wp");
+	ret = gpio_request_one(SDHC2_WP, GPIOF_IN, "sdhc-wp");
 	if (ret)
 		goto err_gpio_free;
-	gpio_direction_input(SDHC2_WP);
 
 	ret = request_irq(gpio_to_irq(SDHC2_CD), detect_irq,
 		IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
@@ -161,18 +158,17 @@ static int devboard_usbh1_hw_init(struct
 
 static int devboard_isp1105_init(struct otg_transceiver *otg)
 {
-	int ret = gpio_request(USBH1_MODE, "usbh1-mode");
+	int ret = gpio_request_one(USBH1_MODE, GPIOF_OUT_INIT_LOW,
+				   "usbh1-mode");
 	if (ret)
 		return ret;
-	/* single ended */
-	gpio_direction_output(USBH1_MODE, 0);
 
-	ret = gpio_request(USBH1_VBUSEN_B, "usbh1-vbusen");
+	ret = gpio_request_one(USBH1_VBUSEN_B, GPIOF_OUT_INIT_HIGH,
+			       "usbh1-vbusen");
 	if (ret) {
 		gpio_free(USBH1_MODE);
 		return ret;
 	}
-	gpio_direction_output(USBH1_VBUSEN_B, 1);
 
 	return 0;
 }
diff -u -p a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c 2011-03-21 08:55:22.000000000 +0100
@@ -80,16 +80,13 @@ static int marxbot_sdhc2_init(struct dev
 {
 	int ret;
 
-	ret = gpio_request(SDHC2_CD, "sdhc-detect");
+	ret = gpio_request_one(SDHC2_CD, GPIOF_IN, "sdhc-detect");
 	if (ret)
 		return ret;
 
-	gpio_direction_input(SDHC2_CD);
-
-	ret = gpio_request(SDHC2_WP, "sdhc-wp");
+	ret = gpio_request_one(SDHC2_WP, GPIOF_IN, "sdhc-wp");
 	if (ret)
 		goto err_gpio_free;
-	gpio_direction_input(SDHC2_WP);
 
 	ret = request_irq(gpio_to_irq(SDHC2_CD), detect_irq,
 		IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
@@ -195,28 +192,28 @@ static struct platform_device *marxbot_c
 
 static int __init marxbot_cam_init(void)
 {
-	int ret = gpio_request(CAM_CHOICE, "cam-choice");
+	int ret = gpio_request_one(CAM_CHOICE, GPIOF_OUT_INIT_LOW,
+				   "cam-choice");
 	if (ret)
 		return ret;
-	gpio_direction_output(CAM_CHOICE, 0);
 
-	ret = gpio_request(BASECAM_RST_B, "basecam-reset");
+	ret = gpio_request_one(BASECAM_RST_B, GPIOF_OUT_INIT_HIGH,
+			       "basecam-reset");
 	if (ret)
 		return ret;
-	gpio_direction_output(BASECAM_RST_B, 1);
-	ret = gpio_request(BASECAM_POWER, "basecam-standby");
+	ret = gpio_request_one(BASECAM_POWER, GPIOF_OUT_INIT_LOW,
+			       "basecam-standby");
 	if (ret)
 		return ret;
-	gpio_direction_output(BASECAM_POWER, 0);
 
-	ret = gpio_request(TURRETCAM_RST_B, "turretcam-reset");
+	ret = gpio_request_one(TURRETCAM_RST_B, GPIOF_OUT_INIT_HIGH,
+			       "turretcam-reset");
 	if (ret)
 		return ret;
-	gpio_direction_output(TURRETCAM_RST_B, 1);
-	ret = gpio_request(TURRETCAM_POWER, "turretcam-standby");
+	ret = gpio_request_one(TURRETCAM_POWER, GPIOF_OUT_INIT_LOW,
+			       "turretcam-standby");
 	if (ret)
 		return ret;
-	gpio_direction_output(TURRETCAM_POWER, 0);
 
 	return 0;
 }
@@ -276,18 +273,17 @@ static int marxbot_usbh1_hw_init(struct 
 
 static int marxbot_isp1105_init(struct otg_transceiver *otg)
 {
-	int ret = gpio_request(USBH1_MODE, "usbh1-mode");
+	int ret = gpio_request_one(USBH1_MODE, GPIOF_OUT_INIT_LOW,
+				   "usbh1-mode");
 	if (ret)
 		return ret;
-	/* single ended */
-	gpio_direction_output(USBH1_MODE, 0);
 
-	ret = gpio_request(USBH1_VBUSEN_B, "usbh1-vbusen");
+	ret = gpio_request_one(USBH1_VBUSEN_B, GPIOF_OUT_INIT_HIGH,
+			       "usbh1-vbusen");
 	if (ret) {
 		gpio_free(USBH1_MODE);
 		return ret;
 	}
-	gpio_direction_output(USBH1_VBUSEN_B, 1);
 
 	return 0;
 }
@@ -358,8 +354,8 @@ void __init mx31moboard_marxbot_init(voi
 	platform_add_devices(marxbot_cameras, ARRAY_SIZE(marxbot_cameras));
 
 	/* battery present pin */
-	gpio_request(IOMUX_TO_GPIO(MX31_PIN_LCS0), "bat-present");
-	gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0));
+	gpio_request_one(IOMUX_TO_GPIO(MX31_PIN_LCS0), GPIOF_IN,
+			 "bat-present");
 	gpio_export(IOMUX_TO_GPIO(MX31_PIN_LCS0), false);
 
 	imx31_add_fsl_usb2_udc(&usb_pdata);
diff -u -p a/arch/arm/mach-mx3/mx31moboard-smartbot.c b/arch/arm/mach-mx3/mx31moboard-smartbot.c
--- a/arch/arm/mach-mx3/mx31moboard-smartbot.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx3/mx31moboard-smartbot.c 2011-03-21 08:55:22.000000000 +0100
@@ -104,14 +104,13 @@ static struct platform_device *smartbot_
 
 static int __init smartbot_cam_init(void)
 {
-	int ret = gpio_request(CAM_RST_B, "cam-reset");
+	int ret = gpio_request_one(CAM_RST_B, GPIOF_OUT_INIT_HIGH,
+				   "cam-reset");
 	if (ret)
 		return ret;
-	gpio_direction_output(CAM_RST_B, 1);
-	ret = gpio_request(CAM_POWER, "cam-standby");
+	ret = gpio_request_one(CAM_POWER, GPIOF_OUT_INIT_LOW, "cam-standby");
 	if (ret)
 		return ret;
-	gpio_direction_output(CAM_POWER, 0);
 
 	return 0;
 }
diff -u -p a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c
--- a/arch/arm/mach-mx5/board-cpuimx51.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-mx5/board-cpuimx51.c 2011-03-21 08:55:24.000000000 +0100
@@ -253,17 +253,13 @@ static void __init eukrea_cpuimx51_init(
 	imx51_add_imx_uart(0, &uart_pdata);
 	imx51_add_mxc_nand(&eukrea_cpuimx51_nand_board_info);
 
-	gpio_request(CPUIMX51_QUARTA_GPIO, "quarta_irq");
-	gpio_direction_input(CPUIMX51_QUARTA_GPIO);
+	gpio_request_one(CPUIMX51_QUARTA_GPIO, GPIOF_IN, "quarta_irq");
 	gpio_free(CPUIMX51_QUARTA_GPIO);
-	gpio_request(CPUIMX51_QUARTB_GPIO, "quartb_irq");
-	gpio_direction_input(CPUIMX51_QUARTB_GPIO);
+	gpio_request_one(CPUIMX51_QUARTB_GPIO, GPIOF_IN, "quartb_irq");
 	gpio_free(CPUIMX51_QUARTB_GPIO);
-	gpio_request(CPUIMX51_QUARTC_GPIO, "quartc_irq");
-	gpio_direction_input(CPUIMX51_QUARTC_GPIO);
+	gpio_request_one(CPUIMX51_QUARTC_GPIO, GPIOF_IN, "quartc_irq");
 	gpio_free(CPUIMX51_QUARTC_GPIO);
-	gpio_request(CPUIMX51_QUARTD_GPIO, "quartd_irq");
-	gpio_direction_input(CPUIMX51_QUARTD_GPIO);
+	gpio_request_one(CPUIMX51_QUARTD_GPIO, GPIOF_IN, "quartd_irq");
 	gpio_free(CPUIMX51_QUARTD_GPIO);
 
 	imx51_add_fec(NULL);
diff -u -p a/arch/arm/mach-mx5/board-cpuimx51sd.c b/arch/arm/mach-mx5/board-cpuimx51sd.c
--- a/arch/arm/mach-mx5/board-cpuimx51sd.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx5/board-cpuimx51sd.c 2011-03-21 08:55:24.000000000 +0100
@@ -280,22 +280,18 @@ static void __init eukrea_cpuimx51sd_ini
 	gpio_set_value(ETH_RST, 1);
 	imx51_add_fec(NULL);
 
-	gpio_request(CAN_IRQGPIO, "can_irq");
-	gpio_direction_input(CAN_IRQGPIO);
+	gpio_request_one(CAN_IRQGPIO, GPIOF_IN, "can_irq");
 	gpio_free(CAN_IRQGPIO);
-	gpio_request(CAN_NCS, "can_ncs");
-	gpio_direction_output(CAN_NCS, 1);
+	gpio_request_one(CAN_NCS, GPIOF_OUT_INIT_HIGH, "can_ncs");
 	gpio_free(CAN_NCS);
-	gpio_request(CAN_RST, "can_rst");
-	gpio_direction_output(CAN_RST, 0);
+	gpio_request_one(CAN_RST, GPIOF_OUT_INIT_LOW, "can_rst");
 	msleep(20);
 	gpio_set_value(CAN_RST, 1);
 	imx51_add_ecspi(0, &cpuimx51sd_ecspi1_pdata);
 	spi_register_board_info(cpuimx51sd_spi_device,
 				ARRAY_SIZE(cpuimx51sd_spi_device));
 
-	gpio_request(TSC2007_IRQGPIO, "tsc2007_irq");
-	gpio_direction_input(TSC2007_IRQGPIO);
+	gpio_request_one(TSC2007_IRQGPIO, GPIOF_IN, "tsc2007_irq");
 	gpio_free(TSC2007_IRQGPIO);
 
 	i2c_register_board_info(0, eukrea_cpuimx51sd_i2c_devices,
@@ -309,8 +305,7 @@ static void __init eukrea_cpuimx51sd_ini
 		mxc_register_device(&mxc_usbdr_udc_device, &usb_pdata);
 	}
 
-	gpio_request(USBH1_RST, "usb_rst");
-	gpio_direction_output(USBH1_RST, 0);
+	gpio_request_one(USBH1_RST, GPIOF_OUT_INIT_LOW, "usb_rst");
 	msleep(20);
 	gpio_set_value(USBH1_RST, 1);
 	mxc_register_device(&mxc_usbh1_device, &usbh1_config);
diff -u -p a/arch/arm/mach-mx5/board-mx50_rdp.c b/arch/arm/mach-mx5/board-mx50_rdp.c
--- a/arch/arm/mach-mx5/board-mx50_rdp.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx50_rdp.c 2011-03-21 08:55:21.000000000 +0100
@@ -176,10 +176,9 @@ static const struct fec_platform_data fe
 
 static inline void mx50_rdp_fec_reset(void)
 {
-	gpio_request(FEC_EN, "fec-en");
-	gpio_direction_output(FEC_EN, 0);
-	gpio_request(FEC_RESET_B, "fec-reset_b");
-	gpio_direction_output(FEC_RESET_B, 0);
+	gpio_request_one(FEC_EN, GPIOF_OUT_INIT_LOW, "fec-en");
+	
+	gpio_request_one(FEC_RESET_B, GPIOF_OUT_INIT_LOW, "fec-reset_b");
 	msleep(1);
 	gpio_set_value(FEC_RESET_B, 1);
 }
diff -u -p a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
--- a/arch/arm/mach-mx5/board-mx51_babbage.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c 2011-03-21 08:55:21.000000000 +0100
@@ -181,26 +181,26 @@ static int gpio_usbh1_active(void)
 
 	/* Set USBH1_STP to GPIO and toggle it */
 	mxc_iomux_v3_setup_pad(usbh1stp_gpio);
-	ret = gpio_request(BABBAGE_USBH1_STP, "usbh1_stp");
+	ret = gpio_request_one(BABBAGE_USBH1_STP, GPIOF_OUT_INIT_LOW,
+			       "usbh1_stp");
 
 	if (ret) {
 		pr_debug("failed to get MX51_PAD_USBH1_STP__GPIO_1_27: %d\n", ret);
 		return ret;
 	}
-	gpio_direction_output(BABBAGE_USBH1_STP, 0);
 	gpio_set_value(BABBAGE_USBH1_STP, 1);
 	msleep(100);
 	gpio_free(BABBAGE_USBH1_STP);
 
 	/* De-assert USB PHY RESETB */
 	mxc_iomux_v3_setup_pad(phyreset_gpio);
-	ret = gpio_request(BABBAGE_PHY_RESET, "phy_reset");
+	ret = gpio_request_one(BABBAGE_PHY_RESET, GPIOF_OUT_INIT_HIGH,
+			       "phy_reset");
 
 	if (ret) {
 		pr_debug("failed to get MX51_PAD_EIM_D21__GPIO_2_5: %d\n", ret);
 		return ret;
 	}
-	gpio_direction_output(BABBAGE_PHY_RESET, 1);
 	return 0;
 }
 
@@ -209,12 +209,12 @@ static inline void babbage_usbhub_reset(
 	int ret;
 
 	/* Bring USB hub out of reset */
-	ret = gpio_request(BABBAGE_USB_HUB_RESET, "GPIO1_7");
+	ret = gpio_request_one(BABBAGE_USB_HUB_RESET, GPIOF_OUT_INIT_LOW,
+			       "GPIO1_7");
 	if (ret) {
 		printk(KERN_ERR"failed to get GPIO_USB_HUB_RESET: %d\n", ret);
 		return;
 	}
-	gpio_direction_output(BABBAGE_USB_HUB_RESET, 0);
 
 	/* USB HUB RESET - De-assert USB HUB RESET_N */
 	msleep(1);
@@ -228,12 +228,12 @@ static inline void babbage_fec_reset(voi
 	int ret;
 
 	/* reset FEC PHY */
-	ret = gpio_request(BABBAGE_FEC_PHY_RESET, "fec-phy-reset");
+	ret = gpio_request_one(BABBAGE_FEC_PHY_RESET, GPIOF_OUT_INIT_LOW,
+			       "fec-phy-reset");
 	if (ret) {
 		printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
 		return;
 	}
-	gpio_direction_output(BABBAGE_FEC_PHY_RESET, 0);
 	gpio_set_value(BABBAGE_FEC_PHY_RESET, 0);
 	msleep(1);
 	gpio_set_value(BABBAGE_FEC_PHY_RESET, 1);
diff -u -p a/arch/arm/mach-mx5/board-mx51_efikamx.c b/arch/arm/mach-mx5/board-mx51_efikamx.c
--- a/arch/arm/mach-mx5/board-mx51_efikamx.c 2011-02-26 13:17:46.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx51_efikamx.c 2011-03-21 08:55:25.000000000 +0100
@@ -104,12 +104,11 @@ static void __init mx51_efikamx_board_id
 	/* things are taking time to settle */
 	msleep(150);
 
-	gpio_request(EFIKAMX_PCBID0, "pcbid0");
-	gpio_direction_input(EFIKAMX_PCBID0);
-	gpio_request(EFIKAMX_PCBID1, "pcbid1");
-	gpio_direction_input(EFIKAMX_PCBID1);
-	gpio_request(EFIKAMX_PCBID2, "pcbid2");
-	gpio_direction_input(EFIKAMX_PCBID2);
+	gpio_request_one(EFIKAMX_PCBID0, GPIOF_IN, "pcbid0");
+	
+	gpio_request_one(EFIKAMX_PCBID1, GPIOF_IN, "pcbid1");
+	
+	gpio_request_one(EFIKAMX_PCBID2, GPIOF_IN, "pcbid2");
 
 	id = gpio_get_value(EFIKAMX_PCBID0);
 	id |= gpio_get_value(EFIKAMX_PCBID1) << 1;
@@ -255,11 +254,10 @@ static void __init mx51_efikamx_init(voi
 	imx51_add_gpio_keys(&mx51_efikamx_powerkey_data);
 
 	if (system_rev == 0x11) {
-		gpio_request(EFIKAMX_RESET1_1, "reset");
-		gpio_direction_output(EFIKAMX_RESET1_1, 1);
+		gpio_request_one(EFIKAMX_RESET1_1, GPIOF_OUT_INIT_HIGH,
+				 "reset");
 	} else {
-		gpio_request(EFIKAMX_RESET, "reset");
-		gpio_direction_output(EFIKAMX_RESET, 1);
+		gpio_request_one(EFIKAMX_RESET, GPIOF_OUT_INIT_HIGH, "reset");
 	}
 
 	/*
@@ -267,12 +265,10 @@ static void __init mx51_efikamx_init(voi
 	 * sb and mx have same wlan pin but the value to enable it are
 	 * different :/
 	 */
-	gpio_request(EFIKA_WLAN_EN, "wlan_en");
-	gpio_direction_output(EFIKA_WLAN_EN, 0);
+	gpio_request_one(EFIKA_WLAN_EN, GPIOF_OUT_INIT_LOW, "wlan_en");
 	msleep(10);
 
-	gpio_request(EFIKA_WLAN_RESET, "wlan_rst");
-	gpio_direction_output(EFIKA_WLAN_RESET, 0);
+	gpio_request_one(EFIKA_WLAN_RESET, GPIOF_OUT_INIT_LOW, "wlan_rst");
 	msleep(10);
 	gpio_set_value(EFIKA_WLAN_RESET, 1);
 }
diff -u -p a/arch/arm/mach-mx5/board-mx51_efikasb.c b/arch/arm/mach-mx5/board-mx51_efikasb.c
--- a/arch/arm/mach-mx5/board-mx51_efikasb.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx51_efikasb.c 2011-03-21 08:55:25.000000000 +0100
@@ -108,8 +108,7 @@ static int initialize_usbh2_port(struct 
 	iomux_v3_cfg_t usbh2gpio = MX51_PAD_EIM_A26__GPIO2_20;
 
 	mxc_iomux_v3_setup_pad(usbh2gpio);
-	gpio_request(EFIKASB_USBH2_STP, "usbh2_stp");
-	gpio_direction_output(EFIKASB_USBH2_STP, 0);
+	gpio_request_one(EFIKASB_USBH2_STP, GPIOF_OUT_INIT_LOW, "usbh2_stp");
 	msleep(1);
 	gpio_set_value(EFIKASB_USBH2_STP, 1);
 	msleep(1);
@@ -229,10 +228,9 @@ static void __init mx51_efikasb_board_id
 {
 	int id;
 
-	gpio_request(EFIKASB_PCBID0, "pcb id0");
-	gpio_direction_input(EFIKASB_PCBID0);
-	gpio_request(EFIKASB_PCBID1, "pcb id1");
-	gpio_direction_input(EFIKASB_PCBID1);
+	gpio_request_one(EFIKASB_PCBID0, GPIOF_IN, "pcb id0");
+	
+	gpio_request_one(EFIKASB_PCBID1, GPIOF_IN, "pcb id1");
 
 	id = gpio_get_value(EFIKASB_PCBID0);
 	id |= gpio_get_value(EFIKASB_PCBID1) << 1;
diff -u -p a/arch/arm/mach-mx5/board-mx53_evk.c b/arch/arm/mach-mx5/board-mx53_evk.c
--- a/arch/arm/mach-mx5/board-mx53_evk.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx53_evk.c 2011-03-21 08:55:21.000000000 +0100
@@ -82,12 +82,12 @@ static inline void mx53_evk_fec_reset(vo
 	int ret;
 
 	/* reset FEC PHY */
-	ret = gpio_request(SMD_FEC_PHY_RST, "fec-phy-reset");
+	ret = gpio_request_one(SMD_FEC_PHY_RST, GPIOF_OUT_INIT_LOW,
+			       "fec-phy-reset");
 	if (ret) {
 		printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
 		return;
 	}
-	gpio_direction_output(SMD_FEC_PHY_RST, 0);
 	gpio_set_value(SMD_FEC_PHY_RST, 0);
 	msleep(1);
 	gpio_set_value(SMD_FEC_PHY_RST, 1);
diff -u -p a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c
--- a/arch/arm/mach-mx5/board-mx53_loco.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx53_loco.c 2011-03-21 08:55:21.000000000 +0100
@@ -185,12 +185,12 @@ static inline void mx53_loco_fec_reset(v
 	int ret;
 
 	/* reset FEC PHY */
-	ret = gpio_request(LOCO_FEC_PHY_RST, "fec-phy-reset");
+	ret = gpio_request_one(LOCO_FEC_PHY_RST, GPIOF_OUT_INIT_LOW,
+			       "fec-phy-reset");
 	if (ret) {
 		printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
 		return;
 	}
-	gpio_direction_output(LOCO_FEC_PHY_RST, 0);
 	msleep(1);
 	gpio_set_value(LOCO_FEC_PHY_RST, 1);
 }
diff -u -p a/arch/arm/mach-mx5/board-mx53_smd.c b/arch/arm/mach-mx5/board-mx53_smd.c
--- a/arch/arm/mach-mx5/board-mx53_smd.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx5/board-mx53_smd.c 2011-03-21 08:55:25.000000000 +0100
@@ -70,12 +70,12 @@ static inline void mx53_smd_fec_reset(vo
 	int ret;
 
 	/* reset FEC PHY */
-	ret = gpio_request(SMD_FEC_PHY_RST, "fec-phy-reset");
+	ret = gpio_request_one(SMD_FEC_PHY_RST, GPIOF_OUT_INIT_LOW,
+			       "fec-phy-reset");
 	if (ret) {
 		printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
 		return;
 	}
-	gpio_direction_output(SMD_FEC_PHY_RST, 0);
 	msleep(1);
 	gpio_set_value(SMD_FEC_PHY_RST, 1);
 }
diff -u -p a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
--- a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c 2011-03-21 08:55:21.000000000 +0100
@@ -193,25 +193,20 @@ void __init eukrea_mbimx51_baseboard_ini
 	imx51_add_imx_uart(1, NULL);
 	imx51_add_imx_uart(2, &uart_pdata);
 
-	gpio_request(MBIMX51_LED0, "LED0");
-	gpio_direction_output(MBIMX51_LED0, 1);
+	gpio_request_one(MBIMX51_LED0, GPIOF_OUT_INIT_HIGH, "LED0");
 	gpio_free(MBIMX51_LED0);
-	gpio_request(MBIMX51_LED1, "LED1");
-	gpio_direction_output(MBIMX51_LED1, 1);
+	gpio_request_one(MBIMX51_LED1, GPIOF_OUT_INIT_HIGH, "LED1");
 	gpio_free(MBIMX51_LED1);
-	gpio_request(MBIMX51_LED2, "LED2");
-	gpio_direction_output(MBIMX51_LED2, 1);
+	gpio_request_one(MBIMX51_LED2, GPIOF_OUT_INIT_HIGH, "LED2");
 	gpio_free(MBIMX51_LED2);
-	gpio_request(MBIMX51_LED3, "LED3");
-	gpio_direction_output(MBIMX51_LED3, 1);
+	gpio_request_one(MBIMX51_LED3, GPIOF_OUT_INIT_HIGH, "LED3");
 	gpio_free(MBIMX51_LED3);
 
 	platform_add_devices(devices, ARRAY_SIZE(devices));
 
 	imx51_add_imx_keypad(&mbimx51_map_data);
 
-	gpio_request(MBIMX51_TSC2007_GPIO, "tsc2007_irq");
-	gpio_direction_input(MBIMX51_TSC2007_GPIO);
+	gpio_request_one(MBIMX51_TSC2007_GPIO, GPIOF_IN, "tsc2007_irq");
 	set_irq_type(MBIMX51_TSC2007_IRQ, IRQF_TRIGGER_FALLING);
 	i2c_register_board_info(1, mbimx51_i2c_devices,
 				ARRAY_SIZE(mbimx51_i2c_devices));
diff -u -p a/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c
--- a/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c 2011-01-09 09:32:57.000000000 +0100
+++ b/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c 2011-03-21 08:55:24.000000000 +0100
@@ -150,12 +150,10 @@ void __init eukrea_mbimxsd51_baseboard_i
 
 	imx51_add_sdhci_esdhc_imx(0, NULL);
 
-	gpio_request(GPIO_LED1, "LED1");
-	gpio_direction_output(GPIO_LED1, 1);
+	gpio_request_one(GPIO_LED1, GPIOF_OUT_INIT_HIGH, "LED1");
 	gpio_free(GPIO_LED1);
 
-	gpio_request(GPIO_SWITCH1, "SWITCH1");
-	gpio_direction_input(GPIO_SWITCH1);
+	gpio_request_one(GPIO_SWITCH1, GPIOF_IN, "SWITCH1");
 	gpio_free(GPIO_SWITCH1);
 
 	i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
diff -u -p a/arch/arm/mach-mx5/mx51_efika.c b/arch/arm/mach-mx5/mx51_efika.c
--- a/arch/arm/mach-mx5/mx51_efika.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mx5/mx51_efika.c 2011-03-21 08:55:25.000000000 +0100
@@ -168,8 +168,7 @@ static int initialize_usbh1_port(struct 
 	void __iomem *socregs_base;
 
 	mxc_iomux_v3_setup_pad(usbh1gpio);
-	gpio_request(EFIKAMX_USBH1_STP, "usbh1_stp");
-	gpio_direction_output(EFIKAMX_USBH1_STP, 0);
+	gpio_request_one(EFIKAMX_USBH1_STP, GPIOF_OUT_INIT_LOW, "usbh1_stp");
 	msleep(1);
 	gpio_set_value(EFIKAMX_USBH1_STP, 1);
 	msleep(1);
@@ -200,8 +199,8 @@ static struct mxc_usbh_platform_data usb
 
 static void mx51_efika_hubreset(void)
 {
-	gpio_request(EFIKAMX_USB_HUB_RESET, "usb_hub_rst");
-	gpio_direction_output(EFIKAMX_USB_HUB_RESET, 1);
+	gpio_request_one(EFIKAMX_USB_HUB_RESET, GPIOF_OUT_INIT_HIGH,
+			 "usb_hub_rst");
 	msleep(1);
 	gpio_set_value(EFIKAMX_USB_HUB_RESET, 0);
 	msleep(1);
@@ -213,8 +212,8 @@ static void __init mx51_efika_usb(void)
 	mx51_efika_hubreset();
 
 	/* pulling it low, means no USB at all... */
-	gpio_request(EFIKA_USB_PHY_RESET, "usb_phy_reset");
-	gpio_direction_output(EFIKA_USB_PHY_RESET, 0);
+	gpio_request_one(EFIKA_USB_PHY_RESET, GPIOF_OUT_INIT_LOW,
+			 "usb_phy_reset");
 	msleep(1);
 	gpio_set_value(EFIKA_USB_PHY_RESET, 1);
 
@@ -623,8 +622,7 @@ void __init efika_board_common_init(void
 	if (machine_is_mx51_efikasb())
 		vgen1_init.constraints.max_uV = 1200000;
 
-	gpio_request(EFIKAMX_PMIC, "pmic irq");
-	gpio_direction_input(EFIKAMX_PMIC);
+	gpio_request_one(EFIKAMX_PMIC, GPIOF_IN, "pmic irq");
 	spi_register_board_info(mx51_efika_spi_board_info,
 		ARRAY_SIZE(mx51_efika_spi_board_info));
 	imx51_add_ecspi(0, &mx51_efika_spi_pdata);
diff -u -p a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c
--- a/arch/arm/mach-mxs/mach-mx28evk.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-mxs/mach-mx28evk.c 2011-03-21 08:55:24.000000000 +0100
@@ -142,13 +142,13 @@ static void __init mx28evk_fec_reset(voi
 	}
 
 	/* Reset fec phy */
-	ret = gpio_request(MX28EVK_FEC_PHY_RESET, "fec-phy-reset");
+	ret = gpio_request_one(MX28EVK_FEC_PHY_RESET, GPIOF_OUT_INIT_LOW,
+			       "fec-phy-reset");
 	if (ret) {
 		pr_err("Failed to request gpio fec-phy-%s: %d\n", "reset", ret);
 		return;
 	}
 
-	gpio_direction_output(MX28EVK_FEC_PHY_RESET, 0);
 	if (ret) {
 		pr_err("Failed to drive gpio fec-phy-%s: %d\n", "reset", ret);
 		return;
diff -u -p a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
--- a/arch/arm/mach-omap1/board-ams-delta.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-omap1/board-ams-delta.c 2011-03-21 08:55:22.000000000 +0100
@@ -364,12 +364,12 @@ static int __init ams_delta_modem_init(v
 	ams_delta_modem_ports[0].irq =
 			gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
 
-	err = gpio_request(AMS_DELTA_GPIO_PIN_MODEM_IRQ, "modem");
+	err = gpio_request_one(AMS_DELTA_GPIO_PIN_MODEM_IRQ, GPIOF_IN,
+			       "modem");
 	if (err) {
 		pr_err("Couldn't request gpio pin for modem\n");
 		return err;
 	}
-	gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
 
 	ams_delta_latch2_write(
 		AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC,
diff -u -p a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
--- a/arch/arm/mach-omap1/board-fsample.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-omap1/board-fsample.c 2011-03-21 08:55:23.000000000 +0100
@@ -299,9 +299,8 @@ static void __init omap_fsample_init(voi
 {
 	fsample_init_smc91x();
 
-	if (gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0)
+	if (gpio_request_one(FSAMPLE_NAND_RB_GPIO_PIN, GPIOF_IN, "NAND ready") < 0)
 		BUG();
-	gpio_direction_input(FSAMPLE_NAND_RB_GPIO_PIN);
 
 	omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
 	omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
diff -u -p a/arch/arm/mach-omap1/board-h2-mmc.c b/arch/arm/mach-omap1/board-h2-mmc.c
--- a/arch/arm/mach-omap1/board-h2-mmc.c 2010-10-04 07:26:41.000000000 +0200
+++ b/arch/arm/mach-omap1/board-h2-mmc.c 2011-03-21 08:55:24.000000000 +0100
@@ -32,12 +32,11 @@ static int mmc_set_power(struct device *
 
 static int mmc_late_init(struct device *dev)
 {
-	int ret = gpio_request(H2_TPS_GPIO_MMC_PWR_EN, "MMC power");
+	int ret = gpio_request_one(H2_TPS_GPIO_MMC_PWR_EN,
+				   GPIOF_OUT_INIT_LOW, "MMC power");
 	if (ret < 0)
 		return ret;
 
-	gpio_direction_output(H2_TPS_GPIO_MMC_PWR_EN, 0);
-
 	return ret;
 }
 
diff -u -p a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
--- a/arch/arm/mach-omap1/board-h2.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-omap1/board-h2.c 2011-03-21 08:55:24.000000000 +0100
@@ -420,9 +420,8 @@ static void __init h2_init(void)
 
 	h2_nand_resource.end = h2_nand_resource.start = OMAP_CS2B_PHYS;
 	h2_nand_resource.end += SZ_4K - 1;
-	if (gpio_request(H2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
+	if (gpio_request_one(H2_NAND_RB_GPIO_PIN, GPIOF_IN, "NAND ready") < 0)
 		BUG();
-	gpio_direction_input(H2_NAND_RB_GPIO_PIN);
 
 	omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
 	omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
diff -u -p a/arch/arm/mach-omap1/board-h3-mmc.c b/arch/arm/mach-omap1/board-h3-mmc.c
--- a/arch/arm/mach-omap1/board-h3-mmc.c 2010-10-04 07:26:41.000000000 +0200
+++ b/arch/arm/mach-omap1/board-h3-mmc.c 2011-03-21 08:55:24.000000000 +0100
@@ -51,10 +51,10 @@ void __init h3_mmc_init(void)
 {
 	int ret;
 
-	ret = gpio_request(H3_TPS_GPIO_MMC_PWR_EN, "MMC power");
+	ret = gpio_request_one(H3_TPS_GPIO_MMC_PWR_EN, GPIOF_OUT_INIT_LOW,
+			       "MMC power");
 	if (ret < 0)
 		return;
-	gpio_direction_output(H3_TPS_GPIO_MMC_PWR_EN, 0);
 
 	mmc_data[0] = &mmc1_data;
 	omap1_init_mmc(mmc_data, OMAP16XX_NR_MMC);
diff -u -p a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
--- a/arch/arm/mach-omap1/board-h3.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-omap1/board-h3.c 2011-03-21 08:55:24.000000000 +0100
@@ -403,9 +403,8 @@ static void __init h3_init(void)
 
 	nand_resource.end = nand_resource.start = OMAP_CS2B_PHYS;
 	nand_resource.end += SZ_4K - 1;
-	if (gpio_request(H3_NAND_RB_GPIO_PIN, "NAND ready") < 0)
+	if (gpio_request_one(H3_NAND_RB_GPIO_PIN, GPIOF_IN, "NAND ready") < 0)
 		BUG();
-	gpio_direction_input(H3_NAND_RB_GPIO_PIN);
 
 	/* GPIO10 Func_MUX_CTRL reg bit 29:27, Configure V2 to mode1 as GPIO */
 	/* GPIO10 pullup/down register, Enable pullup on GPIO10 */
diff -u -p a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
--- a/arch/arm/mach-omap1/board-nokia770.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-omap1/board-nokia770.c 2011-03-21 08:55:24.000000000 +0100
@@ -221,17 +221,17 @@ static void __init nokia770_mmc_init(voi
 {
 	int ret;
 
-	ret = gpio_request(NOKIA770_GPIO_MMC_POWER, "MMC power");
+	ret = gpio_request_one(NOKIA770_GPIO_MMC_POWER, GPIOF_OUT_INIT_LOW,
+			       "MMC power");
 	if (ret < 0)
 		return;
-	gpio_direction_output(NOKIA770_GPIO_MMC_POWER, 0);
 
-	ret = gpio_request(NOKIA770_GPIO_MMC_SWITCH, "MMC cover");
+	ret = gpio_request_one(NOKIA770_GPIO_MMC_SWITCH, GPIOF_IN,
+			       "MMC cover");
 	if (ret < 0) {
 		gpio_free(NOKIA770_GPIO_MMC_POWER);
 		return;
 	}
-	gpio_direction_input(NOKIA770_GPIO_MMC_SWITCH);
 
 	/* Only the second MMC controller is used */
 	nokia770_mmc_data[1] = &nokia770_mmc2_data;
diff -u -p a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
--- a/arch/arm/mach-omap1/board-osk.c 2010-12-28 18:26:02.000000000 +0100
+++ b/arch/arm/mach-omap1/board-osk.c 2011-03-21 08:55:23.000000000 +0100
@@ -197,19 +197,19 @@ static int osk_tps_setup(struct i2c_clie
 	/* Set GPIO 1 HIGH to disable VBUS power supply;
 	 * OHCI driver powers it up/down as needed.
 	 */
-	gpio_request(OSK_TPS_GPIO_USB_PWR_EN, "n_vbus_en");
-	gpio_direction_output(OSK_TPS_GPIO_USB_PWR_EN, 1);
+	gpio_request_one(OSK_TPS_GPIO_USB_PWR_EN, GPIOF_OUT_INIT_HIGH,
+			 "n_vbus_en");
 
 	/* Set GPIO 2 high so LED D3 is off by default */
 	tps65010_set_gpio_out_value(GPIO2, HIGH);
 
 	/* Set GPIO 3 low to take ethernet out of reset */
-	gpio_request(OSK_TPS_GPIO_LAN_RESET, "smc_reset");
-	gpio_direction_output(OSK_TPS_GPIO_LAN_RESET, 0);
+	gpio_request_one(OSK_TPS_GPIO_LAN_RESET, GPIOF_OUT_INIT_LOW,
+			 "smc_reset");
 
 	/* GPIO4 is VDD_DSP */
-	gpio_request(OSK_TPS_GPIO_DSP_PWR_EN, "dsp_power");
-	gpio_direction_output(OSK_TPS_GPIO_DSP_PWR_EN, 1);
+	gpio_request_one(OSK_TPS_GPIO_DSP_PWR_EN, GPIOF_OUT_INIT_HIGH,
+			 "dsp_power");
 	/* REVISIT if DSP support isn't configured, power it off ... */
 
 	/* Let LED1 (D9) blink; leds-gpio may override it */
@@ -476,12 +476,10 @@ static void __init osk_mistral_init(void
 
 
 	/* omap_cfg_reg(P19_1610_GPIO6); */	/* BUSY */
-	gpio_request(6, "ts_busy");
-	gpio_direction_input(6);
+	gpio_request_one(6, GPIOF_IN, "ts_busy");
 
 	omap_cfg_reg(P20_1610_GPIO4);	/* PENIRQ */
-	gpio_request(4, "ts_int");
-	gpio_direction_input(4);
+	gpio_request_one(4, GPIOF_IN, "ts_int");
 	set_irq_type(gpio_to_irq(4), IRQ_TYPE_EDGE_FALLING);
 
 	spi_register_board_info(mistral_boardinfo,
diff -u -p a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
--- a/arch/arm/mach-omap1/board-palmte.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-omap1/board-palmte.c 2011-03-21 08:55:23.000000000 +0100
@@ -233,18 +233,16 @@ static struct spi_board_info palmte_spi_
 static void __init palmte_misc_gpio_setup(void)
 {
 	/* Set TSC2102 PINTDAV pin as input (used by TSC2102 driver) */
-	if (gpio_request(PALMTE_PINTDAV_GPIO, "TSC2102 PINTDAV") < 0) {
+	if (gpio_request_one(PALMTE_PINTDAV_GPIO, GPIOF_IN, "TSC2102 PINTDAV") < 0) {
 		printk(KERN_ERR "Could not reserve PINTDAV GPIO!\n");
 		return;
 	}
-	gpio_direction_input(PALMTE_PINTDAV_GPIO);
 
 	/* Set USB-or-DC-IN pin as input (unused) */
-	if (gpio_request(PALMTE_USB_OR_DC_GPIO, "USB/DC-IN") < 0) {
+	if (gpio_request_one(PALMTE_USB_OR_DC_GPIO, GPIOF_IN, "USB/DC-IN") < 0) {
 		printk(KERN_ERR "Could not reserve cable signal GPIO!\n");
 		return;
 	}
-	gpio_direction_input(PALMTE_USB_OR_DC_GPIO);
 }
 
 static void __init omap_palmte_init(void)
diff -u -p a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
--- a/arch/arm/mach-omap1/board-palmz71.c 2010-12-28 18:26:02.000000000 +0100
+++ b/arch/arm/mach-omap1/board-palmz71.c 2011-03-21 08:55:23.000000000 +0100
@@ -285,19 +285,18 @@ palmz71_gpio_setup(int early)
 		gpio_direction_output(1, 1);
 	} else {
 		/* Set MMC/SD host WP pin as input */
-		if (gpio_request(PALMZ71_MMC_WP_GPIO, "MMC WP") < 0) {
+		if (gpio_request_one(PALMZ71_MMC_WP_GPIO, GPIOF_IN, "MMC WP") < 0) {
 			printk(KERN_ERR "Could not reserve WP GPIO!\n");
 			return;
 		}
-		gpio_direction_input(PALMZ71_MMC_WP_GPIO);
 
 		/* Monitor the Power-cable-connected signal */
-		if (gpio_request(PALMZ71_USBDETECT_GPIO, "USB detect") < 0) {
+		if (gpio_request_one(PALMZ71_USBDETECT_GPIO, GPIOF_IN,
+				     "USB detect") < 0) {
 			printk(KERN_ERR
 				"Could not reserve cable signal GPIO!\n");
 			return;
 		}
-		gpio_direction_input(PALMZ71_USBDETECT_GPIO);
 		if (request_irq(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
 				palmz71_powercable, IRQF_SAMPLE_RANDOM,
 				"palmz71-cable", 0))
diff -u -p a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
--- a/arch/arm/mach-omap1/board-perseus2.c 2010-12-28 18:26:02.000000000 +0100
+++ b/arch/arm/mach-omap1/board-perseus2.c 2011-03-21 08:55:22.000000000 +0100
@@ -267,9 +267,8 @@ static void __init omap_perseus2_init(vo
 {
 	perseus2_init_smc91x();
 
-	if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
+	if (gpio_request_one(P2_NAND_RB_GPIO_PIN, GPIOF_IN, "NAND ready") < 0)
 		BUG();
-	gpio_direction_input(P2_NAND_RB_GPIO_PIN);
 
 	omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
 	omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
diff -u -p a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
--- a/arch/arm/mach-omap1/board-voiceblue.c 2011-02-11 10:53:31.000000000 +0100
+++ b/arch/arm/mach-omap1/board-voiceblue.c 2011-03-21 08:55:24.000000000 +0100
@@ -264,16 +264,14 @@ static void __init voiceblue_init(void)
 	/* Watchdog */
 	gpio_request(0, "Watchdog");
 	/* smc91x reset */
-	gpio_request(7, "SMC91x reset");
-	gpio_direction_output(7, 1);
+	gpio_request_one(7, GPIOF_OUT_INIT_HIGH, "SMC91x reset");
 	udelay(2);	/* wait@least 100ns */
 	gpio_set_value(7, 0);
 	mdelay(50);	/* 50ms until PHY ready */
 	/* smc91x interrupt pin */
 	gpio_request(8, "SMC91x irq");
 	/* 16C554 reset*/
-	gpio_request(6, "16C554 reset");
-	gpio_direction_output(6, 0);
+	gpio_request_one(6, GPIOF_OUT_INIT_LOW, "16C554 reset");
 	/* 16C554 interrupt pins */
 	gpio_request(12, "16C554 irq");
 	gpio_request(13, "16C554 irq");
diff -u -p a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
--- a/arch/arm/mach-omap1/fpga.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/arm/mach-omap1/fpga.c 2011-03-21 08:55:24.000000000 +0100
@@ -177,12 +177,11 @@ void omap1510_fpga_init_irq(void)
 	 * NOTE: For general GPIO/MPUIO access and interrupts, please see
 	 * gpio.[ch]
 	 */
-	res = gpio_request(13, "FPGA irq");
+	res = gpio_request_one(13, GPIOF_IN, "FPGA irq");
 	if (res) {
 		pr_err("%s failed to get gpio\n", __func__);
 		return;
 	}
-	gpio_direction_input(13);
 	set_irq_type(gpio_to_irq(13), IRQ_TYPE_EDGE_RISING);
 	set_irq_chained_handler(OMAP1510_INT_FPGA, innovator_fpga_IRQ_demux);
 }
diff -u -p a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
--- a/arch/arm/mach-omap1/serial.c 2010-12-26 10:19:06.000000000 +0100
+++ b/arch/arm/mach-omap1/serial.c 2011-03-21 08:55:23.000000000 +0100
@@ -220,13 +220,12 @@ static void __init omap_serial_set_port_
 {
 	int ret;
 
-	ret = gpio_request(gpio_nr, "UART wake");
+	ret = gpio_request_one(gpio_nr, GPIOF_IN, "UART wake");
 	if (ret < 0) {
 		printk(KERN_ERR "Could not request UART wake GPIO: %i\n",
 		       gpio_nr);
 		return;
 	}
-	gpio_direction_input(gpio_nr);
 	ret = request_irq(gpio_to_irq(gpio_nr), &omap_serial_wake_interrupt,
 			  IRQF_TRIGGER_RISING, "serial wakeup", NULL);
 	if (ret) {
diff -u -p a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
--- a/arch/arm/mach-omap2/board-3430sdp.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-3430sdp.c 2011-03-21 08:55:23.000000000 +0100
@@ -132,12 +132,11 @@ static int ts_gpio;	/* Needed for ads784
  */
 static void ads7846_dev_init(void)
 {
-	if (gpio_request(ts_gpio, "ADS7846 pendown") < 0) {
+	if (gpio_request_one(ts_gpio, GPIOF_IN, "ADS7846 pendown") < 0) {
 		printk(KERN_ERR "can't get ads746 pen down GPIO\n");
 		return;
 	}
 
-	gpio_direction_input(ts_gpio);
 	gpio_set_debounce(ts_gpio, 310);
 }
 
@@ -360,12 +359,10 @@ static int sdp3430_twl_gpio_setup(struct
 	omap2_hsmmc_init(mmc);
 
 	/* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */
-	gpio_request(gpio + 7, "sub_lcd_en_bkl");
-	gpio_direction_output(gpio + 7, 0);
+	gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "sub_lcd_en_bkl");
 
 	/* gpio + 15 is "sub_lcd_nRST" (output) */
-	gpio_request(gpio + 15, "sub_lcd_nRST");
-	gpio_direction_output(gpio + 15, 0);
+	gpio_request_one(gpio + 15, GPIOF_OUT_INIT_LOW, "sub_lcd_nRST");
 
 	return 0;
 }
diff -u -p a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
--- a/arch/arm/mach-omap2/board-am3517evm.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-am3517evm.c 2011-03-21 08:55:25.000000000 +0100
@@ -252,30 +252,29 @@ static void __init am3517_evm_display_in
 	/*
 	 * Enable GPIO 182 = LCD Backlight Power
 	 */
-	r = gpio_request(LCD_PANEL_BKLIGHT_PWR, "lcd_backlight_pwr");
+	r = gpio_request_one(LCD_PANEL_BKLIGHT_PWR, GPIOF_OUT_INIT_HIGH,
+			     "lcd_backlight_pwr");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_backlight_pwr\n");
 		return;
 	}
-	gpio_direction_output(LCD_PANEL_BKLIGHT_PWR, 1);
 	/*
 	 * Enable GPIO 181 = LCD Panel PWM
 	 */
-	r = gpio_request(LCD_PANEL_PWM, "lcd_pwm");
+	r = gpio_request_one(LCD_PANEL_PWM, GPIOF_OUT_INIT_HIGH, "lcd_pwm");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_pwm\n");
 		goto err_1;
 	}
-	gpio_direction_output(LCD_PANEL_PWM, 1);
 	/*
 	 * Enable GPIO 176 = LCD Panel Power enable pin
 	 */
-	r = gpio_request(LCD_PANEL_PWR, "lcd_panel_pwr");
+	r = gpio_request_one(LCD_PANEL_PWR, GPIOF_OUT_INIT_HIGH,
+			     "lcd_panel_pwr");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_panel_pwr\n");
 		goto err_2;
 	}
-	gpio_direction_output(LCD_PANEL_PWR, 1);
 
 	printk(KERN_INFO "Display initialized successfully\n");
 	return;
diff -u -p a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
--- a/arch/arm/mach-omap2/board-apollon.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-apollon.c 2011-03-21 08:55:24.000000000 +0100
@@ -246,13 +246,12 @@ static inline void __init apollon_init_s
 	udelay(100);
 
 	omap_mux_init_gpio(74, 0);
-	if (gpio_request(APOLLON_ETHR_GPIO_IRQ, "SMC91x irq") < 0) {
+	if (gpio_request_one(APOLLON_ETHR_GPIO_IRQ, GPIOF_IN, "SMC91x irq") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
 			APOLLON_ETHR_GPIO_IRQ);
 		gpmc_cs_free(APOLLON_ETH_CS);
 		goto out;
 	}
-	gpio_direction_input(APOLLON_ETHR_GPIO_IRQ);
 
 out:
 	clk_disable(gpmc_fck);
@@ -284,16 +283,13 @@ static void __init apollon_led_init(void
 {
 	/* LED0 - AA10 */
 	omap_mux_init_signal("vlynq_clk.gpio_13", 0);
-	gpio_request(LED0_GPIO13, "LED0");
-	gpio_direction_output(LED0_GPIO13, 0);
+	gpio_request_one(LED0_GPIO13, GPIOF_OUT_INIT_LOW, "LED0");
 	/* LED1  - AA6 */
 	omap_mux_init_signal("vlynq_rx1.gpio_14", 0);
-	gpio_request(LED1_GPIO14, "LED1");
-	gpio_direction_output(LED1_GPIO14, 0);
+	gpio_request_one(LED1_GPIO14, GPIOF_OUT_INIT_LOW, "LED1");
 	/* LED2  - AA4 */
 	omap_mux_init_signal("vlynq_rx0.gpio_15", 0);
-	gpio_request(LED2_GPIO15, "LED2");
-	gpio_direction_output(LED2_GPIO15, 0);
+	gpio_request_one(LED2_GPIO15, GPIOF_OUT_INIT_LOW, "LED2");
 }
 
 static void __init apollon_usb_init(void)
@@ -301,8 +297,7 @@ static void __init apollon_usb_init(void
 	/* USB device */
 	/* DEVICE_SUSPEND */
 	omap_mux_init_signal("mcbsp2_clkx.gpio_12", 0);
-	gpio_request(12, "USB suspend");
-	gpio_direction_output(12, 0);
+	gpio_request_one(12, GPIOF_OUT_INIT_LOW, "USB suspend");
 	omap2_usbfs_init(&apollon_usb_config);
 }
 
diff -u -p a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
--- a/arch/arm/mach-omap2/board-cm-t3517.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-cm-t3517.c 2011-03-21 08:55:25.000000000 +0100
@@ -148,14 +148,13 @@ static void __init cm_t3517_init_rtc(voi
 {
 	int err;
 
-	err = gpio_request(RTC_CS_EN_GPIO, "rtc cs en");
+	err = gpio_request_one(RTC_CS_EN_GPIO, GPIOF_OUT_INIT_HIGH,
+			       "rtc cs en");
 	if (err) {
 		pr_err("CM-T3517: rtc cs en gpio request failed: %d\n", err);
 		return;
 	}
 
-	gpio_direction_output(RTC_CS_EN_GPIO, 1);
-
 	platform_device_register(&cm_t3517_rtc_device);
 }
 #else
diff -u -p a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
--- a/arch/arm/mach-omap2/board-devkit8000.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-devkit8000.c 2011-03-21 08:55:26.000000000 +0100
@@ -468,14 +468,12 @@ static void __init devkit8000_ads7846_in
 	int gpio = OMAP3_DEVKIT_TS_GPIO;
 	int ret;
 
-	ret = gpio_request(gpio, "ads7846_pen_down");
+	ret = gpio_request_one(gpio, GPIOF_IN, "ads7846_pen_down");
 	if (ret < 0) {
 		printk(KERN_ERR "Failed to request GPIO %d for "
 				"ads7846 pen down IRQ\n", gpio);
 		return;
 	}
-
-	gpio_direction_input(gpio);
 }
 
 static int ads7846_get_pendown_state(void)
@@ -551,14 +549,12 @@ static void __init omap_dm9000_init(void
 	unsigned char *eth_addr = omap_dm9000_platdata.dev_addr;
 	struct omap_die_id odi;
 
-	if (gpio_request(OMAP_DM9000_GPIO_IRQ, "dm9000 irq") < 0) {
+	if (gpio_request_one(OMAP_DM9000_GPIO_IRQ, GPIOF_IN, "dm9000 irq") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ\n",
 			OMAP_DM9000_GPIO_IRQ);
 		return;
 		}
 
-	gpio_direction_input(OMAP_DM9000_GPIO_IRQ);
-
 	/* init the mac address using DIE id */
 	omap_get_die_id(&odi);
 
diff -u -p a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
--- a/arch/arm/mach-omap2/board-ldp.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-ldp.c 2011-03-21 08:55:25.000000000 +0100
@@ -206,12 +206,11 @@ static int ts_gpio;
  */
 static void ads7846_dev_init(void)
 {
-	if (gpio_request(ts_gpio, "ads7846 irq") < 0) {
+	if (gpio_request_one(ts_gpio, GPIOF_IN, "ads7846 irq") < 0) {
 		printk(KERN_ERR "can't get ads746 pen down GPIO\n");
 		return;
 	}
 
-	gpio_direction_input(ts_gpio);
 	gpio_set_debounce(ts_gpio, 310);
 }
 
@@ -267,12 +266,11 @@ static inline void __init ldp_init_smsc9
 
 	ldp_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
 
-	if (gpio_request(eth_gpio, "smsc911x irq") < 0) {
+	if (gpio_request_one(eth_gpio, GPIOF_IN, "smsc911x irq") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
 				eth_gpio);
 		return;
 	}
-	gpio_direction_input(eth_gpio);
 }
 
 static struct platform_device ldp_lcd_device = {
diff -u -p a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
--- a/arch/arm/mach-omap2/board-n8x0.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-n8x0.c 2011-03-21 08:55:24.000000000 +0100
@@ -106,13 +106,13 @@ static void __init n8x0_usb_init(void)
 	static char	announce[] __initdata = KERN_INFO "TUSB 6010\n";
 
 	/* PM companion chip power control pin */
-	ret = gpio_request(TUSB6010_GPIO_ENABLE, "TUSB6010 enable");
+	ret = gpio_request_one(TUSB6010_GPIO_ENABLE, GPIOF_OUT_INIT_LOW,
+			       "TUSB6010 enable");
 	if (ret != 0) {
 		printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
 		       TUSB6010_GPIO_ENABLE);
 		return;
 	}
-	gpio_direction_output(TUSB6010_GPIO_ENABLE, 0);
 
 	tusb_set_power(0);
 
@@ -512,27 +512,26 @@ static void __init n8x0_mmc_init(void)
 		mmc1_data.slots[1].ban_openended = 1;
 	}
 
-	err = gpio_request(N8X0_SLOT_SWITCH_GPIO, "MMC slot switch");
+	err = gpio_request_one(N8X0_SLOT_SWITCH_GPIO, GPIOF_OUT_INIT_LOW,
+			       "MMC slot switch");
 	if (err)
 		return;
 
-	gpio_direction_output(N8X0_SLOT_SWITCH_GPIO, 0);
-
 	if (machine_is_nokia_n810()) {
-		err = gpio_request(N810_EMMC_VSD_GPIO, "MMC slot 2 Vddf");
+		err = gpio_request_one(N810_EMMC_VSD_GPIO,
+				       GPIOF_OUT_INIT_LOW, "MMC slot 2 Vddf");
 		if (err) {
 			gpio_free(N8X0_SLOT_SWITCH_GPIO);
 			return;
 		}
-		gpio_direction_output(N810_EMMC_VSD_GPIO, 0);
 
-		err = gpio_request(N810_EMMC_VIO_GPIO, "MMC slot 2 Vdd");
+		err = gpio_request_one(N810_EMMC_VIO_GPIO,
+				       GPIOF_OUT_INIT_LOW, "MMC slot 2 Vdd");
 		if (err) {
 			gpio_free(N8X0_SLOT_SWITCH_GPIO);
 			gpio_free(N810_EMMC_VSD_GPIO);
 			return;
 		}
-		gpio_direction_output(N810_EMMC_VIO_GPIO, 0);
 	}
 
 	mmc_data[0] = &mmc1_data;
diff -u -p a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
--- a/arch/arm/mach-omap2/board-omap3beagle.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-omap3beagle.c 2011-03-21 08:55:25.000000000 +0100
@@ -243,13 +243,12 @@ static void __init beagle_display_init(v
 {
 	int r;
 
-	r = gpio_request(beagle_dvi_device.reset_gpio, "DVI reset");
+	r = gpio_request_one(beagle_dvi_device.reset_gpio,
+			     GPIOF_OUT_INIT_LOW, "DVI reset");
 	if (r < 0) {
 		printk(KERN_ERR "Unable to get DVI reset GPIO\n");
 		return;
 	}
-
-	gpio_direction_output(beagle_dvi_device.reset_gpio, 0);
 }
 
 #include "sdram-micron-mt46h32m32lf-6.h"
diff -u -p a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
--- a/arch/arm/mach-omap2/board-omap3evm.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-omap3evm.c 2011-03-21 08:55:23.000000000 +0100
@@ -171,13 +171,12 @@ static inline void __init omap3evm_init_
 		usleep_range(1, 2);
 	}
 
-	if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) {
+	if (gpio_request_one(OMAP3EVM_ETHR_GPIO_IRQ, GPIOF_IN, "SMSC911x irq") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
 			OMAP3EVM_ETHR_GPIO_IRQ);
 		return;
 	}
 
-	gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ);
 	platform_device_register(&omap3evm_smsc911x_device);
 }
 
@@ -204,47 +203,47 @@ static void __init omap3_evm_display_ini
 {
 	int r;
 
-	r = gpio_request(OMAP3EVM_LCD_PANEL_RESB, "lcd_panel_resb");
+	r = gpio_request_one(OMAP3EVM_LCD_PANEL_RESB, GPIOF_OUT_INIT_HIGH,
+			     "lcd_panel_resb");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_panel_resb\n");
 		return;
 	}
-	gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB, 1);
 
-	r = gpio_request(OMAP3EVM_LCD_PANEL_INI, "lcd_panel_ini");
+	r = gpio_request_one(OMAP3EVM_LCD_PANEL_INI, GPIOF_OUT_INIT_HIGH,
+			     "lcd_panel_ini");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_panel_ini\n");
 		goto err_1;
 	}
-	gpio_direction_output(OMAP3EVM_LCD_PANEL_INI, 1);
 
-	r = gpio_request(OMAP3EVM_LCD_PANEL_QVGA, "lcd_panel_qvga");
+	r = gpio_request_one(OMAP3EVM_LCD_PANEL_QVGA, GPIOF_OUT_INIT_LOW,
+			     "lcd_panel_qvga");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_panel_qvga\n");
 		goto err_2;
 	}
-	gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA, 0);
 
-	r = gpio_request(OMAP3EVM_LCD_PANEL_LR, "lcd_panel_lr");
+	r = gpio_request_one(OMAP3EVM_LCD_PANEL_LR, GPIOF_OUT_INIT_HIGH,
+			     "lcd_panel_lr");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_panel_lr\n");
 		goto err_3;
 	}
-	gpio_direction_output(OMAP3EVM_LCD_PANEL_LR, 1);
 
-	r = gpio_request(OMAP3EVM_LCD_PANEL_UD, "lcd_panel_ud");
+	r = gpio_request_one(OMAP3EVM_LCD_PANEL_UD, GPIOF_OUT_INIT_HIGH,
+			     "lcd_panel_ud");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_panel_ud\n");
 		goto err_4;
 	}
-	gpio_direction_output(OMAP3EVM_LCD_PANEL_UD, 1);
 
-	r = gpio_request(OMAP3EVM_LCD_PANEL_ENVDD, "lcd_panel_envdd");
+	r = gpio_request_one(OMAP3EVM_LCD_PANEL_ENVDD, GPIOF_OUT_INIT_LOW,
+			     "lcd_panel_envdd");
 	if (r) {
 		printk(KERN_ERR "failed to get lcd_panel_envdd\n");
 		goto err_5;
 	}
-	gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD, 0);
 
 	return;
 
@@ -473,8 +472,7 @@ static int omap3evm_twl_gpio_setup(struc
 		printk(KERN_ERR "failed to get/set lcd_bkl gpio\n");
 
 	/* gpio + 7 == DVI Enable */
-	gpio_request(gpio + 7, "EN_DVI");
-	gpio_direction_output(gpio + 7, 0);
+	gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI");
 
 	/* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
 	gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -681,10 +679,9 @@ static int __init omap3_evm_i2c_init(voi
 
 static void ads7846_dev_init(void)
 {
-	if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0)
+	if (gpio_request_one(OMAP3_EVM_TS_GPIO, GPIOF_IN, "ADS7846 pendown") < 0)
 		printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
 
-	gpio_direction_input(OMAP3_EVM_TS_GPIO);
 	gpio_set_debounce(OMAP3_EVM_TS_GPIO, 310);
 }
 
@@ -852,14 +849,14 @@ static void __init omap3_evm_init(void)
 	if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
 		/* enable EHCI VBUS using GPIO22 */
 		omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP);
-		gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS");
-		gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0);
+		gpio_request_one(OMAP3_EVM_EHCI_VBUS, GPIOF_OUT_INIT_LOW,
+				 "enable EHCI VBUS");
 		gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1);
 
 		/* Select EHCI port on main board */
 		omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP);
-		gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port");
-		gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0);
+		gpio_request_one(OMAP3_EVM_EHCI_SELECT, GPIOF_OUT_INIT_LOW,
+				 "select EHCI port");
 		gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0);
 
 		/* setup EHCI phy reset config */
diff -u -p a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
--- a/arch/arm/mach-omap2/board-omap3pandora.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-omap3pandora.c 2011-03-21 08:55:25.000000000 +0100
@@ -575,14 +575,12 @@ static void __init omap3pandora_ads7846_
 	int gpio = OMAP3_PANDORA_TS_GPIO;
 	int ret;
 
-	ret = gpio_request(gpio, "ads7846_pen_down");
+	ret = gpio_request_one(gpio, GPIOF_IN, "ads7846_pen_down");
 	if (ret < 0) {
 		printk(KERN_ERR "Failed to request GPIO %d for "
 				"ads7846 pen down IRQ\n", gpio);
 		return;
 	}
-
-	gpio_direction_input(gpio);
 }
 
 static int ads7846_get_pendown_state(void)
diff -u -p a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
--- a/arch/arm/mach-omap2/board-omap3stalker.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-omap3stalker.c 2011-03-21 08:55:24.000000000 +0100
@@ -107,15 +107,14 @@ static inline void __init omap3stalker_i
 		rate = clk_get_rate(l3ck);
 
 	omap_mux_init_gpio(19, OMAP_PIN_INPUT_PULLUP);
-	if (gpio_request(OMAP3STALKER_ETHR_GPIO_IRQ, "SMC911x irq") < 0) {
+	if (gpio_request_one(OMAP3STALKER_ETHR_GPIO_IRQ, GPIOF_IN,
+			     "SMC911x irq") < 0) {
 		printk(KERN_ERR
 		       "Failed to request GPIO%d for smc911x IRQ\n",
 		       OMAP3STALKER_ETHR_GPIO_IRQ);
 		return;
 	}
 
-	gpio_direction_input(OMAP3STALKER_ETHR_GPIO_IRQ);
-
 	platform_device_register(&omap3stalker_smsc911x_device);
 }
 
@@ -365,12 +364,11 @@ omap3stalker_twl_gpio_setup(struct devic
 	 */
 
 	/* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */
-	gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL");
-	gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
+	gpio_request_one(gpio + TWL4030_GPIO_MAX, GPIOF_OUT_INIT_LOW,
+			 "EN_LCD_BKL");
 
 	/* gpio + 7 == DVI Enable */
-	gpio_request(gpio + 7, "EN_DVI");
-	gpio_direction_output(gpio + 7, 0);
+	gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI");
 
 	/* TWL4030_GPIO_MAX + 1 == ledB (out, mmc0) */
 	gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -534,10 +532,10 @@ static int __init omap3_stalker_i2c_init
 #define OMAP3_STALKER_TS_GPIO	175
 static void ads7846_dev_init(void)
 {
-	if (gpio_request(OMAP3_STALKER_TS_GPIO, "ADS7846 pendown") < 0)
+	if (gpio_request_one(OMAP3_STALKER_TS_GPIO, GPIOF_IN,
+			     "ADS7846 pendown") < 0)
 		printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
 
-	gpio_direction_input(OMAP3_STALKER_TS_GPIO);
 	gpio_set_debounce(OMAP3_STALKER_TS_GPIO, 310);
 }
 
diff -u -p a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
--- a/arch/arm/mach-omap2/board-omap3touchbook.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c 2011-03-21 08:55:22.000000000 +0100
@@ -155,12 +155,11 @@ static int touchbook_twl_gpio_setup(stru
 	 * power switch and overcurrent detect
 	 */
 
-	gpio_request(gpio + 1, "EHCI_nOC");
-	gpio_direction_input(gpio + 1);
+	gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC");
 
 	/* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */
-	gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR");
-	gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
+	gpio_request_one(gpio + TWL4030_GPIO_MAX, GPIOF_OUT_INIT_LOW,
+			 "nEN_USB_PWR");
 
 	/* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
 	gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -303,13 +302,12 @@ static int __init omap3_touchbook_i2c_in
 
 static void __init omap3_ads7846_init(void)
 {
-	if (gpio_request(OMAP3_TS_GPIO, "ads7846_pen_down")) {
+	if (gpio_request_one(OMAP3_TS_GPIO, GPIOF_IN, "ads7846_pen_down")) {
 		printk(KERN_ERR "Failed to request GPIO %d for "
 				"ads7846 pen down IRQ\n", OMAP3_TS_GPIO);
 		return;
 	}
 
-	gpio_direction_input(OMAP3_TS_GPIO);
 	gpio_set_debounce(OMAP3_TS_GPIO, 310);
 }
 
@@ -483,13 +481,12 @@ static void omap3_touchbook_poweroff(voi
 {
 	int r;
 
-	r = gpio_request(TB_KILL_POWER_GPIO, "DVI reset");
+	r = gpio_request_one(TB_KILL_POWER_GPIO, GPIOF_OUT_INIT_LOW,
+			     "DVI reset");
 	if (r < 0) {
 		printk(KERN_ERR "Unable to get kill power GPIO\n");
 		return;
 	}
-
-	gpio_direction_output(TB_KILL_POWER_GPIO, 0);
 }
 
 static int __init early_touchbook_revision(char *p)
diff -u -p a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c 2011-03-21 08:55:22.000000000 +0100
@@ -557,10 +557,8 @@ static __init void rx51_init_si4713(void
 static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
 {
 	/* FIXME this gpio setup is just a placeholder for now */
-	gpio_request(gpio + 6, "backlight_pwm");
-	gpio_direction_output(gpio + 6, 0);
-	gpio_request(gpio + 7, "speaker_en");
-	gpio_direction_output(gpio + 7, 1);
+	gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "backlight_pwm");
+	gpio_request_one(gpio + 7, GPIOF_OUT_INIT_HIGH, "speaker_en");
 
 	return 0;
 }
diff -u -p a/arch/arm/mach-omap2/board-rx51-video.c b/arch/arm/mach-omap2/board-rx51-video.c
--- a/arch/arm/mach-omap2/board-rx51-video.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-omap2/board-rx51-video.c 2011-03-21 08:55:24.000000000 +0100
@@ -76,13 +76,12 @@ static int __init rx51_video_init(void)
 		return 0;
 	}
 
-	if (gpio_request(RX51_LCD_RESET_GPIO, "LCD ACX565AKM reset")) {
+	if (gpio_request_one(RX51_LCD_RESET_GPIO, GPIOF_OUT_INIT_HIGH,
+			     "LCD ACX565AKM reset")) {
 		pr_err("%s failed to get LCD Reset GPIO\n", __func__);
 		return 0;
 	}
 
-	gpio_direction_output(RX51_LCD_RESET_GPIO, 1);
-
 	omap_display_init(&rx51_dss_board_info);
 	return 0;
 }
diff -u -p a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c
--- a/arch/arm/mach-omap2/board-zoom-debugboard.c 2010-10-14 18:30:03.000000000 +0200
+++ b/arch/arm/mach-omap2/board-zoom-debugboard.c 2011-03-21 08:55:23.000000000 +0100
@@ -74,12 +74,11 @@ static inline void __init zoom_init_smsc
 
 	zoom_smsc911x_resources[1].start = OMAP_GPIO_IRQ(eth_gpio);
 
-	if (gpio_request(eth_gpio, "smsc911x irq") < 0) {
+	if (gpio_request_one(eth_gpio, GPIOF_IN, "smsc911x irq") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
 				eth_gpio);
 		return;
 	}
-	gpio_direction_input(eth_gpio);
 }
 
 static struct plat_serial8250_port serial_platform_data[] = {
@@ -120,12 +119,11 @@ static inline void __init zoom_init_quad
 
 	quart_gpio = ZOOM_QUADUART_GPIO;
 
-	if (gpio_request(quart_gpio, "TL16CP754C GPIO") < 0) {
+	if (gpio_request_one(quart_gpio, GPIOF_IN, "TL16CP754C GPIO") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n",
 								quart_gpio);
 		return;
 	}
-	gpio_direction_input(quart_gpio);
 }
 
 static inline int omap_zoom_debugboard_detect(void)
@@ -135,12 +133,12 @@ static inline int omap_zoom_debugboard_d
 
 	debug_board_detect = ZOOM_SMSC911X_GPIO;
 
-	if (gpio_request(debug_board_detect, "Zoom debug board detect") < 0) {
+	if (gpio_request_one(debug_board_detect, GPIOF_IN,
+			     "Zoom debug board detect") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for Zoom debug"
 		"board detect\n", debug_board_detect);
 		return 0;
 	}
-	gpio_direction_input(debug_board_detect);
 
 	if (!gpio_get_value(debug_board_detect)) {
 		ret = 0;
diff -u -p a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c
--- a/arch/arm/mach-omap2/board-zoom-display.c 2011-02-19 08:28:51.000000000 +0100
+++ b/arch/arm/mach-omap2/board-zoom-display.c 2011-03-21 08:55:25.000000000 +0100
@@ -30,21 +30,21 @@ static void zoom_lcd_panel_init(void)
 			LCD_PANEL_RESET_GPIO_PROD :
 			LCD_PANEL_RESET_GPIO_PILOT;
 
-	ret = gpio_request(lcd_panel_reset_gpio, "lcd reset");
+	ret = gpio_request_one(lcd_panel_reset_gpio, GPIOF_OUT_INIT_HIGH,
+			       "lcd reset");
 	if (ret) {
 		pr_err("Failed to get LCD reset GPIO (gpio%d).\n",
 			lcd_panel_reset_gpio);
 		return;
 	}
-	gpio_direction_output(lcd_panel_reset_gpio, 1);
 
-	ret = gpio_request(LCD_PANEL_QVGA_GPIO, "lcd qvga");
+	ret = gpio_request_one(LCD_PANEL_QVGA_GPIO, GPIOF_OUT_INIT_HIGH,
+			       "lcd qvga");
 	if (ret) {
 		pr_err("Failed to get LCD_PANEL_QVGA_GPIO (gpio%d).\n",
 			LCD_PANEL_QVGA_GPIO);
 		goto err0;
 	}
-	gpio_direction_output(LCD_PANEL_QVGA_GPIO, 1);
 
 	return;
 err0:
diff -u -p a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c 2011-03-21 08:55:26.000000000 +0100
@@ -276,13 +276,13 @@ static int zoom_twl_gpio_setup(struct de
 	zoom_vsim_supply.dev = mmc[0].dev;
 	zoom_vmmc2_supply.dev = mmc[1].dev;
 
-	ret = gpio_request(LCD_PANEL_ENABLE_GPIO, "lcd enable");
+	ret = gpio_request_one(LCD_PANEL_ENABLE_GPIO, GPIOF_OUT_INIT_LOW,
+			       "lcd enable");
 	if (ret) {
 		pr_err("Failed to get LCD_PANEL_ENABLE_GPIO (gpio%d).\n",
 				LCD_PANEL_ENABLE_GPIO);
 		return ret;
 	}
-	gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 0);
 
 	return ret;
 }
diff -u -p a/arch/arm/mach-omap2/gpmc-smc91x.c b/arch/arm/mach-omap2/gpmc-smc91x.c
--- a/arch/arm/mach-omap2/gpmc-smc91x.c 2009-12-12 00:23:19.000000000 +0100
+++ b/arch/arm/mach-omap2/gpmc-smc91x.c 2011-03-21 08:55:23.000000000 +0100
@@ -147,25 +147,24 @@ void __init gpmc_smc91x_init(struct omap
 			goto free1;
 	}
 
-	if (gpio_request(gpmc_cfg->gpio_irq, "SMC91X irq") < 0)
+	if (gpio_request_one(gpmc_cfg->gpio_irq, GPIOF_IN, "SMC91X irq") < 0)
 		goto free1;
 
-	gpio_direction_input(gpmc_cfg->gpio_irq);
 	gpmc_smc91x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq);
 
 	if (gpmc_cfg->gpio_pwrdwn) {
-		ret = gpio_request(gpmc_cfg->gpio_pwrdwn, "SMC91X powerdown");
+		ret = gpio_request_one(gpmc_cfg->gpio_pwrdwn,
+				       GPIOF_OUT_INIT_LOW, "SMC91X powerdown");
 		if (ret)
 			goto free2;
-		gpio_direction_output(gpmc_cfg->gpio_pwrdwn, 0);
 	}
 
 	if (gpmc_cfg->gpio_reset) {
-		ret = gpio_request(gpmc_cfg->gpio_reset, "SMC91X reset");
+		ret = gpio_request_one(gpmc_cfg->gpio_reset,
+				       GPIOF_OUT_INIT_LOW, "SMC91X reset");
 		if (ret)
 			goto free3;
 
-		gpio_direction_output(gpmc_cfg->gpio_reset, 0);
 		gpio_set_value(gpmc_cfg->gpio_reset, 1);
 		msleep(100);
 		gpio_set_value(gpmc_cfg->gpio_reset, 0);
diff -u -p a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c
--- a/arch/arm/mach-omap2/gpmc-smsc911x.c 2010-09-30 17:54:14.000000000 +0200
+++ b/arch/arm/mach-omap2/gpmc-smsc911x.c 2011-03-21 08:55:25.000000000 +0100
@@ -71,26 +71,25 @@ void __init gpmc_smsc911x_init(struct om
 	gpmc_smsc911x_resources[0].start = cs_mem_base + 0x0;
 	gpmc_smsc911x_resources[0].end = cs_mem_base + 0xff;
 
-	if (gpio_request(gpmc_cfg->gpio_irq, "smsc911x irq") < 0) {
+	if (gpio_request_one(gpmc_cfg->gpio_irq, GPIOF_IN, "smsc911x irq") < 0) {
 		printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
 				gpmc_cfg->gpio_irq);
 		goto free1;
 	}
 
-	gpio_direction_input(gpmc_cfg->gpio_irq);
 	gpmc_smsc911x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq);
 	gpmc_smsc911x_resources[1].flags |=
 					(gpmc_cfg->flags & IRQF_TRIGGER_MASK);
 
 	if (gpio_is_valid(gpmc_cfg->gpio_reset)) {
-		ret = gpio_request(gpmc_cfg->gpio_reset, "smsc911x reset");
+		ret = gpio_request_one(gpmc_cfg->gpio_reset,
+				       GPIOF_OUT_INIT_HIGH, "smsc911x reset");
 		if (ret) {
 			printk(KERN_ERR "Failed to request GPIO%d for smsc911x reset\n",
 					gpmc_cfg->gpio_reset);
 			goto free2;
 		}
 
-		gpio_direction_output(gpmc_cfg->gpio_reset, 1);
 		gpio_set_value(gpmc_cfg->gpio_reset, 0);
 		msleep(100);
 		gpio_set_value(gpmc_cfg->gpio_reset, 1);
diff -u -p a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c
--- a/arch/arm/mach-omap2/usb-tusb6010.c 2010-12-28 18:26:02.000000000 +0100
+++ b/arch/arm/mach-omap2/usb-tusb6010.c 2011-03-21 08:55:25.000000000 +0100
@@ -293,12 +293,11 @@ tusb6010_setup_interface(struct musb_hdr
 			);
 
 	/* IRQ */
-	status = gpio_request(irq, "TUSB6010 irq");
+	status = gpio_request_one(irq, GPIOF_IN, "TUSB6010 irq");
 	if (status < 0) {
 		printk(error, 3, status);
 		return status;
 	}
-	gpio_direction_input(irq);
 	tusb_resources[2].start = irq + IH_GPIO_BASE;
 
 	/* set up memory timings ... can speed them up later */
diff -u -p a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
--- a/arch/arm/mach-orion5x/dns323-setup.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-orion5x/dns323-setup.c 2011-03-21 08:55:23.000000000 +0100
@@ -642,8 +642,8 @@ static void __init dns323_init(void)
 		 * DNS323_GPIO_LED_POWER1 to also be low.
 		 */
 		 dns323ab_leds[0].active_low = 1;
-		 gpio_request(DNS323_GPIO_LED_POWER1, "Power Led Enable");
-		 gpio_direction_output(DNS323_GPIO_LED_POWER1, 0);
+		 gpio_request_one(DNS323_GPIO_LED_POWER1, GPIOF_OUT_INIT_LOW,
+				  "Power Led Enable");
 		/* Fall through */
 	case DNS323_REV_B1:
 		i2c_register_board_info(0, dns323ab_i2c_devices,
diff -u -p a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
--- a/arch/arm/mach-pxa/cm-x270.c 2010-12-31 15:18:30.000000000 +0100
+++ b/arch/arm/mach-pxa/cm-x270.c 2011-03-21 08:55:24.000000000 +0100
@@ -208,10 +208,9 @@ static int cmx270_marathon_probe(struct 
 	int gpio, err;
 
 	for (gpio = 58; gpio <= 77; gpio++) {
-		err = gpio_request(gpio, "LCD");
+		err = gpio_request_one(gpio, GPIOF_IN, "LCD");
 		if (err)
 			return err;
-		gpio_direction_input(gpio);
 	}
 
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_marathon_on));
diff -u -p a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
--- a/arch/arm/mach-pxa/cm-x300.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/cm-x300.c 2011-03-21 08:55:22.000000000 +0100
@@ -484,14 +484,14 @@ static int cm_x300_ulpi_phy_reset(void)
 	int err;
 
 	/* reset the PHY */
-	err = gpio_request(GPIO_ULPI_PHY_RST, "ulpi reset");
+	err = gpio_request_one(GPIO_ULPI_PHY_RST, GPIOF_OUT_INIT_LOW,
+			       "ulpi reset");
 	if (err) {
 		pr_err("%s: failed to request ULPI reset GPIO: %d\n",
 		       __func__, err);
 		return err;
 	}
 
-	gpio_direction_output(GPIO_ULPI_PHY_RST, 0);
 	msleep(10);
 	gpio_set_value(GPIO_ULPI_PHY_RST, 1);
 	msleep(10);
diff -u -p a/arch/arm/mach-pxa/colibri-pxa3xx.c b/arch/arm/mach-pxa/colibri-pxa3xx.c
--- a/arch/arm/mach-pxa/colibri-pxa3xx.c 2010-12-28 18:26:02.000000000 +0100
+++ b/arch/arm/mach-pxa/colibri-pxa3xx.c 2011-03-21 08:55:22.000000000 +0100
@@ -103,8 +103,7 @@ static struct pxafb_mach_info sharp_lq43
 void __init colibri_pxa3xx_init_lcd(int bl_pin)
 {
 	lcd_bl_pin = bl_pin;
-	gpio_request(bl_pin, "lcd backlight");
-	gpio_direction_output(bl_pin, 0);
+	gpio_request_one(bl_pin, GPIOF_OUT_INIT_LOW, "lcd backlight");
 	set_pxa_fb_info(&sharp_lq43_info);
 }
 #endif
diff -u -p a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
--- a/arch/arm/mach-pxa/em-x270.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/em-x270.c 2011-03-21 08:55:25.000000000 +0100
@@ -379,23 +379,19 @@ static void __init em_x270_init_nand(voi
 {
 	int err;
 
-	err = gpio_request(GPIO11_NAND_CS, "NAND CS");
+	err = gpio_request_one(GPIO11_NAND_CS, GPIOF_OUT_INIT_HIGH, "NAND CS");
 	if (err) {
 		pr_warning("EM-X270: failed to request NAND CS gpio\n");
 		return;
 	}
 
-	gpio_direction_output(GPIO11_NAND_CS, 1);
-
-	err = gpio_request(nand_rb, "NAND R/B");
+	err = gpio_request_one(nand_rb, GPIOF_IN, "NAND R/B");
 	if (err) {
 		pr_warning("EM-X270: failed to request NAND R/B gpio\n");
 		gpio_free(GPIO11_NAND_CS);
 		return;
 	}
 
-	gpio_direction_input(nand_rb);
-
 	platform_device_register(&em_x270_nand);
 }
 #else
@@ -473,12 +469,11 @@ static int em_x270_usb_hub_init(void)
 	if (err)
 		goto err_free_usb_ldo;
 
-	err = gpio_request(usb_hub_reset, "hub rst");
+	err = gpio_request_one(usb_hub_reset, GPIOF_OUT_INIT_HIGH, "hub rst");
 	if (err)
 		goto err_free_vbus_gpio;
 
 	/* USB Hub power-on and reset */
-	gpio_direction_output(usb_hub_reset, 1);
 	gpio_direction_output(GPIO9_USB_VBUS_EN, 0);
 	regulator_enable(em_x270_usb_ldo);
 	gpio_set_value(usb_hub_reset, 0);
@@ -568,21 +563,20 @@ static int em_x270_mci_init(struct devic
 	}
 
 	if (machine_is_em_x270()) {
-		err = gpio_request(GPIO95_MMC_WP, "MMC WP");
+		err = gpio_request_one(GPIO95_MMC_WP, GPIOF_IN, "MMC WP");
 		if (err) {
 			dev_err(dev, "can't request MMC write protect: %d\n",
 				err);
 			goto err_gpio_wp;
 		}
-		gpio_direction_input(GPIO95_MMC_WP);
 	} else {
-		err = gpio_request(GPIO38_SD_PWEN, "sdio power");
+		err = gpio_request_one(GPIO38_SD_PWEN, GPIOF_OUT_INIT_HIGH,
+				       "sdio power");
 		if (err) {
 			dev_err(dev, "can't request MMC power control : %d\n",
 				err);
 			goto err_gpio_wp;
 		}
-		gpio_direction_output(GPIO38_SD_PWEN, 1);
 	}
 
 	return 0;
@@ -741,11 +735,11 @@ static int em_x270_libertas_setup(struct
 		goto err_free_pwen;
 
 	if (machine_is_exeda()) {
-		err = gpio_request(GPIO37_WLAN_RST, "WLAN RST");
+		err = gpio_request_one(GPIO37_WLAN_RST, GPIOF_OUT_INIT_HIGH,
+				       "WLAN RST");
 		if (err)
 			goto err_free_strap;
 
-		gpio_direction_output(GPIO37_WLAN_RST, 1);
 		msleep(100);
 	}
 
@@ -951,12 +945,10 @@ static int em_x270_sensor_init(void)
 {
 	int ret;
 
-	ret = gpio_request(cam_reset, "camera reset");
+	ret = gpio_request_one(cam_reset, GPIOF_OUT_INIT_LOW, "camera reset");
 	if (ret)
 		return ret;
 
-	gpio_direction_output(cam_reset, 0);
-
 	em_x270_camera_ldo = regulator_get(NULL, "vcc cam");
 	if (em_x270_camera_ldo == NULL) {
 		gpio_free(cam_reset);
diff -u -p a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
--- a/arch/arm/mach-pxa/magician.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/magician.c 2011-03-21 08:55:23.000000000 +0100
@@ -748,8 +748,8 @@ static void __init magician_init(void)
 		lcd_select = board_id & 0x8;
 		pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly");
 		if (lcd_select && (system_rev < 3)) {
-			gpio_request(GPIO75_MAGICIAN_SAMSUNG_POWER, "SAMSUNG_POWER");
-			gpio_direction_output(GPIO75_MAGICIAN_SAMSUNG_POWER, 0);
+			gpio_request_one(GPIO75_MAGICIAN_SAMSUNG_POWER,
+					 GPIOF_OUT_INIT_LOW, "SAMSUNG_POWER");
 		}
 		gpio_request(GPIO104_MAGICIAN_LCD_POWER_1, "LCD_POWER_1");
 		gpio_request(GPIO105_MAGICIAN_LCD_POWER_2, "LCD_POWER_2");
diff -u -p a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c
--- a/arch/arm/mach-pxa/saar.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/saar.c 2011-03-21 08:55:22.000000000 +0100
@@ -413,13 +413,13 @@ static void ltm022a97a_lcd_power(int on,
 	int err;
 
 	if (!pin_requested) {
-		err = gpio_request(GPIO_LCD_RESET, "lcd reset");
+		err = gpio_request_one(GPIO_LCD_RESET, GPIOF_OUT_INIT_LOW,
+				       "lcd reset");
 		if (err) {
 			pr_err("failed to request gpio for LCD reset\n");
 			return;
 		}
 
-		gpio_direction_output(GPIO_LCD_RESET, 0);
 		pin_requested = 1;
 	}
 
diff -u -p a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
--- a/arch/arm/mach-pxa/sharpsl_pm.c 2010-12-28 18:26:03.000000000 +0100
+++ b/arch/arm/mach-pxa/sharpsl_pm.c 2011-03-21 08:55:21.000000000 +0100
@@ -899,12 +899,13 @@ static int __devinit sharpsl_pm_probe(st
 
 	sharpsl_pm.machinfo->init();
 
-	gpio_request(sharpsl_pm.machinfo->gpio_acin, "AC IN");
-	gpio_direction_input(sharpsl_pm.machinfo->gpio_acin);
-	gpio_request(sharpsl_pm.machinfo->gpio_batfull, "Battery Full");
-	gpio_direction_input(sharpsl_pm.machinfo->gpio_batfull);
-	gpio_request(sharpsl_pm.machinfo->gpio_batlock, "Battery Lock");
-	gpio_direction_input(sharpsl_pm.machinfo->gpio_batlock);
+	gpio_request_one(sharpsl_pm.machinfo->gpio_acin, GPIOF_IN, "AC IN");
+	
+	gpio_request_one(sharpsl_pm.machinfo->gpio_batfull, GPIOF_IN,
+			 "Battery Full");
+	
+	gpio_request_one(sharpsl_pm.machinfo->gpio_batlock, GPIOF_IN,
+			 "Battery Lock");
 
 	/* Register interrupt handlers */
 	if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "AC Input Detect", sharpsl_ac_isr)) {
diff -u -p a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c
--- a/arch/arm/mach-pxa/stargate2.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/stargate2.c 2011-03-21 08:55:24.000000000 +0100
@@ -693,19 +693,18 @@ static int stargate2_mci_init(struct dev
 {
 	int err;
 
-	err = gpio_request(SG2_SD_POWER_ENABLE, "SG2_sd_power_enable");
+	err = gpio_request_one(SG2_SD_POWER_ENABLE, GPIOF_OUT_INIT_LOW,
+			       "SG2_sd_power_enable");
 	if (err) {
 		printk(KERN_ERR "Can't get the gpio for SD power control");
 		goto return_err;
 	}
-	gpio_direction_output(SG2_SD_POWER_ENABLE, 0);
 
-	err = gpio_request(SG2_GPIO_nSD_DETECT, "SG2_sd_detect");
+	err = gpio_request_one(SG2_GPIO_nSD_DETECT, GPIOF_IN, "SG2_sd_detect");
 	if (err) {
 		printk(KERN_ERR "Can't get the sd detect gpio");
 		goto free_power_en;
 	}
-	gpio_direction_input(SG2_GPIO_nSD_DETECT);
 
 	err = request_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT),
 			  stargate2_detect_int,
@@ -799,12 +798,12 @@ static struct at24_platform_data pca9500
 static int stargate2_reset_bluetooth(void)
 {
 	int err;
-	err = gpio_request(SG2_BT_RESET, "SG2_BT_RESET");
+	err = gpio_request_one(SG2_BT_RESET, GPIOF_OUT_INIT_HIGH,
+			       "SG2_BT_RESET");
 	if (err) {
 		printk(KERN_ERR "Could not get gpio for bluetooth reset\n");
 		return err;
 	}
-	gpio_direction_output(SG2_BT_RESET, 1);
 	mdelay(5);
 	/* now reset it - 5 msec minimum */
 	gpio_set_value(SG2_BT_RESET, 0);
diff -u -p a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c
--- a/arch/arm/mach-pxa/zylonite_pxa300.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-pxa/zylonite_pxa300.c 2011-03-21 08:55:22.000000000 +0100
@@ -197,8 +197,7 @@ static void __init zylonite_detect_lcd_p
 	for (i = 0; i < NUM_LCD_DETECT_PINS; i++) {
 		id = id << 1;
 		gpio = mfp_to_gpio(lcd_detect_pins[i]);
-		gpio_request(gpio, "LCD_ID_PINS");
-		gpio_direction_input(gpio);
+		gpio_request_one(gpio, GPIOF_IN, "LCD_ID_PINS");
 
 		if (gpio_get_value(gpio))
 			id = id | 0x1;
diff -u -p a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c
--- a/arch/arm/mach-pxa/zylonite_pxa320.c 2010-01-12 18:05:01.000000000 +0100
+++ b/arch/arm/mach-pxa/zylonite_pxa320.c 2011-03-21 08:55:21.000000000 +0100
@@ -176,8 +176,7 @@ static void __init zylonite_detect_lcd_p
 	for (i = 0; i < NUM_LCD_DETECT_PINS; i++) {
 		id = id << 1;
 		gpio = mfp_to_gpio(lcd_detect_pins[i]);
-		gpio_request(gpio, "LCD_ID_PINS");
-		gpio_direction_input(gpio);
+		gpio_request_one(gpio, GPIOF_IN, "LCD_ID_PINS");
 
 		if (gpio_get_value(gpio))
 			id = id | 0x1;
diff -u -p a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
--- a/arch/arm/mach-s3c2410/mach-h1940.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-s3c2410/mach-h1940.c 2011-03-21 08:55:24.000000000 +0100
@@ -305,10 +305,10 @@ int h1940_bat_init(void)
 {
 	int ret;
 
-	ret = gpio_request(H1940_LATCH_SM803_ENABLE, "h1940-charger-enable");
+	ret = gpio_request_one(H1940_LATCH_SM803_ENABLE, GPIOF_OUT_INIT_LOW,
+			       "h1940-charger-enable");
 	if (ret)
 		return ret;
-	gpio_direction_output(H1940_LATCH_SM803_ENABLE, 0);
 
 	return 0;
 
@@ -473,9 +473,8 @@ static struct s3c24xx_mci_pdata h1940_mm
 
 static int h1940_backlight_init(struct device *dev)
 {
-	gpio_request(S3C2410_GPB(0), "Backlight");
+	gpio_request_one(S3C2410_GPB(0), GPIOF_OUT_INIT_LOW, "Backlight");
 
-	gpio_direction_output(S3C2410_GPB(0), 0);
 	s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
 	s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
 	gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
@@ -723,8 +722,7 @@ static void __init h1940_init(void)
 	gpio_direction_output(H1940_LATCH_LCD_P4, 0);
 	gpio_direction_output(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
 
-	gpio_request(H1940_LATCH_SD_POWER, "SD power");
-	gpio_direction_output(H1940_LATCH_SD_POWER, 0);
+	gpio_request_one(H1940_LATCH_SD_POWER, GPIOF_OUT_INIT_LOW, "SD power");
 
 	platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
 
diff -u -p a/arch/arm/mach-s3c2410/mach-qt2410.c b/arch/arm/mach-s3c2410/mach-qt2410.c
--- a/arch/arm/mach-s3c2410/mach-qt2410.c 2010-10-23 19:40:31.000000000 +0200
+++ b/arch/arm/mach-s3c2410/mach-qt2410.c 2011-03-21 08:55:23.000000000 +0100
@@ -354,8 +354,8 @@ static void __init qt2410_machine_init(v
 	s3c24xx_udc_set_platdata(&qt2410_udc_cfg);
 	s3c_i2c0_set_platdata(NULL);
 
-	WARN_ON(gpio_request(S3C2410_GPB(5), "spi cs"));
-	gpio_direction_output(S3C2410_GPB(5), 1);
+	WARN_ON(gpio_request_one(S3C2410_GPB(5), GPIOF_OUT_INIT_HIGH,
+				 "spi cs"));
 
 	platform_add_devices(qt2410_devices, ARRAY_SIZE(qt2410_devices));
 	s3c_pm_init();
diff -u -p a/arch/arm/mach-s3c2412/mach-jive.c b/arch/arm/mach-s3c2412/mach-jive.c
--- a/arch/arm/mach-s3c2412/mach-jive.c 2010-10-23 19:40:31.000000000 +0200
+++ b/arch/arm/mach-s3c2412/mach-jive.c 2011-03-21 08:55:23.000000000 +0100
@@ -636,11 +636,9 @@ static void __init jive_machine_init(voi
 
 	/* initialise the spi */
 
-	gpio_request(S3C2410_GPG(13), "lcm reset");
-	gpio_direction_output(S3C2410_GPG(13), 0);
+	gpio_request_one(S3C2410_GPG(13), GPIOF_OUT_INIT_LOW, "lcm reset");
 
-	gpio_request(S3C2410_GPB(7), "jive spi");
-	gpio_direction_output(S3C2410_GPB(7), 1);
+	gpio_request_one(S3C2410_GPB(7), GPIOF_OUT_INIT_HIGH, "jive spi");
 
 	s3c2410_gpio_setpin(S3C2410_GPB(6), 0);
 	s3c_gpio_cfgpin(S3C2410_GPB(6), S3C2410_GPIO_OUTPUT);
@@ -650,8 +648,8 @@ static void __init jive_machine_init(voi
 
 	/* initialise the WM8750 spi */
 
-	gpio_request(S3C2410_GPH(10), "jive wm8750 spi");
-	gpio_direction_output(S3C2410_GPH(10), 1);
+	gpio_request_one(S3C2410_GPH(10), GPIOF_OUT_INIT_HIGH,
+			 "jive wm8750 spi");
 
 	/* Turn off suspend on both USB ports, and switch the
 	 * selectable USB port to USB device mode. */
diff -u -p a/arch/arm/mach-s3c2416/mach-smdk2416.c b/arch/arm/mach-s3c2416/mach-smdk2416.c
--- a/arch/arm/mach-s3c2416/mach-smdk2416.c 2011-01-09 09:32:57.000000000 +0100
+++ b/arch/arm/mach-s3c2416/mach-smdk2416.c 2011-03-21 08:55:25.000000000 +0100
@@ -203,14 +203,11 @@ static void __init smdk2416_machine_init
 	s3c_sdhci0_set_platdata(&smdk2416_hsmmc0_pdata);
 	s3c_sdhci1_set_platdata(&smdk2416_hsmmc1_pdata);
 
-	gpio_request(S3C2410_GPB(4), "USBHost Power");
-	gpio_direction_output(S3C2410_GPB(4), 1);
+	gpio_request_one(S3C2410_GPB(4), GPIOF_OUT_INIT_HIGH, "USBHost Power");
 
-	gpio_request(S3C2410_GPB(3), "Display Power");
-	gpio_direction_output(S3C2410_GPB(3), 1);
+	gpio_request_one(S3C2410_GPB(3), GPIOF_OUT_INIT_HIGH, "Display Power");
 
-	gpio_request(S3C2410_GPB(1), "Display Reset");
-	gpio_direction_output(S3C2410_GPB(1), 1);
+	gpio_request_one(S3C2410_GPB(1), GPIOF_OUT_INIT_HIGH, "Display Reset");
 
 	platform_add_devices(smdk2416_devices, ARRAY_SIZE(smdk2416_devices));
 	smdk_machine_init();
diff -u -p a/arch/arm/mach-s3c2440/mach-mini2440.c b/arch/arm/mach-s3c2440/mach-mini2440.c
--- a/arch/arm/mach-s3c2440/mach-mini2440.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-s3c2440/mach-mini2440.c 2011-03-21 08:55:21.000000000 +0100
@@ -618,8 +618,8 @@ static void __init mini2440_init(void)
 	s3c_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND);
 
 	/* Turn the backlight early on */
-	WARN_ON(gpio_request(S3C2410_GPG(4), "backlight"));
-	gpio_direction_output(S3C2410_GPG(4), 1);
+	WARN_ON(gpio_request_one(S3C2410_GPG(4), GPIOF_OUT_INIT_HIGH,
+				 "backlight"));
 
 	/* remove pullup on optional PWM backlight -- unused on 3.5 and 7"s */
 	s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_UP);
diff -u -p a/arch/arm/mach-s3c2440/mach-osiris-dvs.c b/arch/arm/mach-s3c2440/mach-osiris-dvs.c
--- a/arch/arm/mach-s3c2440/mach-osiris-dvs.c 2009-12-08 20:58:27.000000000 +0100
+++ b/arch/arm/mach-s3c2440/mach-osiris-dvs.c 2011-03-21 08:55:22.000000000 +0100
@@ -99,15 +99,13 @@ static int __devinit osiris_dvs_probe(st
 
 	dev_info(&pdev->dev, "initialising\n");
 
-	ret = gpio_request(OSIRIS_GPIO_DVS, "osiris-dvs");
+	ret = gpio_request_one(OSIRIS_GPIO_DVS, GPIOF_OUT_INIT_HIGH,
+			       "osiris-dvs");
 	if (ret) {
 		dev_err(&pdev->dev, "cannot claim gpio\n");
 		goto err_nogpio;
 	}
 
-	/* start with dvs disabled */
-	gpio_direction_output(OSIRIS_GPIO_DVS, 1);
-
 	ret = cpufreq_register_notifier(&osiris_dvs_nb,
 					CPUFREQ_TRANSITION_NOTIFIER);
 	if (ret) {
diff -u -p a/arch/arm/mach-s3c2440/mach-rx1950.c b/arch/arm/mach-s3c2440/mach-rx1950.c
--- a/arch/arm/mach-s3c2440/mach-rx1950.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c 2011-03-21 08:55:21.000000000 +0100
@@ -785,8 +785,8 @@ static void __init rx1950_init_machine(v
 						S3C2410_MISCCR_USBSUSPND1, 0x0);
 
 	/* mmc power is disabled by default */
-	WARN_ON(gpio_request(S3C2410_GPJ(1), "MMC power"));
-	gpio_direction_output(S3C2410_GPJ(1), 0);
+	WARN_ON(gpio_request_one(S3C2410_GPJ(1), GPIOF_OUT_INIT_LOW,
+				 "MMC power"));
 
 	for (i = 0; i < 8; i++)
 		WARN_ON(gpio_request(S3C2410_GPC(i), "LCD power"));
diff -u -p a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
--- a/arch/arm/mach-s3c64xx/mach-hmt.c 2010-10-23 19:40:31.000000000 +0200
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c 2011-03-21 08:55:22.000000000 +0100
@@ -251,14 +251,12 @@ static void __init hmt_machine_init(void
 	s3c_fb_set_platdata(&hmt_lcd_pdata);
 	s3c_nand_set_platdata(&hmt_nand_info);
 
-	gpio_request(S3C64XX_GPC(7), "usb power");
-	gpio_direction_output(S3C64XX_GPC(7), 0);
-	gpio_request(S3C64XX_GPM(0), "usb power");
-	gpio_direction_output(S3C64XX_GPM(0), 1);
-	gpio_request(S3C64XX_GPK(7), "usb power");
-	gpio_direction_output(S3C64XX_GPK(7), 1);
-	gpio_request(S3C64XX_GPF(13), "usb power");
-	gpio_direction_output(S3C64XX_GPF(13), 1);
+	gpio_request_one(S3C64XX_GPC(7), GPIOF_OUT_INIT_LOW, "usb power");
+	gpio_request_one(S3C64XX_GPM(0), GPIOF_OUT_INIT_HIGH, "usb power");
+	
+	gpio_request_one(S3C64XX_GPK(7), GPIOF_OUT_INIT_HIGH, "usb power");
+	
+	gpio_request_one(S3C64XX_GPF(13), GPIOF_OUT_INIT_HIGH, "usb power");
 
 	platform_add_devices(hmt_devices, ARRAY_SIZE(hmt_devices));
 }
diff -u -p a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
--- a/arch/arm/mach-s3c64xx/mach-smartq.c 2010-09-04 09:22:04.000000000 +0200
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c 2011-03-21 08:55:22.000000000 +0100
@@ -189,13 +189,11 @@ static int __init smartq_lcd_setup_gpio(
 {
 	int ret;
 
-	ret = gpio_request(S3C64XX_GPM(3), "LCD power");
+	ret = gpio_request_one(S3C64XX_GPM(3), GPIOF_OUT_INIT_LOW,
+			       "LCD power");
 	if (ret < 0)
 		return ret;
 
-	/* turn power off */
-	gpio_direction_output(S3C64XX_GPM(3), 0);
-
 	return 0;
 }
 
@@ -276,15 +274,13 @@ static int __init smartq_power_off_init(
 {
 	int ret;
 
-	ret = gpio_request(S3C64XX_GPK(15), "Power control");
+	ret = gpio_request_one(S3C64XX_GPK(15), GPIOF_OUT_INIT_LOW,
+			       "Power control");
 	if (ret < 0) {
 		pr_err("%s: failed to get GPK15\n", __func__);
 		return ret;
 	}
 
-	/* leave power on */
-	gpio_direction_output(S3C64XX_GPK(15), 0);
-
 	pm_power_off = smartq_power_off;
 
 	return ret;
diff -u -p a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
--- a/arch/arm/mach-s5pv210/mach-aquila.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-s5pv210/mach-aquila.c 2011-03-21 08:55:25.000000000 +0100
@@ -595,8 +595,7 @@ static struct s3c_sdhci_platdata aquila_
 
 static void aquila_setup_sdhci(void)
 {
-	gpio_request(AQUILA_EXT_FLASH_EN, "FLASH_EN");
-	gpio_direction_output(AQUILA_EXT_FLASH_EN, 1);
+	gpio_request_one(AQUILA_EXT_FLASH_EN, GPIOF_OUT_INIT_HIGH, "FLASH_EN");
 
 	s3c_sdhci0_set_platdata(&aquila_hsmmc0_data);
 	s3c_sdhci1_set_platdata(&aquila_hsmmc1_data);
diff -u -p a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c 2011-03-21 08:55:25.000000000 +0100
@@ -153,15 +153,12 @@ static void smdkv210_lte480wv_set_power(
 {
 	if (power) {
 #if !defined(CONFIG_BACKLIGHT_PWM)
-		gpio_request(S5PV210_GPD0(3), "GPD0");
-		gpio_direction_output(S5PV210_GPD0(3), 1);
+		gpio_request_one(S5PV210_GPD0(3), GPIOF_OUT_INIT_HIGH, "GPD0");
 		gpio_free(S5PV210_GPD0(3));
 #endif
 
 		/* fire nRESET on power up */
-		gpio_request(S5PV210_GPH0(6), "GPH0");
-
-		gpio_direction_output(S5PV210_GPH0(6), 1);
+		gpio_request_one(S5PV210_GPH0(6), GPIOF_OUT_INIT_HIGH, "GPH0");
 
 		gpio_set_value(S5PV210_GPH0(6), 0);
 		mdelay(10);
@@ -172,8 +169,7 @@ static void smdkv210_lte480wv_set_power(
 		gpio_free(S5PV210_GPH0(6));
 	} else {
 #if !defined(CONFIG_BACKLIGHT_PWM)
-		gpio_request(S5PV210_GPD0(3), "GPD0");
-		gpio_direction_output(S5PV210_GPD0(3), 0);
+		gpio_request_one(S5PV210_GPD0(3), GPIOF_OUT_INIT_LOW, "GPD0");
 		gpio_free(S5PV210_GPD0(3));
 #endif
 	}
diff -u -p a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
--- a/arch/arm/mach-shmobile/board-ag5evm.c 2011-02-02 17:27:36.000000000 +0100
+++ b/arch/arm/mach-shmobile/board-ag5evm.c 2011-03-21 08:55:25.000000000 +0100
@@ -418,14 +418,11 @@ static void __init ag5evm_init(void)
 	gpio_request(GPIO_FN_MMCD0_5, NULL);
 	gpio_request(GPIO_FN_MMCD0_6, NULL);
 	gpio_request(GPIO_FN_MMCD0_7, NULL);
-	gpio_request(GPIO_PORT208, NULL); /* Reset */
-	gpio_direction_output(GPIO_PORT208, 1);
+	gpio_request_one(GPIO_PORT208, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* enable SMSC911X */
-	gpio_request(GPIO_PORT144, NULL); /* PINTA2 */
-	gpio_direction_input(GPIO_PORT144);
-	gpio_request(GPIO_PORT145, NULL); /* RESET */
-	gpio_direction_output(GPIO_PORT145, 1);
+	gpio_request_one(GPIO_PORT144, GPIOF_IN, NULL); /* PINTA2 */
+	gpio_request_one(GPIO_PORT145, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* FSI A */
 	gpio_request(GPIO_FN_FSIACK, NULL);
@@ -440,15 +437,13 @@ static void __init ag5evm_init(void)
 	gpio_request(GPIO_FN_PORT243_IRDA_FIRSEL, NULL);
 
 	/* LCD panel */
-	gpio_request(GPIO_PORT217, NULL); /* RESET */
-	gpio_direction_output(GPIO_PORT217, 0);
+	gpio_request_one(GPIO_PORT217, GPIOF_OUT_INIT_LOW, NULL); /* RESET */
 	mdelay(1);
 	gpio_set_value(GPIO_PORT217, 1);
 	mdelay(100);
 
 	/* LCD backlight controller */
-	gpio_request(GPIO_PORT235, NULL); /* RESET */
-	gpio_direction_output(GPIO_PORT235, 0);
+	gpio_request_one(GPIO_PORT235, GPIOF_OUT_INIT_LOW, NULL); /* RESET */
 	lcd_backlight_reset();
 
 	/* MIPI-DSI clock setup */
diff -u -p a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
--- a/arch/arm/mach-shmobile/board-ap4evb.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-shmobile/board-ap4evb.c 2011-03-21 08:55:26.000000000 +0100
@@ -1054,9 +1054,7 @@ static int ts_get_pendown_state(void)
 
 	gpio_free(GPIO_TSC_IRQ);
 
-	gpio_request(GPIO_TSC_PORT, NULL);
-
-	gpio_direction_input(GPIO_TSC_PORT);
+	gpio_request_one(GPIO_TSC_PORT, GPIOF_IN, NULL);
 
 	val = gpio_get_value(GPIO_TSC_PORT);
 
@@ -1198,8 +1196,7 @@ static void __init ap4evb_init(void)
 	gpio_request(GPIO_FN_FSIAILR,	NULL);
 	gpio_request(GPIO_FN_FSIAISLD,	NULL);
 	gpio_request(GPIO_FN_FSIAOSLD,	NULL);
-	gpio_request(GPIO_PORT161,	NULL);
-	gpio_direction_output(GPIO_PORT161, 0); /* slave */
+	gpio_request_one(GPIO_PORT161, GPIOF_OUT_INIT_LOW, NULL);/* slave */
 
 	gpio_request(GPIO_PORT9, NULL);
 	gpio_request(GPIO_PORT10, NULL);
@@ -1207,8 +1204,7 @@ static void __init ap4evb_init(void)
 	gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */
 
 	/* card detect pin for MMC slot (CN7) */
-	gpio_request(GPIO_PORT41, NULL);
-	gpio_direction_input(GPIO_PORT41);
+	gpio_request_one(GPIO_PORT41, GPIOF_IN, NULL);
 
 	/* setup FSI2 port B (HDMI) */
 	gpio_request(GPIO_FN_FSIBCK, NULL);
@@ -1296,11 +1292,9 @@ static void __init ap4evb_init(void)
 	gpio_request(GPIO_FN_LCDDISP,  NULL);
 	gpio_request(GPIO_FN_LCDDCK,   NULL);
 
-	gpio_request(GPIO_PORT189, NULL); /* backlight */
-	gpio_direction_output(GPIO_PORT189, 1);
+	gpio_request_one(GPIO_PORT189, GPIOF_OUT_INIT_HIGH, NULL);
 
-	gpio_request(GPIO_PORT151, NULL); /* LCDDON */
-	gpio_direction_output(GPIO_PORT151, 1);
+	gpio_request_one(GPIO_PORT151, GPIOF_OUT_INIT_HIGH, NULL);
 
 	lcdc_info.clock_source			= LCDC_CLK_BUS;
 	lcdc_info.ch[0].interface_type		= RGB18;
diff -u -p a/arch/arm/mach-shmobile/board-g3evm.c b/arch/arm/mach-shmobile/board-g3evm.c
--- a/arch/arm/mach-shmobile/board-g3evm.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/arm/mach-shmobile/board-g3evm.c 2011-03-21 08:55:26.000000000 +0100
@@ -271,18 +271,15 @@ static void __init g3evm_init(void)
 	sh7367_pinmux_init();
 
 	/* Lit DS4 LED */
-	gpio_request(GPIO_PORT22, NULL);
-	gpio_direction_output(GPIO_PORT22, 1);
+	gpio_request_one(GPIO_PORT22, GPIOF_OUT_INIT_HIGH, NULL);
 	gpio_export(GPIO_PORT22, 0);
 
 	/* Lit DS8 LED */
-	gpio_request(GPIO_PORT23, NULL);
-	gpio_direction_output(GPIO_PORT23, 1);
+	gpio_request_one(GPIO_PORT23, GPIOF_OUT_INIT_HIGH, NULL);
 	gpio_export(GPIO_PORT23, 0);
 
 	/* Lit DS3 LED */
-	gpio_request(GPIO_PORT24, NULL);
-	gpio_direction_output(GPIO_PORT24, 1);
+	gpio_request_one(GPIO_PORT24, GPIOF_OUT_INIT_HIGH, NULL);
 	gpio_export(GPIO_PORT24, 0);
 
 	/* SCIFA1 */
diff -u -p a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c
--- a/arch/arm/mach-shmobile/board-g4evm.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/arm/mach-shmobile/board-g4evm.c 2011-03-21 08:55:25.000000000 +0100
@@ -315,23 +315,19 @@ static void __init g4evm_init(void)
 	sh7377_pinmux_init();
 
 	/* Lit DS14 LED */
-	gpio_request(GPIO_PORT109, NULL);
-	gpio_direction_output(GPIO_PORT109, 1);
+	gpio_request_one(GPIO_PORT109, GPIOF_OUT_INIT_HIGH, NULL);
 	gpio_export(GPIO_PORT109, 1);
 
 	/* Lit DS15 LED */
-	gpio_request(GPIO_PORT110, NULL);
-	gpio_direction_output(GPIO_PORT110, 1);
+	gpio_request_one(GPIO_PORT110, GPIOF_OUT_INIT_HIGH, NULL);
 	gpio_export(GPIO_PORT110, 1);
 
 	/* Lit DS16 LED */
-	gpio_request(GPIO_PORT112, NULL);
-	gpio_direction_output(GPIO_PORT112, 1);
+	gpio_request_one(GPIO_PORT112, GPIOF_OUT_INIT_HIGH, NULL);
 	gpio_export(GPIO_PORT112, 1);
 
 	/* Lit DS17 LED */
-	gpio_request(GPIO_PORT113, NULL);
-	gpio_direction_output(GPIO_PORT113, 1);
+	gpio_request_one(GPIO_PORT113, GPIOF_OUT_INIT_HIGH, NULL);
 	gpio_export(GPIO_PORT113, 1);
 
 	/* USBHS */
diff -u -p a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
--- a/arch/arm/mach-shmobile/board-mackerel.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-shmobile/board-mackerel.c 2011-03-21 08:55:27.000000000 +0100
@@ -1058,11 +1058,9 @@ static void __init mackerel_init(void)
 	gpio_request(GPIO_FN_LCDDISP,  NULL);
 	gpio_request(GPIO_FN_LCDDCK,   NULL);
 
-	gpio_request(GPIO_PORT31, NULL); /* backlight */
-	gpio_direction_output(GPIO_PORT31, 1);
+	gpio_request_one(GPIO_PORT31, GPIOF_OUT_INIT_HIGH, NULL);
 
-	gpio_request(GPIO_PORT151, NULL); /* LCDDON */
-	gpio_direction_output(GPIO_PORT151, 1);
+	gpio_request_one(GPIO_PORT151, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* USB enable */
 	gpio_request(GPIO_FN_VBUS0_1,    NULL);
@@ -1080,8 +1078,7 @@ static void __init mackerel_init(void)
 	gpio_request(GPIO_FN_FSIAILR,	NULL);
 	gpio_request(GPIO_FN_FSIAISLD,	NULL);
 	gpio_request(GPIO_FN_FSIAOSLD,	NULL);
-	gpio_request(GPIO_PORT161,	NULL);
-	gpio_direction_output(GPIO_PORT161, 0); /* slave */
+	gpio_request_one(GPIO_PORT161, GPIOF_OUT_INIT_LOW, NULL);/* slave */
 
 	gpio_request(GPIO_PORT9,  NULL);
 	gpio_request(GPIO_PORT10, NULL);
@@ -1133,8 +1130,7 @@ static void __init mackerel_init(void)
 	gpio_request(GPIO_FN_SDHID1_0, NULL);
 #endif
 	/* card detect pin for MMC slot (CN7) */
-	gpio_request(GPIO_PORT41, NULL);
-	gpio_direction_input(GPIO_PORT41);
+	gpio_request_one(GPIO_PORT41, GPIOF_IN, NULL);
 
 	/* enable SDHI2 */
 	gpio_request(GPIO_FN_SDHICMD2, NULL);
@@ -1145,8 +1141,7 @@ static void __init mackerel_init(void)
 	gpio_request(GPIO_FN_SDHID2_0, NULL);
 
 	/* card detect pin for microSD slot (CN23) */
-	gpio_request(GPIO_PORT162, NULL);
-	gpio_direction_input(GPIO_PORT162);
+	gpio_request_one(GPIO_PORT162, GPIOF_IN, NULL);
 
 	/* MMCIF */
 	gpio_request(GPIO_FN_MMCD0_0, NULL);
diff -u -p a/arch/arm/mach-stmp378x/stmp378x_devb.c b/arch/arm/mach-stmp378x/stmp378x_devb.c
--- a/arch/arm/mach-stmp378x/stmp378x_devb.c 2010-10-23 19:40:31.000000000 +0200
+++ b/arch/arm/mach-stmp378x/stmp378x_devb.c 2011-03-21 08:55:24.000000000 +0100
@@ -133,18 +133,15 @@ static int stmp3xxxmmc_hw_init_ssp1(void
 		goto out;
 
 	/* Configure write protect GPIO pin */
-	ret = gpio_request(PINID_PWM4, "mmc wp");
+	ret = gpio_request_one(PINID_PWM4, GPIOF_IN, "mmc wp");
 	if (ret)
 		goto out_wp;
 
-	gpio_direction_input(PINID_PWM4);
-
 	/* Configure POWER pin as gpio to drive power to MMC slot */
-	ret = gpio_request(PINID_PWM3, "mmc power");
+	ret = gpio_request_one(PINID_PWM3, GPIOF_OUT_INIT_LOW, "mmc power");
 	if (ret)
 		goto out_power;
 
-	gpio_direction_output(PINID_PWM3, 0);
 	mdelay(100);
 
 	return 0;
diff -u -p a/arch/arm/mach-tegra/board-harmony-pcie.c b/arch/arm/mach-tegra/board-harmony-pcie.c
--- a/arch/arm/mach-tegra/board-harmony-pcie.c 2011-03-20 18:17:23.000000000 +0100
+++ b/arch/arm/mach-tegra/board-harmony-pcie.c 2011-03-21 08:55:24.000000000 +0100
@@ -38,12 +38,11 @@ static int __init harmony_pcie_init(void
 	if (!machine_is_harmony())
 		return 0;
 
-	err = gpio_request(EN_VDD_1V05_GPIO, "EN_VDD_1V05");
+	err = gpio_request_one(EN_VDD_1V05_GPIO, GPIOF_OUT_INIT_HIGH,
+			       "EN_VDD_1V05");
 	if (err)
 		return err;
 
-	gpio_direction_output(EN_VDD_1V05_GPIO, 1);
-
 	regulator = regulator_get(NULL, "pex_clk");
 	if (IS_ERR_OR_NULL(regulator))
 		goto err_reg;
diff -u -p a/arch/arm/mach-tegra/board-seaboard.c b/arch/arm/mach-tegra/board-seaboard.c
--- a/arch/arm/mach-tegra/board-seaboard.c 2011-03-20 18:17:23.000000000 +0100
+++ b/arch/arm/mach-tegra/board-seaboard.c 2011-03-21 08:55:24.000000000 +0100
@@ -154,8 +154,7 @@ static struct i2c_board_info __initdata 
 
 static void __init seaboard_i2c_init(void)
 {
-	gpio_request(TEGRA_GPIO_ISL29018_IRQ, "isl29018");
-	gpio_direction_input(TEGRA_GPIO_ISL29018_IRQ);
+	gpio_request_one(TEGRA_GPIO_ISL29018_IRQ, GPIOF_IN, "isl29018");
 
 	i2c_register_board_info(0, &isl29018_device, 1);
 
diff -u -p a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c
--- a/arch/arm/mach-tegra/usb_phy.c 2011-03-14 17:19:13.000000000 +0100
+++ b/arch/arm/mach-tegra/usb_phy.c 2011-03-21 08:55:24.000000000 +0100
@@ -710,8 +710,8 @@ struct tegra_usb_phy *tegra_usb_phy_open
 			goto err1;
 		}
 		tegra_gpio_enable(ulpi_config->reset_gpio);
-		gpio_request(ulpi_config->reset_gpio, "ulpi_phy_reset_b");
-		gpio_direction_output(ulpi_config->reset_gpio, 0);
+		gpio_request_one(ulpi_config->reset_gpio, GPIOF_OUT_INIT_LOW,
+				 "ulpi_phy_reset_b");
 		phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0);
 		phy->ulpi->io_priv = regs + ULPI_VIEWPORT;
 	} else {
diff -u -p a/arch/arm/plat-mxc/3ds_debugboard.c b/arch/arm/plat-mxc/3ds_debugboard.c
--- a/arch/arm/plat-mxc/3ds_debugboard.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/arm/plat-mxc/3ds_debugboard.c 2011-03-21 08:55:25.000000000 +0100
@@ -176,8 +176,7 @@ int __init mxc_expio_init(u32 base, u32 
 	/*
 	 * Configure INT line as GPIO input
 	 */
-	gpio_request(MXC_IRQ_TO_GPIO(p_irq), "expio_pirq");
-	gpio_direction_input(MXC_IRQ_TO_GPIO(p_irq));
+	gpio_request_one(MXC_IRQ_TO_GPIO(p_irq), GPIOF_IN, "expio_pirq");
 
 	/* disable the interrupt and clear the status */
 	__raw_writew(0, brd_io + INTR_MASK_REG);
diff -u -p a/arch/arm/plat-omap/debug-devices.c b/arch/arm/plat-omap/debug-devices.c
--- a/arch/arm/plat-omap/debug-devices.c 2009-12-12 00:23:19.000000000 +0100
+++ b/arch/arm/plat-omap/debug-devices.c 2011-03-21 08:55:21.000000000 +0100
@@ -82,12 +82,11 @@ int __init debug_card_init(u32 addr, uns
 	smc91x_resources[1].start = gpio_to_irq(gpio);
 	smc91x_resources[1].end   = gpio_to_irq(gpio);
 
-	status = gpio_request(gpio, "SMC91x irq");
+	status = gpio_request_one(gpio, GPIOF_IN, "SMC91x irq");
 	if (status < 0) {
 		printk(KERN_ERR "GPIO%d unavailable for smc91x IRQ\n", gpio);
 		return status;
 	}
-	gpio_direction_input(gpio);
 
 	led_resources[0].start = addr;
 	led_resources[0].end   = addr + SZ_4K - 1;
diff -u -p a/arch/avr32/boards/atngw100/mrmt.c b/arch/avr32/boards/atngw100/mrmt.c
--- a/arch/avr32/boards/atngw100/mrmt.c 2009-09-21 18:11:44.000000000 +0200
+++ b/arch/avr32/boards/atngw100/mrmt.c 2011-03-21 08:55:21.000000000 +0100
@@ -314,13 +314,11 @@ static int __init mrmt1_init(void)
 #endif
 
 	at32_select_gpio( PIN_LCD_DISP, AT32_GPIOF_OUTPUT );
-	gpio_request( PIN_LCD_DISP, "LCD_DISP" );
-	gpio_direction_output( PIN_LCD_DISP, 0 );	/* LCD DISP */
+	gpio_request_one(PIN_LCD_DISP, GPIOF_OUT_INIT_LOW, "LCD_DISP");/* LCD DISP */
 #ifdef CONFIG_BOARD_MRMT_LCD_DISABLE
 	/* Keep Backlight and DISP off */
 	at32_select_gpio( PIN_LCD_BL, AT32_GPIOF_OUTPUT );
-	gpio_request( PIN_LCD_BL, "LCD_BL" );
-	gpio_direction_output( PIN_LCD_BL, 0 );		/* Backlight */
+	gpio_request_one(PIN_LCD_BL, GPIOF_OUT_INIT_LOW, "LCD_BL");/* Backlight */
 #else
 	gpio_set_value( PIN_LCD_DISP, 1 );	/* DISP asserted first */
 #ifdef CONFIG_BOARD_MRMT_BL_PWM
@@ -331,20 +329,17 @@ static int __init mrmt1_init(void)
 	/* Backlight always on */
 	udelay( 1 );
 	at32_select_gpio( PIN_LCD_BL, AT32_GPIOF_OUTPUT );
-	gpio_request( PIN_LCD_BL, "LCD_BL" );
-	gpio_direction_output( PIN_LCD_BL, 1 );
+	gpio_request_one(PIN_LCD_BL, GPIOF_OUT_INIT_HIGH, "LCD_BL");
 #endif
 #endif
 
 	/* Make sure BT and Zigbee modules in reset */
 	at32_select_gpio( PIN_BT_RST, AT32_GPIOF_OUTPUT );
-	gpio_request( PIN_BT_RST, "BT_RST" );
-	gpio_direction_output( PIN_BT_RST, 1 );
+	gpio_request_one(PIN_BT_RST, GPIOF_OUT_INIT_HIGH, "BT_RST");
 	/* BT Module in Reset */
 
 	at32_select_gpio( PIN_ZB_RST_N, AT32_GPIOF_OUTPUT );
-	gpio_request( PIN_ZB_RST_N, "ZB_RST_N" );
-	gpio_direction_output( PIN_ZB_RST_N, 0 );
+	gpio_request_one(PIN_ZB_RST_N, GPIOF_OUT_INIT_LOW, "ZB_RST_N");
 	/* XBee Module in Reset */
 
 #ifdef CONFIG_BOARD_MRMT_WIRELESS_ZB
@@ -366,8 +361,7 @@ static int __init mrmt1_early_init(void)
 {
 	/* To maintain power-on signal in case boot loader did not already */
 	at32_select_gpio( PIN_PWR_ON, AT32_GPIOF_OUTPUT );
-	gpio_request( PIN_PWR_ON, "PIN_PWR_ON" );
-	gpio_direction_output( PIN_PWR_ON, 1 );
+	gpio_request_one(PIN_PWR_ON, GPIOF_OUT_INIT_HIGH, "PIN_PWR_ON");
 
 	return 0;
 }
diff -u -p a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c
--- a/arch/avr32/boards/atngw100/setup.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/avr32/boards/atngw100/setup.c 2011-03-21 08:55:21.000000000 +0100
@@ -309,13 +309,11 @@ static int __init atngw100_arch_init(voi
 	 */
 #ifdef CONFIG_BOARD_ATNGW100_MKII
 	at32_select_gpio(GPIO_PIN_PE(30), 0);
-	gpio_request(GPIO_PIN_PE(30), "j15");
-	gpio_direction_input(GPIO_PIN_PE(30));
+	gpio_request_one(GPIO_PIN_PE(30), GPIOF_IN, "j15");
 	gpio_export(GPIO_PIN_PE(30), false);
 #else
 	at32_select_gpio(GPIO_PIN_PB(30), 0);
-	gpio_request(GPIO_PIN_PB(30), "j15");
-	gpio_direction_input(GPIO_PIN_PB(30));
+	gpio_request_one(GPIO_PIN_PB(30), GPIOF_IN, "j15");
 	gpio_export(GPIO_PIN_PB(30), false);
 #endif
 
diff -u -p a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
--- a/arch/blackfin/mach-bf533/boards/stamp.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/blackfin/mach-bf533/boards/stamp.c 2011-03-21 08:55:22.000000000 +0100
@@ -718,6 +718,5 @@ void __init native_machine_early_platfor
 void native_machine_restart(char *cmd)
 {
 	/* workaround pull up on cpld / flash pin not being strong enough */
-	gpio_request(GPIO_PF0, "flash_cpld");
-	gpio_direction_output(GPIO_PF0, 0);
+	gpio_request_one(GPIO_PF0, GPIOF_OUT_INIT_LOW, "flash_cpld");
 }
diff -u -p a/arch/mips/alchemy/devboards/db1200/platform.c b/arch/mips/alchemy/devboards/db1200/platform.c
--- a/arch/mips/alchemy/devboards/db1200/platform.c 2010-09-04 09:22:04.000000000 +0200
+++ b/arch/mips/alchemy/devboards/db1200/platform.c 2011-03-21 08:55:24.000000000 +0100
@@ -468,8 +468,7 @@ static int __init db1200_dev_init(void)
 	pfc = __raw_readl((void __iomem *)SYS_PINFUNC) & ~SYS_PINFUNC_P0A;
 
 	/* switch off OTG VBUS supply */
-	gpio_request(215, "otg-vbus");
-	gpio_direction_output(215, 1);
+	gpio_request_one(215, GPIOF_OUT_INIT_HIGH, "otg-vbus");
 
 	printk(KERN_INFO "DB1200 device configuration:\n");
 
diff -u -p a/arch/mips/alchemy/mtx-1/platform.c b/arch/mips/alchemy/mtx-1/platform.c
--- a/arch/mips/alchemy/mtx-1/platform.c 2011-03-20 18:17:23.000000000 +0100
+++ b/arch/mips/alchemy/mtx-1/platform.c 2011-03-21 08:55:24.000000000 +0100
@@ -153,14 +153,13 @@ static int __init mtx1_register_devices(
 
 	au1xxx_override_eth_cfg(0, &mtx1_au1000_eth0_pdata);
 
-	rc = gpio_request(mtx1_gpio_button[0].gpio,
-					mtx1_gpio_button[0].desc);
+	rc = gpio_request_one(mtx1_gpio_button[0].gpio, GPIOF_IN,
+			      mtx1_gpio_button[0].desc);
 	if (rc < 0) {
 		printk(KERN_INFO "mtx1: failed to request %d\n",
 					mtx1_gpio_button[0].gpio);
 		goto out;
 	}
-	gpio_direction_input(mtx1_gpio_button[0].gpio);
 out:
 	return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs));
 }
diff -u -p a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c
--- a/arch/mips/txx9/rbtx4927/setup.c 2010-02-11 23:53:22.000000000 +0100
+++ b/arch/mips/txx9/rbtx4927/setup.c 2011-03-21 08:55:24.000000000 +0100
@@ -207,8 +207,7 @@ static void __init rbtx4927_mem_setup(vo
 #endif
 
 	/* TX4927-SIO DTR on (PIO[15]) */
-	gpio_request(15, "sio-dtr");
-	gpio_direction_output(15, 1);
+	gpio_request_one(15, GPIOF_OUT_INIT_HIGH, "sio-dtr");
 
 	tx4927_sio_init(0, 0);
 }
diff -u -p a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
--- a/arch/mips/txx9/rbtx4938/setup.c 2010-02-11 23:53:22.000000000 +0100
+++ b/arch/mips/txx9/rbtx4938/setup.c 2011-03-21 08:55:24.000000000 +0100
@@ -285,14 +285,12 @@ static int __init rbtx4938_spi_init(void
 	spi_eeprom_register(SPI_BUSNO, SEEPROM1_CS, 128);
 	spi_eeprom_register(SPI_BUSNO, 16 + SEEPROM2_CS, 128);
 	spi_eeprom_register(SPI_BUSNO, 16 + SEEPROM3_CS, 128);
-	gpio_request(16 + SRTC_CS, "rtc-rs5c348");
-	gpio_direction_output(16 + SRTC_CS, 0);
-	gpio_request(SEEPROM1_CS, "seeprom1");
-	gpio_direction_output(SEEPROM1_CS, 1);
-	gpio_request(16 + SEEPROM2_CS, "seeprom2");
-	gpio_direction_output(16 + SEEPROM2_CS, 1);
-	gpio_request(16 + SEEPROM3_CS, "seeprom3");
-	gpio_direction_output(16 + SEEPROM3_CS, 1);
+	gpio_request_one(16 + SRTC_CS, GPIOF_OUT_INIT_LOW, "rtc-rs5c348");
+	gpio_request_one(SEEPROM1_CS, GPIOF_OUT_INIT_HIGH, "seeprom1");
+	
+	gpio_request_one(16 + SEEPROM2_CS, GPIOF_OUT_INIT_HIGH, "seeprom2");
+	
+	gpio_request_one(16 + SEEPROM3_CS, GPIOF_OUT_INIT_HIGH, "seeprom3");
 	tx4938_spi_init(SPI_BUSNO);
 	return 0;
 }
diff -u -p a/arch/sh/boards/board-sh7757lcr.c b/arch/sh/boards/board-sh7757lcr.c
--- a/arch/sh/boards/board-sh7757lcr.c 2011-03-20 18:17:23.000000000 +0100
+++ b/arch/sh/boards/board-sh7757lcr.c 2011-03-21 08:55:21.000000000 +0100
@@ -492,26 +492,22 @@ static int __init sh7757lcr_devices_setu
 	gpio_request(GPIO_FN_EVENT0, NULL);
 
 	/* LED for heartbeat */
-	gpio_request(GPIO_PTU3, NULL);
-	gpio_direction_output(GPIO_PTU3, 1);
-	gpio_request(GPIO_PTU2, NULL);
-	gpio_direction_output(GPIO_PTU2, 1);
-	gpio_request(GPIO_PTU1, NULL);
-	gpio_direction_output(GPIO_PTU1, 1);
-	gpio_request(GPIO_PTU0, NULL);
-	gpio_direction_output(GPIO_PTU0, 1);
+	gpio_request_one(GPIO_PTU3, GPIOF_OUT_INIT_HIGH, NULL);
+	
+	gpio_request_one(GPIO_PTU2, GPIOF_OUT_INIT_HIGH, NULL);
+	
+	gpio_request_one(GPIO_PTU1, GPIOF_OUT_INIT_HIGH, NULL);
+	
+	gpio_request_one(GPIO_PTU0, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* control for MDIO of Gigabit Ethernet */
-	gpio_request(GPIO_PTT4, NULL);
-	gpio_direction_output(GPIO_PTT4, 1);
+	gpio_request_one(GPIO_PTT4, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* control for eMMC */
-	gpio_request(GPIO_PTT7, NULL);		/* eMMC_RST# */
-	gpio_direction_output(GPIO_PTT7, 0);
-	gpio_request(GPIO_PTT6, NULL);		/* eMMC_INDEX# */
-	gpio_direction_output(GPIO_PTT6, 0);
-	gpio_request(GPIO_PTT5, NULL);		/* eMMC_PRST# */
-	gpio_direction_output(GPIO_PTT5, 1);
+	gpio_request_one(GPIO_PTT7, GPIOF_OUT_INIT_LOW, NULL);		/* eMMC_RST# */
+	
+	gpio_request_one(GPIO_PTT6, GPIOF_OUT_INIT_LOW, NULL);		/* eMMC_INDEX# */
+	gpio_request_one(GPIO_PTT5, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* register SPI device information */
 	spi_register_board_info(spi_board_info,
diff -u -p a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
--- a/arch/sh/boards/mach-ap325rxa/setup.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/sh/boards/mach-ap325rxa/setup.c 2011-03-21 08:55:22.000000000 +0100
@@ -548,17 +548,14 @@ static int __init ap325rxa_devices_setup
 					&ap325rxa_sdram_leave_end);
 
 	/* LD3 and LD4 LEDs */
-	gpio_request(GPIO_PTX5, NULL); /* RUN */
-	gpio_direction_output(GPIO_PTX5, 1);
+	gpio_request_one(GPIO_PTX5, GPIOF_OUT_INIT_HIGH, NULL); /* RUN */
 	gpio_export(GPIO_PTX5, 0);
 
-	gpio_request(GPIO_PTX4, NULL); /* INDICATOR */
-	gpio_direction_output(GPIO_PTX4, 0);
+	gpio_request_one(GPIO_PTX4, GPIOF_OUT_INIT_LOW, NULL); /* INDICATOR */
 	gpio_export(GPIO_PTX4, 0);
 
 	/* SW1 input */
-	gpio_request(GPIO_PTF7, NULL); /* MODE */
-	gpio_direction_input(GPIO_PTF7);
+	gpio_request_one(GPIO_PTF7, GPIOF_IN, NULL); /* MODE */
 	gpio_export(GPIO_PTF7, 0);
 
 	/* LCDC */
@@ -588,8 +585,7 @@ static int __init ap325rxa_devices_setup
 	gpio_request(GPIO_FN_LCDDON, NULL);
 
 	/* LCD backlight */
-	gpio_request(GPIO_PTS3, NULL);
-	gpio_direction_output(GPIO_PTS3, 1);
+	gpio_request_one(GPIO_PTS3, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* CEU */
 	gpio_request(GPIO_FN_VIO_CLK2, NULL);
@@ -606,14 +602,13 @@ static int __init ap325rxa_devices_setup
 	gpio_request(GPIO_FN_VIO_D9, NULL);
 	gpio_request(GPIO_FN_VIO_D8, NULL);
 
-	gpio_request(GPIO_PTZ7, NULL);
-	gpio_direction_output(GPIO_PTZ7, 0); /* OE_CAM */
-	gpio_request(GPIO_PTZ6, NULL);
-	gpio_direction_output(GPIO_PTZ6, 0); /* STBY_CAM */
-	gpio_request(GPIO_PTZ5, NULL);
-	gpio_direction_output(GPIO_PTZ5, 0); /* RST_CAM */
-	gpio_request(GPIO_PTZ4, NULL);
-	gpio_direction_output(GPIO_PTZ4, 0); /* SADDR */
+	gpio_request_one(GPIO_PTZ7, GPIOF_OUT_INIT_LOW, NULL);
+	 /* OE_CAM */
+	gpio_request_one(GPIO_PTZ6, GPIOF_OUT_INIT_LOW, NULL);
+	 /* STBY_CAM */
+	gpio_request_one(GPIO_PTZ5, GPIOF_OUT_INIT_LOW, NULL);
+	 /* RST_CAM */
+	gpio_request_one(GPIO_PTZ4, GPIOF_OUT_INIT_LOW, NULL);/* SADDR */
 
 	__raw_writew(__raw_readw(PORT_MSELCRB) & ~0x0001, PORT_MSELCRB);
 
diff -u -p a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
--- a/arch/sh/boards/mach-ecovec24/setup.c 2011-03-20 18:17:23.000000000 +0100
+++ b/arch/sh/boards/mach-ecovec24/setup.c 2011-03-21 08:55:23.000000000 +0100
@@ -433,8 +433,7 @@ static int ts_get_pendown_state(void)
 {
 	int val = 0;
 	gpio_free(GPIO_FN_INTC_IRQ0);
-	gpio_request(GPIO_PTZ0, NULL);
-	gpio_direction_input(GPIO_PTZ0);
+	gpio_request_one(GPIO_PTZ0, GPIOF_IN, NULL);
 
 	val = gpio_get_value(GPIO_PTZ0);
 
@@ -992,8 +991,7 @@ static int __init arch_setup(void)
 	__raw_writew((__raw_readw(PORT_HIZA) & ~(0x1 << 1)) , PORT_HIZA);
 
 	/* enable SH-Eth */
-	gpio_request(GPIO_PTA1, NULL);
-	gpio_direction_output(GPIO_PTA1, 1);
+	gpio_request_one(GPIO_PTA1, GPIOF_OUT_INIT_HIGH, NULL);
 	mdelay(20);
 
 	gpio_request(GPIO_FN_RMII_RXD0,    NULL);
@@ -1097,8 +1095,7 @@ static int __init arch_setup(void)
 		 * but current sh_mobile_lcdc driver doesn't control it.
 		 * It is temporary correspondence
 		 */
-		gpio_request(GPIO_PTF4, NULL);
-		gpio_direction_output(GPIO_PTF4, 1);
+		gpio_request_one(GPIO_PTF4, GPIOF_OUT_INIT_HIGH, NULL);
 
 		/* enable TouchScreen */
 		i2c_register_board_info(0, &ts_i2c_clients, 1);
@@ -1172,8 +1169,7 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_SDHI0D2,  NULL);
 	gpio_request(GPIO_FN_SDHI0D1,  NULL);
 	gpio_request(GPIO_FN_SDHI0D0,  NULL);
-	gpio_request(GPIO_PTB6, NULL);
-	gpio_direction_output(GPIO_PTB6, 0);
+	gpio_request_one(GPIO_PTB6, GPIOF_OUT_INIT_LOW, NULL);
 
 #if !defined(CONFIG_MMC_SH_MMCIF)
 	/* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */
@@ -1185,8 +1181,7 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_SDHI1D2,  NULL);
 	gpio_request(GPIO_FN_SDHI1D1,  NULL);
 	gpio_request(GPIO_FN_SDHI1D0,  NULL);
-	gpio_request(GPIO_PTB7, NULL);
-	gpio_direction_output(GPIO_PTB7, 0);
+	gpio_request_one(GPIO_PTB7, GPIOF_OUT_INIT_LOW, NULL);
 
 	/* I/O buffer drive ability is high for SDHI1 */
 	__raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
@@ -1196,21 +1191,17 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_MSIOF0_TXD, NULL);
 	gpio_request(GPIO_FN_MSIOF0_RXD, NULL);
 	gpio_request(GPIO_FN_MSIOF0_TSCK, NULL);
-	gpio_request(GPIO_PTM4, NULL); /* software CS control of TSYNC pin */
-	gpio_direction_output(GPIO_PTM4, 1); /* active low CS */
-	gpio_request(GPIO_PTB6, NULL); /* 3.3V power control */
-	gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */
-	gpio_request(GPIO_PTY6, NULL); /* write protect */
-	gpio_direction_input(GPIO_PTY6);
-	gpio_request(GPIO_PTY7, NULL); /* card detect */
-	gpio_direction_input(GPIO_PTY7);
+	gpio_request_one(GPIO_PTM4, GPIOF_OUT_INIT_HIGH, NULL); /* software CS control of TSYNC pin *//* active low CS */
+	gpio_request_one(GPIO_PTB6, GPIOF_OUT_INIT_LOW, NULL); /* 3.3V power control *//* disable power by default */
+	gpio_request_one(GPIO_PTY6, GPIOF_IN, NULL); /* write protect */
+	
+	gpio_request_one(GPIO_PTY7, GPIOF_IN, NULL);
 
 	spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
 #endif
 
 	/* enable Video */
-	gpio_request(GPIO_PTU2, NULL);
-	gpio_direction_output(GPIO_PTU2, 1);
+	gpio_request_one(GPIO_PTU2, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* enable Camera */
 	gpio_request(GPIO_PTA3, NULL);
@@ -1245,13 +1236,11 @@ static int __init arch_setup(void)
 		clk_put(clk);
 	}
 
-	gpio_request(GPIO_PTU0, NULL);
-	gpio_direction_output(GPIO_PTU0, 0);
+	gpio_request_one(GPIO_PTU0, GPIOF_OUT_INIT_LOW, NULL);
 	mdelay(20);
 
 	/* enable motion sensor */
-	gpio_request(GPIO_FN_INTC_IRQ1, NULL);
-	gpio_direction_input(GPIO_FN_INTC_IRQ1);
+	gpio_request_one(GPIO_FN_INTC_IRQ1, GPIOF_IN, NULL);
 
 	/* set VPU clock to 166 MHz */
 	clk = clk_get(NULL, "vpu_clk");
@@ -1263,8 +1252,7 @@ static int __init arch_setup(void)
 	/* enable IrDA */
 	gpio_request(GPIO_FN_IRDA_OUT, NULL);
 	gpio_request(GPIO_FN_IRDA_IN,  NULL);
-	gpio_request(GPIO_PTU5, NULL);
-	gpio_direction_output(GPIO_PTU5, 0);
+	gpio_request_one(GPIO_PTU5, GPIOF_OUT_INIT_LOW, NULL);
 
 #if defined(CONFIG_MMC_SH_MMCIF)
 	/* enable MMCIF (needs DS2.6,7 set to OFF,ON) */
@@ -1278,8 +1266,7 @@ static int __init arch_setup(void)
 	gpio_request(GPIO_FN_MMC_D0, NULL);
 	gpio_request(GPIO_FN_MMC_CLK, NULL);
 	gpio_request(GPIO_FN_MMC_CMD, NULL);
-	gpio_request(GPIO_PTB7, NULL);
-	gpio_direction_output(GPIO_PTB7, 0);
+	gpio_request_one(GPIO_PTB7, GPIOF_OUT_INIT_LOW, NULL);
 
 	/* I/O buffer drive ability is high for MMCIF */
 	__raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
diff -u -p a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
--- a/arch/sh/boards/mach-kfr2r09/setup.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/sh/boards/mach-kfr2r09/setup.c 2011-03-21 08:55:24.000000000 +0100
@@ -500,8 +500,7 @@ static int kfr2r09_usb0_gadget_setup(voi
 {
 	int plugged_in;
 
-	gpio_request(GPIO_PTN4, NULL); /* USB_DET */
-	gpio_direction_input(GPIO_PTN4);
+	gpio_request_one(GPIO_PTN4, GPIOF_IN, NULL); /* USB_DET */
 	plugged_in = gpio_get_value(GPIO_PTN4);
 	if (!plugged_in)
 		return -ENODEV; /* no cable plugged in */
@@ -511,8 +510,7 @@ static int kfr2r09_usb0_gadget_setup(voi
 
 	__raw_writew((__raw_readw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
 	gpio_request(GPIO_FN_PDSTATUS, NULL); /* R-standby disables USB clock */
-	gpio_request(GPIO_PTV6, NULL); /* USBCLK_ON */
-	gpio_direction_output(GPIO_PTV6, 1); /* USBCLK_ON = H */
+	gpio_request_one(GPIO_PTV6, GPIOF_OUT_INIT_HIGH, NULL); /* USBCLK_ON *//* USBCLK_ON = H */
 	msleep(20); /* wait 20ms to let the clock settle */
 	clk_enable(clk_get(NULL, "usb0"));
 	__raw_writew(0x0600, 0xa40501d4);
@@ -539,8 +537,7 @@ static int __init kfr2r09_devices_setup(
 	gpio_request(GPIO_FN_SCIF1_RXD, NULL);
 	gpio_request(GPIO_FN_SCIF1_TXD, NULL);
 	kfr2r09_serial_i2c_setup(); /* ECONTMSK(bit6=L10ONEN) set 1 */
-	gpio_request(GPIO_PTG3, NULL); /* HPON_ON */
-	gpio_direction_output(GPIO_PTG3, 1); /* HPON_ON = H */
+	gpio_request_one(GPIO_PTG3, GPIOF_OUT_INIT_HIGH, NULL); /* HPON_ON *//* HPON_ON = H */
 
 	/* setup NOR flash@CS0 */
 	__raw_writel(0x36db0400, BSC_CS0BCR);
@@ -587,12 +584,11 @@ static int __init kfr2r09_devices_setup(
 	gpio_request(GPIO_FN_LCDRD, NULL); /* LCD_RD/ */
 	gpio_request(GPIO_FN_LCDWR, NULL); /* LCD_WR/ */
 	gpio_request(GPIO_FN_LCDVSYN, NULL); /* LCD_VSYNC */
-	gpio_request(GPIO_PTE4, NULL); /* LCD_RST/ */
-	gpio_direction_output(GPIO_PTE4, 1);
-	gpio_request(GPIO_PTF4, NULL); /* PROTECT/ */
-	gpio_direction_output(GPIO_PTF4, 1);
-	gpio_request(GPIO_PTU0, NULL); /* LEDSTDBY/ */
-	gpio_direction_output(GPIO_PTU0, 1);
+	gpio_request_one(GPIO_PTE4, GPIOF_OUT_INIT_HIGH, NULL); /* LCD_RST/ */
+	
+	gpio_request_one(GPIO_PTF4, GPIOF_OUT_INIT_HIGH, NULL); /* PROTECT/ */
+	
+	gpio_request_one(GPIO_PTU0, GPIOF_OUT_INIT_HIGH, NULL);
 
 	/* setup USB function */
 	if (kfr2r09_usb0_gadget_setup() == 0)
diff -u -p a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
--- a/arch/sh/boards/mach-migor/setup.c 2011-01-19 18:51:18.000000000 +0100
+++ b/arch/sh/boards/mach-migor/setup.c 2011-03-21 08:55:22.000000000 +0100
@@ -538,8 +538,7 @@ static int __init migor_devices_setup(vo
 	/* NAND Flash */
 	gpio_request(GPIO_FN_CS6A_CE2B, NULL);
 	__raw_writel((__raw_readl(BSC_CS6ABCR) & ~0x0600) | 0x0200, BSC_CS6ABCR);
-	gpio_request(GPIO_PTA1, NULL);
-	gpio_direction_input(GPIO_PTA1);
+	gpio_request_one(GPIO_PTA1, GPIOF_IN, NULL);
 
 	/* SDHI */
 	gpio_request(GPIO_FN_SDHICD, NULL);
@@ -576,8 +575,7 @@ static int __init migor_devices_setup(vo
 	gpio_request(GPIO_FN_LCDCS, NULL);
 	gpio_request(GPIO_FN_LCDRD, NULL);
 	gpio_request(GPIO_FN_LCDWR, NULL);
-	gpio_request(GPIO_PTH2, NULL); /* LCD_DON */
-	gpio_direction_output(GPIO_PTH2, 1);
+	gpio_request_one(GPIO_PTH2, GPIOF_OUT_INIT_HIGH, NULL); /* LCD_DON */
 #endif
 #ifdef CONFIG_SH_MIGOR_RTA_WVGA /* LCDC - WVGA - Enable RGB Interface signals */
 	gpio_request(GPIO_FN_LCDD15, NULL);
@@ -621,13 +619,10 @@ static int __init migor_devices_setup(vo
 	gpio_request(GPIO_FN_VIO_D9, NULL);
 	gpio_request(GPIO_FN_VIO_D8, NULL);
 
-	gpio_request(GPIO_PTT3, NULL); /* VIO_RST */
-	gpio_direction_output(GPIO_PTT3, 0);
-	gpio_request(GPIO_PTT2, NULL); /* TV_IN_EN */
-	gpio_direction_output(GPIO_PTT2, 1);
-	gpio_request(GPIO_PTT0, NULL); /* CAM_EN */
+	gpio_request_one(GPIO_PTT3, GPIOF_OUT_INIT_LOW, NULL); /* VIO_RST */
+	gpio_request_one(GPIO_PTT2, GPIOF_OUT_INIT_HIGH, NULL); /* TV_IN_EN */
+	gpio_request_one(GPIO_PTT0, GPIOF_OUT_INIT_LOW, NULL); /* CAM_EN */
 #ifdef CONFIG_SH_MIGOR_RTA_WVGA
-	gpio_direction_output(GPIO_PTT0, 0);
 #else
 	gpio_direction_output(GPIO_PTT0, 1);
 #endif
diff -u -p a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
--- a/arch/sh/boards/mach-se/7724/setup.c 2011-02-02 17:27:37.000000000 +0100
+++ b/arch/sh/boards/mach-se/7724/setup.c 2011-03-21 08:55:21.000000000 +0100
@@ -899,8 +899,7 @@ static int __init devices_setup(void)
 	gpio_request(GPIO_FN_RMII_CRS_DV,  NULL);
 	gpio_request(GPIO_FN_MDIO,         NULL);
 	gpio_request(GPIO_FN_MDC,          NULL);
-	gpio_request(GPIO_PTX5, NULL);
-	gpio_direction_input(GPIO_PTX5);
+	gpio_request_one(GPIO_PTX5, GPIOF_IN, NULL);
 	sh_eth_init();
 
 	if (sw & SW41_B) {
diff -u -p a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
--- a/drivers/block/mg_disk.c 2010-08-25 09:45:50.000000000 +0200
+++ b/drivers/block/mg_disk.c 2011-03-21 08:55:24.000000000 +0100
@@ -882,10 +882,9 @@ static int mg_probe(struct platform_devi
 	host->rst = rsc->start;
 
 	/* init rst pin */
-	err = gpio_request(host->rst, MG_RST_PIN);
+	err = gpio_request_one(host->rst, GPIOF_OUT_INIT_HIGH, MG_RST_PIN);
 	if (err)
 		goto probe_err_3;
-	gpio_direction_output(host->rst, 1);
 
 	/* reset out pin */
 	if (!(prv_data->dev_attr & MG_DEV_MASK))
@@ -901,10 +900,9 @@ static int mg_probe(struct platform_devi
 			goto probe_err_3a;
 		}
 		host->rstout = rsc->start;
-		err = gpio_request(host->rstout, MG_RSTOUT_PIN);
+		err = gpio_request_one(host->rstout, GPIOF_IN, MG_RSTOUT_PIN);
 		if (err)
 			goto probe_err_3a;
-		gpio_direction_input(host->rstout);
 	}
 
 	/* disk reset */
diff -u -p a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
--- a/drivers/hwmon/sht15.c 2011-03-20 18:17:23.000000000 +0100
+++ b/drivers/hwmon/sht15.c 2011-03-21 08:55:24.000000000 +0100
@@ -555,12 +555,12 @@ static int __devinit sht15_probe(struct 
 		ret = regulator_register_notifier(data->reg, &data->nb);
 	}
 /* Try requesting the GPIOs */
-	ret = gpio_request(data->pdata->gpio_sck, "SHT15 sck");
+	ret = gpio_request_one(data->pdata->gpio_sck, GPIOF_OUT_INIT_LOW,
+			       "SHT15 sck");
 	if (ret) {
 		dev_err(&pdev->dev, "gpio request failed");
 		goto err_free_data;
 	}
-	gpio_direction_output(data->pdata->gpio_sck, 0);
 	ret = gpio_request(data->pdata->gpio_data, "SHT15 data");
 	if (ret) {
 		dev_err(&pdev->dev, "gpio request failed");
diff -u -p a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
--- a/drivers/input/keyboard/matrix_keypad.c 2010-07-03 18:06:34.000000000 +0200
+++ b/drivers/input/keyboard/matrix_keypad.c 2011-03-21 08:55:22.000000000 +0100
@@ -318,15 +318,14 @@ static int __devinit init_matrix_gpio(st
 	}
 
 	for (i = 0; i < pdata->num_row_gpios; i++) {
-		err = gpio_request(pdata->row_gpios[i], "matrix_kbd_row");
+		err = gpio_request_one(pdata->row_gpios[i], GPIOF_IN,
+				       "matrix_kbd_row");
 		if (err) {
 			dev_err(&pdev->dev,
 				"failed to request GPIO%d for ROW%d\n",
 				pdata->row_gpios[i], i);
 			goto err_free_rows;
 		}
-
-		gpio_direction_input(pdata->row_gpios[i]);
 	}
 
 	if (pdata->clustered_irq > 0) {
diff -u -p a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
--- a/drivers/input/keyboard/omap-keypad.c 2010-12-28 18:26:03.000000000 +0100
+++ b/drivers/input/keyboard/omap-keypad.c 2011-03-21 08:55:22.000000000 +0100
@@ -336,23 +336,24 @@ static int __devinit omap_kp_probe(struc
 	if (cpu_is_omap24xx()) {
 		/* Cols: outputs */
 		for (col_idx = 0; col_idx < omap_kp->cols; col_idx++) {
-			if (gpio_request(col_gpios[col_idx], "omap_kp_col") < 0) {
+			if (gpio_request_one(col_gpios[col_idx],
+					     GPIOF_OUT_INIT_LOW,
+					     "omap_kp_col") < 0) {
 				printk(KERN_ERR "Failed to request"
 				       "GPIO%d for keypad\n",
 				       col_gpios[col_idx]);
 				goto err1;
 			}
-			gpio_direction_output(col_gpios[col_idx], 0);
 		}
 		/* Rows: inputs */
 		for (row_idx = 0; row_idx < omap_kp->rows; row_idx++) {
-			if (gpio_request(row_gpios[row_idx], "omap_kp_row") < 0) {
+			if (gpio_request_one(row_gpios[row_idx], GPIOF_IN,
+					     "omap_kp_row") < 0) {
 				printk(KERN_ERR "Failed to request"
 				       "GPIO%d for keypad\n",
 				       row_gpios[row_idx]);
 				goto err2;
 			}
-			gpio_direction_input(row_gpios[row_idx]);
 		}
 	} else {
 		col_idx = 0;
diff -u -p a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c
--- a/drivers/input/mouse/gpio_mouse.c 2009-07-12 20:48:31.000000000 +0200
+++ b/drivers/input/mouse/gpio_mouse.c 2011-03-21 08:55:22.000000000 +0100
@@ -83,14 +83,12 @@ static int __devinit gpio_mouse_probe(st
 				dev_dbg(&pdev->dev, "no left button defined\n");
 
 		} else {
-			error = gpio_request(pin, "gpio_mouse");
+			error = gpio_request_one(pin, GPIOF_IN, "gpio_mouse");
 			if (error) {
 				dev_err(&pdev->dev, "fail %d pin (%d idx)\n",
 					pin, i);
 				goto out_free_gpios;
 			}
-
-			gpio_direction_input(pin);
 		}
 	}
 
diff -u -p a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
--- a/drivers/input/serio/ams_delta_serio.c 2010-11-24 07:55:11.000000000 +0100
+++ b/drivers/input/serio/ams_delta_serio.c 2011-03-21 08:55:21.000000000 +0100
@@ -122,19 +122,19 @@ static int __init ams_delta_serio_init(v
 	strlcpy(ams_delta_serio->phys, "GPIO/serio0",
 			sizeof(ams_delta_serio->phys));
 
-	err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, "serio-data");
+	err = gpio_request_one(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, GPIOF_IN,
+			       "serio-data");
 	if (err) {
 		pr_err("ams_delta_serio: Couldn't request gpio pin for data\n");
 		goto serio;
 	}
-	gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_DATA);
 
-	err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, "serio-clock");
+	err = gpio_request_one(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, GPIOF_IN,
+			       "serio-clock");
 	if (err) {
 		pr_err("ams_delta_serio: couldn't request gpio pin for clock\n");
 		goto gpio_data;
 	}
-	gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_CLK);
 
 	err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
 			ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
diff -u -p a/drivers/leds/leds-bd2802.c b/drivers/leds/leds-bd2802.c
--- a/drivers/leds/leds-bd2802.c 2010-08-06 00:40:23.000000000 +0200
+++ b/drivers/leds/leds-bd2802.c 2011-03-21 08:55:21.000000000 +0100
@@ -697,8 +697,7 @@ static int __devinit bd2802_probe(struct
 	i2c_set_clientdata(client, led);
 
 	/* Configure RESET GPIO (L: RESET, H: RESET cancel) */
-	gpio_request(pdata->reset_gpio, "RGB_RESETB");
-	gpio_direction_output(pdata->reset_gpio, 1);
+	gpio_request_one(pdata->reset_gpio, GPIOF_OUT_INIT_HIGH, "RGB_RESETB");
 
 	/* Tacss = min 0.1ms */
 	udelay(100);
diff -u -p a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c
--- a/drivers/mfd/dm355evm_msp.c 2009-09-19 08:25:19.000000000 +0200
+++ b/drivers/mfd/dm355evm_msp.c 2011-03-21 08:55:23.000000000 +0100
@@ -307,8 +307,7 @@ static int add_children(struct i2c_clien
 	for (i = 0; i < ARRAY_SIZE(config_inputs); i++) {
 		int gpio = dm355evm_msp_gpio.base + config_inputs[i].offset;
 
-		gpio_request(gpio, config_inputs[i].label);
-		gpio_direction_input(gpio);
+		gpio_request_one(gpio, GPIOF_IN, config_inputs[i].label);
 
 		/* make it easy for userspace to see these */
 		gpio_export(gpio, false);
diff -u -p a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
--- a/drivers/mfd/omap-usb-host.c 2011-03-14 17:19:15.000000000 +0100
+++ b/drivers/mfd/omap-usb-host.c 2011-03-21 08:55:23.000000000 +0100
@@ -716,17 +716,15 @@ static int usbhs_enable(struct device *d
 
 	if (pdata->ehci_data->phy_reset) {
 		if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) {
-			gpio_request(pdata->ehci_data->reset_gpio_port[0],
-						"USB1 PHY reset");
-			gpio_direction_output
-				(pdata->ehci_data->reset_gpio_port[0], 1);
+			gpio_request_one(pdata->ehci_data->reset_gpio_port[0],
+					 GPIOF_OUT_INIT_HIGH,
+					 "USB1 PHY reset");
 		}
 
 		if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) {
-			gpio_request(pdata->ehci_data->reset_gpio_port[1],
-						"USB2 PHY reset");
-			gpio_direction_output
-				(pdata->ehci_data->reset_gpio_port[1], 1);
+			gpio_request_one(pdata->ehci_data->reset_gpio_port[1],
+					 GPIOF_OUT_INIT_HIGH,
+					 "USB2 PHY reset");
 		}
 
 		/* Hold the PHY in RESET for enough time till DIR is high */
diff -u -p a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
--- a/drivers/mmc/host/pxamci.c 2010-09-30 17:54:15.000000000 +0200
+++ b/drivers/mmc/host/pxamci.c 2011-03-21 08:55:23.000000000 +0100
@@ -719,20 +719,19 @@ static int pxamci_probe(struct platform_
 				      host->pdata->gpio_power_invert);
 	}
 	if (gpio_is_valid(gpio_ro)) {
-		ret = gpio_request(gpio_ro, "mmc card read only");
+		ret = gpio_request_one(gpio_ro, GPIOF_IN,
+				       "mmc card read only");
 		if (ret) {
 			dev_err(&pdev->dev, "Failed requesting gpio_ro %d\n", gpio_ro);
 			goto err_gpio_ro;
 		}
-		gpio_direction_input(gpio_ro);
 	}
 	if (gpio_is_valid(gpio_cd)) {
-		ret = gpio_request(gpio_cd, "mmc card detect");
+		ret = gpio_request_one(gpio_cd, GPIOF_IN, "mmc card detect");
 		if (ret) {
 			dev_err(&pdev->dev, "Failed requesting gpio_cd %d\n", gpio_cd);
 			goto err_gpio_cd;
 		}
-		gpio_direction_input(gpio_cd);
 
 		ret = request_irq(gpio_to_irq(gpio_cd), pxamci_detect_irq,
 				  IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
diff -u -p a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c
--- a/drivers/mmc/host/s3cmci.c 2010-09-18 08:59:06.000000000 +0200
+++ b/drivers/mmc/host/s3cmci.c 2011-03-21 08:55:25.000000000 +0100
@@ -1676,13 +1676,12 @@ static int __devinit s3cmci_probe(struct
 		host->irq_cd = -1;
 
 	if (!host->pdata->no_wprotect) {
-		ret = gpio_request(host->pdata->gpio_wprotect, "s3cmci wp");
+		ret = gpio_request_one(host->pdata->gpio_wprotect, GPIOF_IN,
+				       "s3cmci wp");
 		if (ret) {
 			dev_err(&pdev->dev, "failed to get writeprotect\n");
 			goto probe_free_irq_cd;
 		}
-
-		gpio_direction_input(host->pdata->gpio_wprotect);
 	}
 
 	/* depending on the dma state, get a dma channel to use. */
diff -u -p a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c
--- a/drivers/mtd/maps/bfin-async-flash.c 2010-03-29 19:27:56.000000000 +0200
+++ b/drivers/mtd/maps/bfin-async-flash.c 2011-03-21 08:55:25.000000000 +0100
@@ -154,12 +154,12 @@ static int __devinit bfin_flash_probe(st
 	state->flash_ambctl0  = flash_ambctl->start;
 	state->flash_ambctl1  = flash_ambctl->end;
 
-	if (gpio_request(state->enet_flash_pin, DRIVER_NAME)) {
+	if (gpio_request_one(state->enet_flash_pin, GPIOF_OUT_INIT_HIGH,
+			     DRIVER_NAME)) {
 		pr_devinit(KERN_ERR DRIVER_NAME ": Failed to request gpio %d\n", state->enet_flash_pin);
 		kfree(state);
 		return -EBUSY;
 	}
-	gpio_direction_output(state->enet_flash_pin, 1);
 
 	pr_devinit(KERN_NOTICE DRIVER_NAME ": probing %d-bit flash bus\n", state->map.bankwidth * 8);
 	state->mtd = do_map_probe(memory->name, &state->map);
diff -u -p a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c
--- a/drivers/mtd/maps/gpio-addr-flash.c 2010-11-01 20:33:30.000000000 +0100
+++ b/drivers/mtd/maps/gpio-addr-flash.c 2011-03-21 08:55:25.000000000 +0100
@@ -233,7 +233,8 @@ static int __devinit gpio_flash_probe(st
 
 	i = 0;
 	do {
-		if (gpio_request(state->gpio_addrs[i], DRIVER_NAME)) {
+		if (gpio_request_one(state->gpio_addrs[i],
+				     GPIOF_OUT_INIT_LOW, DRIVER_NAME)) {
 			pr_devinit(KERN_ERR PFX "failed to request gpio %d\n",
 				state->gpio_addrs[i]);
 			while (i--)
@@ -241,7 +242,6 @@ static int __devinit gpio_flash_probe(st
 			kfree(state);
 			return -EBUSY;
 		}
-		gpio_direction_output(state->gpio_addrs[i], 0);
 	} while (++i < state->gpio_count);
 
 	pr_devinit(KERN_NOTICE PFX "probing %d-bit flash bus\n",
diff -u -p a/drivers/mtd/nand/cmx270_nand.c b/drivers/mtd/nand/cmx270_nand.c
--- a/drivers/mtd/nand/cmx270_nand.c 2010-03-29 19:27:56.000000000 +0200
+++ b/drivers/mtd/nand/cmx270_nand.c 2011-03-21 08:55:25.000000000 +0100
@@ -159,22 +159,18 @@ static int __init cmx270_init(void)
 	if (!(machine_is_armcore() && cpu_is_pxa27x()))
 		return -ENODEV;
 
-	ret = gpio_request(GPIO_NAND_CS, "NAND CS");
+	ret = gpio_request_one(GPIO_NAND_CS, GPIOF_OUT_INIT_HIGH, "NAND CS");
 	if (ret) {
 		pr_warning("CM-X270: failed to request NAND CS gpio\n");
 		return ret;
 	}
 
-	gpio_direction_output(GPIO_NAND_CS, 1);
-
-	ret = gpio_request(GPIO_NAND_RB, "NAND R/B");
+	ret = gpio_request_one(GPIO_NAND_RB, GPIOF_IN, "NAND R/B");
 	if (ret) {
 		pr_warning("CM-X270: failed to request NAND R/B gpio\n");
 		goto err_gpio_request;
 	}
 
-	gpio_direction_input(GPIO_NAND_RB);
-
 	/* Allocate memory for MTD device structure and private data */
 	cmx270_nand_mtd = kzalloc(sizeof(struct mtd_info) +
 				  sizeof(struct nand_chip),
diff -u -p a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
--- a/drivers/mtd/nand/fsl_upm.c 2011-03-14 17:19:15.000000000 +0100
+++ b/drivers/mtd/nand/fsl_upm.c 2011-03-21 08:55:25.000000000 +0100
@@ -278,13 +278,13 @@ static int __devinit fun_probe(struct pl
 		fun->rnb_gpio[i] = -1;
 		rnb_gpio = of_get_gpio(ofdev->dev.of_node, i);
 		if (rnb_gpio >= 0) {
-			ret = gpio_request(rnb_gpio, dev_name(&ofdev->dev));
+			ret = gpio_request_one(rnb_gpio, GPIOF_IN,
+					       dev_name(&ofdev->dev));
 			if (ret) {
 				dev_err(&ofdev->dev,
 					"can't request RNB gpio #%d\n", i);
 				goto err2;
 			}
-			gpio_direction_input(rnb_gpio);
 			fun->rnb_gpio[i] = rnb_gpio;
 		} else if (rnb_gpio == -EINVAL) {
 			dev_err(&ofdev->dev, "RNB gpio #%d is invalid\n", i);
diff -u -p a/drivers/mtd/nand/gpio.c b/drivers/mtd/nand/gpio.c
--- a/drivers/mtd/nand/gpio.c 2010-01-03 21:18:12.000000000 +0100
+++ b/drivers/mtd/nand/gpio.c 2011-03-21 08:55:24.000000000 +0100
@@ -259,28 +259,27 @@ static int __devinit gpio_nand_probe(str
 
 	memcpy(&gpiomtd->plat, dev->dev.platform_data, sizeof(gpiomtd->plat));
 
-	ret = gpio_request(gpiomtd->plat.gpio_nce, "NAND NCE");
+	ret = gpio_request_one(gpiomtd->plat.gpio_nce, GPIOF_OUT_INIT_HIGH,
+			       "NAND NCE");
 	if (ret)
 		goto err_nce;
-	gpio_direction_output(gpiomtd->plat.gpio_nce, 1);
 	if (gpio_is_valid(gpiomtd->plat.gpio_nwp)) {
-		ret = gpio_request(gpiomtd->plat.gpio_nwp, "NAND NWP");
+		ret = gpio_request_one(gpiomtd->plat.gpio_nwp,
+				       GPIOF_OUT_INIT_HIGH, "NAND NWP");
 		if (ret)
 			goto err_nwp;
-		gpio_direction_output(gpiomtd->plat.gpio_nwp, 1);
 	}
-	ret = gpio_request(gpiomtd->plat.gpio_ale, "NAND ALE");
+	ret = gpio_request_one(gpiomtd->plat.gpio_ale, GPIOF_OUT_INIT_LOW,
+			       "NAND ALE");
 	if (ret)
 		goto err_ale;
-	gpio_direction_output(gpiomtd->plat.gpio_ale, 0);
-	ret = gpio_request(gpiomtd->plat.gpio_cle, "NAND CLE");
+	ret = gpio_request_one(gpiomtd->plat.gpio_cle, GPIOF_OUT_INIT_LOW,
+			       "NAND CLE");
 	if (ret)
 		goto err_cle;
-	gpio_direction_output(gpiomtd->plat.gpio_cle, 0);
-	ret = gpio_request(gpiomtd->plat.gpio_rdy, "NAND RDY");
+	ret = gpio_request_one(gpiomtd->plat.gpio_rdy, GPIOF_IN, "NAND RDY");
 	if (ret)
 		goto err_rdy;
-	gpio_direction_input(gpiomtd->plat.gpio_rdy);
 
 
 	this->IO_ADDR_W  = this->IO_ADDR_R;
diff -u -p a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
--- a/drivers/mtd/onenand/omap2.c 2011-03-14 17:19:15.000000000 +0100
+++ b/drivers/mtd/onenand/omap2.c 2011-03-21 08:55:25.000000000 +0100
@@ -682,12 +682,12 @@ static int __devinit omap2_onenand_probe
 	}
 
 	if (c->gpio_irq) {
-		if ((r = gpio_request(c->gpio_irq, "OneNAND irq")) < 0) {
+		if ((r = gpio_request_one(c->gpio_irq, GPIOF_IN,
+					  "OneNAND irq")) < 0) {
 			dev_err(&pdev->dev,  "Failed to request GPIO%d for "
 				"OneNAND\n", c->gpio_irq);
 			goto err_iounmap;
 	}
-	gpio_direction_input(c->gpio_irq);
 
 	if ((r = request_irq(gpio_to_irq(c->gpio_irq),
 			     omap2_onenand_interrupt, IRQF_TRIGGER_RISING,
diff -u -p a/drivers/pcmcia/bfin_cf_pcmcia.c b/drivers/pcmcia/bfin_cf_pcmcia.c
--- a/drivers/pcmcia/bfin_cf_pcmcia.c 2010-03-29 19:27:57.000000000 +0200
+++ b/drivers/pcmcia/bfin_cf_pcmcia.c 2011-03-21 08:55:26.000000000 +0100
@@ -211,13 +211,12 @@ static int __devinit bfin_cf_probe(struc
 
 	cd_pfx = platform_get_irq(pdev, 1);	/*Card Detect GPIO PIN */
 
-	if (gpio_request(cd_pfx, "pcmcia: CD")) {
+	if (gpio_request_one(cd_pfx, GPIOF_IN, "pcmcia: CD")) {
 		dev_err(&pdev->dev,
 		       "Failed ro request Card Detect GPIO_%d\n",
 		       cd_pfx);
 		return -EBUSY;
 	}
-	gpio_direction_input(cd_pfx);
 
 	cf = kzalloc(sizeof *cf, GFP_KERNEL);
 	if (!cf) {
diff -u -p a/drivers/pcmcia/pxa2xx_cm_x255.c b/drivers/pcmcia/pxa2xx_cm_x255.c
--- a/drivers/pcmcia/pxa2xx_cm_x255.c 2009-11-08 21:45:05.000000000 +0100
+++ b/drivers/pcmcia/pxa2xx_cm_x255.c 2011-03-21 08:55:26.000000000 +0100
@@ -39,10 +39,10 @@ static struct pcmcia_irqs irqs[] = {
 
 static int cmx255_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
-	int ret = gpio_request(GPIO_PCMCIA_RESET, "PCCard reset");
+	int ret = gpio_request_one(GPIO_PCMCIA_RESET, GPIOF_OUT_INIT_LOW,
+				   "PCCard reset");
 	if (ret)
 		return ret;
-	gpio_direction_output(GPIO_PCMCIA_RESET, 0);
 
 	skt->socket.pci_irq = skt->nr == 0 ? PCMCIA_S0_RDYINT : PCMCIA_S1_RDYINT;
 	ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
diff -u -p a/drivers/pcmcia/pxa2xx_cm_x270.c b/drivers/pcmcia/pxa2xx_cm_x270.c
--- a/drivers/pcmcia/pxa2xx_cm_x270.c 2009-11-08 21:45:05.000000000 +0100
+++ b/drivers/pcmcia/pxa2xx_cm_x270.c 2011-03-21 08:55:26.000000000 +0100
@@ -33,10 +33,10 @@ static struct pcmcia_irqs irqs[] = {
 
 static int cmx270_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
-	int ret = gpio_request(GPIO_PCMCIA_RESET, "PCCard reset");
+	int ret = gpio_request_one(GPIO_PCMCIA_RESET, GPIOF_OUT_INIT_LOW,
+				   "PCCard reset");
 	if (ret)
 		return ret;
-	gpio_direction_output(GPIO_PCMCIA_RESET, 0);
 
 	skt->socket.pci_irq = PCMCIA_S0_RDYINT;
 	ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
diff -u -p a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c
--- a/drivers/rtc/rtc-v3020.c 2010-03-29 19:27:57.000000000 +0200
+++ b/drivers/rtc/rtc-v3020.c 2011-03-21 08:55:23.000000000 +0100
@@ -125,11 +125,11 @@ static int v3020_gpio_map(struct v3020 *
 	v3020_gpio[V3020_IO].gpio = pdata->gpio_io;
 
 	for (i = 0; i < ARRAY_SIZE(v3020_gpio); i++) {
-		err = gpio_request(v3020_gpio[i].gpio, v3020_gpio[i].name);
+		err = gpio_request_one(v3020_gpio[i].gpio,
+				       GPIOF_OUT_INIT_HIGH,
+				       v3020_gpio[i].name);
 		if (err)
 			goto err_request;
-
-		gpio_direction_output(v3020_gpio[i].gpio, 1);
 	}
 
 	chip->gpio = v3020_gpio;
diff -u -p a/drivers/spi/mpc52xx_spi.c b/drivers/spi/mpc52xx_spi.c
--- a/drivers/spi/mpc52xx_spi.c 2011-03-14 17:19:16.000000000 +0100
+++ b/drivers/spi/mpc52xx_spi.c 2011-03-21 08:55:23.000000000 +0100
@@ -468,7 +468,8 @@ static int __devinit mpc52xx_spi_probe(s
 				goto err_gpio;
 			}
 
-			rc = gpio_request(gpio_cs, dev_name(&op->dev));
+			rc = gpio_request_one(gpio_cs, GPIOF_OUT_INIT_HIGH,
+					      dev_name(&op->dev));
 			if (rc) {
 				dev_err(&op->dev,
 					"can't request spi cs gpio #%d "
@@ -476,7 +477,6 @@ static int __devinit mpc52xx_spi_probe(s
 				goto err_gpio;
 			}
 
-			gpio_direction_output(gpio_cs, 1);
 			ms->gpio_cs[i] = gpio_cs;
 		}
 	} else {
diff -u -p a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
--- a/drivers/spi/spi_bfin5xx.c 2011-02-19 08:28:52.000000000 +0100
+++ b/drivers/spi/spi_bfin5xx.c 2011-03-21 08:55:21.000000000 +0100
@@ -1150,12 +1150,13 @@ static int bfin_spi_setup(struct spi_dev
 	if (chip->chip_select_num >= MAX_CTRL_CS) {
 		/* Only request on first setup */
 		if (spi_get_ctldata(spi) == NULL) {
-			ret = gpio_request(chip->cs_gpio, spi->modalias);
+			ret = gpio_request_one(chip->cs_gpio,
+					       GPIOF_OUT_INIT_HIGH,
+					       spi->modalias);
 			if (ret) {
 				dev_err(&spi->dev, "gpio_request() error\n");
 				goto pin_error;
 			}
-			gpio_direction_output(chip->cs_gpio, 1);
 		}
 	}
 
diff -u -p a/drivers/spi/spi_oc_tiny.c b/drivers/spi/spi_oc_tiny.c
--- a/drivers/spi/spi_oc_tiny.c 2011-02-26 13:17:47.000000000 +0100
+++ b/drivers/spi/spi_oc_tiny.c 2011-03-21 08:55:22.000000000 +0100
@@ -346,10 +346,10 @@ static int __devinit tiny_spi_probe(stru
 			goto exit;
 	}
 	for (i = 0; i < hw->gpio_cs_count; i++) {
-		err = gpio_request(hw->gpio_cs[i], dev_name(&pdev->dev));
+		err = gpio_request_one(hw->gpio_cs[i], GPIOF_OUT_INIT_HIGH,
+				       dev_name(&pdev->dev));
 		if (err)
 			goto exit_gpio;
-		gpio_direction_output(hw->gpio_cs[i], 1);
 	}
 	hw->bitbang.master->num_chipselect = max(1U, hw->gpio_cs_count);
 
diff -u -p a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
--- a/drivers/spi/spi_s3c24xx.c 2010-03-29 19:27:58.000000000 +0200
+++ b/drivers/spi/spi_s3c24xx.c 2011-03-21 08:55:23.000000000 +0100
@@ -614,14 +614,14 @@ static int __init s3c24xx_spi_probe(stru
 			goto err_register;
 		}
 
-		err = gpio_request(pdata->pin_cs, dev_name(&pdev->dev));
+		err = gpio_request_one(pdata->pin_cs, GPIOF_OUT_INIT_HIGH,
+				       dev_name(&pdev->dev));
 		if (err) {
 			dev_err(&pdev->dev, "Failed to get gpio for cs\n");
 			goto err_register;
 		}
 
 		hw->set_cs = s3c24xx_spi_gpiocs;
-		gpio_direction_output(pdata->pin_cs, 1);
 	} else
 		hw->set_cs = pdata->set_cs;
 
diff -u -p a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
--- a/drivers/staging/iio/adc/ad7816.c 2010-11-13 10:26:39.000000000 +0100
+++ b/drivers/staging/iio/adc/ad7816.c 2011-03-21 08:55:24.000000000 +0100
@@ -396,27 +396,24 @@ static int __devinit ad7816_probe(struct
 	chip->convert_pin = pins[1];
 	chip->busy_pin = pins[2];
 
-	ret = gpio_request(chip->rdwr_pin, chip->name);
+	ret = gpio_request_one(chip->rdwr_pin, GPIOF_IN, chip->name);
 	if (ret) {
 		dev_err(&spi_dev->dev, "Fail to request rdwr gpio PIN %d.\n",
 			chip->rdwr_pin);
 		goto error_free_chip;
 	}
-	gpio_direction_input(chip->rdwr_pin);
-	ret = gpio_request(chip->convert_pin, chip->name);
+	ret = gpio_request_one(chip->convert_pin, GPIOF_IN, chip->name);
 	if (ret) {
 		dev_err(&spi_dev->dev, "Fail to request convert gpio PIN %d.\n",
 			chip->convert_pin);
 		goto error_free_gpio_rdwr;
 	}
-	gpio_direction_input(chip->convert_pin);
-	ret = gpio_request(chip->busy_pin, chip->name);
+	ret = gpio_request_one(chip->busy_pin, GPIOF_IN, chip->name);
 	if (ret) {
 		dev_err(&spi_dev->dev, "Fail to request busy gpio PIN %d.\n",
 			chip->busy_pin);
 		goto error_free_gpio_convert;
 	}
-	gpio_direction_input(chip->busy_pin);
 
 	chip->indio_dev = iio_allocate_device();
 	if (chip->indio_dev == NULL) {
diff -u -p a/drivers/staging/iio/resolver/ad2s120x.c b/drivers/staging/iio/resolver/ad2s120x.c
--- a/drivers/staging/iio/resolver/ad2s120x.c 2010-11-13 10:26:39.000000000 +0100
+++ b/drivers/staging/iio/resolver/ad2s120x.c 2011-03-21 08:55:24.000000000 +0100
@@ -220,12 +220,11 @@ static int __devinit ad2s120x_probe(stru
 	unsigned short *pins = spi->dev.platform_data;
 
 	for (pn = 0; pn < AD2S120X_PN; pn++) {
-		if (gpio_request(pins[pn], DRV_NAME)) {
+		if (gpio_request_one(pins[pn], GPIOF_OUT_INIT_HIGH, DRV_NAME)) {
 			pr_err("%s: request gpio pin %d failed\n",
 						DRV_NAME, pins[pn]);
 			goto error_ret;
 		}
-		gpio_direction_output(pins[pn], 1);
 	}
 
 	st = kzalloc(sizeof(*st), GFP_KERNEL);
diff -u -p a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
--- a/drivers/usb/gadget/at91_udc.c 2011-02-19 08:28:52.000000000 +0100
+++ b/drivers/usb/gadget/at91_udc.c 2011-03-21 08:55:26.000000000 +0100
@@ -1820,12 +1820,12 @@ static int __init at91udc_probe(struct p
 		goto fail1;
 	}
 	if (udc->board.vbus_pin > 0) {
-		retval = gpio_request(udc->board.vbus_pin, "udc_vbus");
+		retval = gpio_request_one(udc->board.vbus_pin, GPIOF_IN,
+					  "udc_vbus");
 		if (retval < 0) {
 			DBG("request vbus pin failed\n");
 			goto fail2;
 		}
-		gpio_direction_input(udc->board.vbus_pin);
 
 		/*
 		 * Get the initial state of VBUS - we cannot expect
diff -u -p a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
--- a/drivers/usb/gadget/pxa25x_udc.c 2010-09-04 09:22:05.000000000 +0200
+++ b/drivers/usb/gadget/pxa25x_udc.c 2011-03-21 08:55:26.000000000 +0100
@@ -2200,27 +2200,27 @@ static int __init pxa25x_udc_probe(struc
 	dev->transceiver = otg_get_transceiver();
 
 	if (gpio_is_valid(dev->mach->gpio_vbus)) {
-		if ((retval = gpio_request(dev->mach->gpio_vbus,
-				"pxa25x_udc GPIO VBUS"))) {
+		if ((retval = gpio_request_one(dev->mach->gpio_vbus,
+					       GPIOF_IN,
+					       "pxa25x_udc GPIO VBUS"))) {
 			dev_dbg(&pdev->dev,
 				"can't get vbus gpio %d, err: %d\n",
 				dev->mach->gpio_vbus, retval);
 			goto err_gpio_vbus;
 		}
-		gpio_direction_input(dev->mach->gpio_vbus);
 		vbus_irq = gpio_to_irq(dev->mach->gpio_vbus);
 	} else
 		vbus_irq = 0;
 
 	if (gpio_is_valid(dev->mach->gpio_pullup)) {
-		if ((retval = gpio_request(dev->mach->gpio_pullup,
-				"pca25x_udc GPIO PULLUP"))) {
+		if ((retval = gpio_request_one(dev->mach->gpio_pullup,
+					       GPIOF_OUT_INIT_LOW,
+					       "pca25x_udc GPIO PULLUP"))) {
 			dev_dbg(&pdev->dev,
 				"can't get pullup gpio %d, err: %d\n",
 				dev->mach->gpio_pullup, retval);
 			goto err_gpio_pullup;
 		}
-		gpio_direction_output(dev->mach->gpio_pullup, 0);
 	}
 
 	init_timer(&dev->timer);
diff -u -p a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
--- a/drivers/usb/host/ohci-at91.c 2010-05-08 13:16:00.000000000 +0200
+++ b/drivers/usb/host/ohci-at91.c 2011-03-21 08:55:25.000000000 +0100
@@ -283,8 +283,8 @@ static int ohci_hcd_at91_drv_probe(struc
 		for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) {
 			if (pdata->vbus_pin[i] <= 0)
 				continue;
-			gpio_request(pdata->vbus_pin[i], "ohci_vbus");
-			gpio_direction_output(pdata->vbus_pin[i], 0);
+			gpio_request_one(pdata->vbus_pin[i],
+					 GPIOF_OUT_INIT_LOW, "ohci_vbus");
 		}
 	}
 
diff -u -p a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
--- a/drivers/usb/host/ohci-omap.c 2009-10-28 12:03:41.000000000 +0100
+++ b/drivers/usb/host/ohci-omap.c 2011-03-21 08:55:25.000000000 +0100
@@ -254,8 +254,7 @@ static int ohci_omap_init(struct usb_hcd
 
 			/* gpio9 for overcurrent detction */
 			omap_cfg_reg(W8_1610_GPIO9);
-			gpio_request(9, "OHCI overcurrent");
-			gpio_direction_input(9);
+			gpio_request_one(9, GPIOF_IN, "OHCI overcurrent");
 
 			/* for paranoia's sake:  disable USB.PUEN */
 			omap_cfg_reg(W4_USB_HIGHZ);
diff -u -p a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
--- a/drivers/usb/musb/blackfin.c 2011-02-11 10:53:32.000000000 +0100
+++ b/drivers/usb/musb/blackfin.c 2011-03-21 08:55:25.000000000 +0100
@@ -380,12 +380,12 @@ static int bfin_musb_init(struct musb *m
 	 * here because we are in host mode
 	 */
 
-	if (gpio_request(musb->config->gpio_vrsel, "USB_VRSEL")) {
+	if (gpio_request_one(musb->config->gpio_vrsel, GPIOF_OUT_INIT_LOW,
+			     "USB_VRSEL")) {
 		printk(KERN_ERR "Failed ro request USB_VRSEL GPIO_%d\n",
 			musb->config->gpio_vrsel);
 		return -ENODEV;
 	}
-	gpio_direction_output(musb->config->gpio_vrsel, 0);
 
 	usb_nop_xceiv_register();
 	musb->xceiv = otg_get_transceiver();
diff -u -p a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c
--- a/drivers/usb/otg/gpio_vbus.c 2010-03-29 19:27:58.000000000 +0200
+++ b/drivers/usb/otg/gpio_vbus.c 2011-03-21 08:55:25.000000000 +0100
@@ -240,13 +240,12 @@ static int __init gpio_vbus_probe(struct
 	gpio_vbus->otg.set_power = gpio_vbus_set_power;
 	gpio_vbus->otg.set_suspend = gpio_vbus_set_suspend;
 
-	err = gpio_request(gpio, "vbus_detect");
+	err = gpio_request_one(gpio, GPIOF_IN, "vbus_detect");
 	if (err) {
 		dev_err(&pdev->dev, "can't request vbus gpio %d, err: %d\n",
 			gpio, err);
 		goto err_gpio;
 	}
-	gpio_direction_input(gpio);
 
 	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 	if (res) {
diff -u -p a/drivers/video/bf537-lq035.c b/drivers/video/bf537-lq035.c
--- a/drivers/video/bf537-lq035.c 2011-02-02 17:27:39.000000000 +0100
+++ b/drivers/video/bf537-lq035.c 2011-03-21 08:55:27.000000000 +0100
@@ -399,7 +399,7 @@ static int __devinit request_ports(void)
 
 #endif
 
-	if (gpio_request(MOD, KBUILD_MODNAME)) {
+	if (gpio_request_one(MOD, GPIOF_OUT_INIT_HIGH, KBUILD_MODNAME)) {
 		pr_err("requesting GPIO %d failed\n", MOD);
 #if (defined(UD) && defined(LBR))
 		gpio_free(LBR);
@@ -408,8 +408,6 @@ static int __devinit request_ports(void)
 		return -EBUSY;
 	}
 
-	gpio_direction_output(MOD, 1);
-
 	SSYNC();
 	return 0;
 }
diff -u -p a/drivers/video/bf54x-lq043fb.c b/drivers/video/bf54x-lq043fb.c
--- a/drivers/video/bf54x-lq043fb.c 2010-08-10 09:17:44.000000000 +0200
+++ b/drivers/video/bf54x-lq043fb.c 2011-03-21 08:55:21.000000000 +0100
@@ -240,7 +240,7 @@ static int request_ports(struct bfin_bf5
 	u16 eppi_req_18[] = EPPI0_18;
 	u16 disp = fbi->mach_info->disp;
 
-	if (gpio_request(disp, DRIVER_NAME)) {
+	if (gpio_request_one(disp, GPIOF_OUT_INIT_HIGH, DRIVER_NAME)) {
 		printk(KERN_ERR "Requesting GPIO %d failed\n", disp);
 		return -EFAULT;
 	}
@@ -263,8 +263,6 @@ static int request_ports(struct bfin_bf5
 		}
 	}
 
-	gpio_direction_output(disp, 1);
-
 	return 0;
 }
 
diff -u -p a/drivers/video/bfin-lq035q1-fb.c b/drivers/video/bfin-lq035q1-fb.c
--- a/drivers/video/bfin-lq035q1-fb.c 2010-05-27 15:47:04.000000000 +0200
+++ b/drivers/video/bfin-lq035q1-fb.c 2011-03-21 08:55:26.000000000 +0100
@@ -363,10 +363,10 @@ static int __devinit bfin_lq035q1_reques
 	 * Drive PPI_FS3 Low
 	 */
 	if (ANOMALY_05000400) {
-		int ret = gpio_request(P_IDENT(P_PPI0_FS3), "PPI_FS3");
+		int ret = gpio_request_one(P_IDENT(P_PPI0_FS3),
+					   GPIOF_OUT_INIT_LOW, "PPI_FS3");
 		if (ret)
 			return ret;
-		gpio_direction_output(P_IDENT(P_PPI0_FS3), 0);
 	}
 
 	if (ppi16)
@@ -714,14 +714,14 @@ static int __devinit bfin_lq035q1_probe(
 	}
 
 	if (info->disp_info->use_bl) {
-		ret = gpio_request(info->disp_info->gpio_bl, "LQ035 Backlight");
+		ret = gpio_request_one(info->disp_info->gpio_bl,
+				       GPIOF_OUT_INIT_LOW, "LQ035 Backlight");
 
 		if (ret) {
 			dev_err(&pdev->dev, "failed to request GPIO %d\n",
 				info->disp_info->gpio_bl);
 			goto out9;
 		}
-		gpio_direction_output(info->disp_info->gpio_bl, 0);
 	}
 
 	ret = register_framebuffer(fbinfo);
diff -u -p a/drivers/video/bfin_adv7393fb.c b/drivers/video/bfin_adv7393fb.c
--- a/drivers/video/bfin_adv7393fb.c 2010-12-04 18:54:36.000000000 +0100
+++ b/drivers/video/bfin_adv7393fb.c 2011-03-21 08:55:26.000000000 +0100
@@ -411,12 +411,12 @@ static int __devinit bfin_adv7393_fb_pro
 
 	/* Workaround "PPI Does Not Start Properly In Specific Mode" */
 	if (ANOMALY_05000400) {
-		if (gpio_request(P_IDENT(P_PPI0_FS3), "PPI0_FS3")) {
+		if (gpio_request_one(P_IDENT(P_PPI0_FS3), GPIOF_OUT_INIT_LOW,
+				     "PPI0_FS3")) {
 			dev_err(&client->dev, "PPI0_FS3 GPIO request failed\n");
 			ret = -EBUSY;
 			goto out_8;
 		}
-		gpio_direction_output(P_IDENT(P_PPI0_FS3), 0);
 	}
 
 	if (peripheral_request_list(ppi_pins, DRIVER_NAME)) {
diff -u -p a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
--- a/drivers/video/omap2/displays/panel-taal.c 2011-03-14 17:19:17.000000000 +0100
+++ b/drivers/video/omap2/displays/panel-taal.c 2011-03-21 08:55:26.000000000 +0100
@@ -753,14 +753,12 @@ static int taal_probe(struct omap_dss_de
 	if (panel_data->use_ext_te) {
 		int gpio = panel_data->ext_te_gpio;
 
-		r = gpio_request(gpio, "taal irq");
+		r = gpio_request_one(gpio, GPIOF_IN, "taal irq");
 		if (r) {
 			dev_err(&dssdev->dev, "GPIO request failed\n");
 			goto err_gpio;
 		}
 
-		gpio_direction_input(gpio);
-
 		r = request_irq(gpio_to_irq(gpio), taal_te_isr,
 				IRQF_DISABLED | IRQF_TRIGGER_RISING,
 				"taal vsync", dssdev);
diff -u -p a/sound/pci/cs5535audio/cs5535audio_olpc.c b/sound/pci/cs5535audio/cs5535audio_olpc.c
--- a/sound/pci/cs5535audio/cs5535audio_olpc.c 2009-12-17 08:30:15.000000000 +0100
+++ b/sound/pci/cs5535audio/cs5535audio_olpc.c 2011-03-21 08:55:25.000000000 +0100
@@ -152,11 +152,10 @@ int __devinit olpc_quirks(struct snd_car
 	if (!machine_is_olpc())
 		return 0;
 
-	if (gpio_request(OLPC_GPIO_MIC_AC, DRV_NAME)) {
+	if (gpio_request_one(OLPC_GPIO_MIC_AC, GPIOF_OUT_INIT_LOW, DRV_NAME)) {
 		printk(KERN_ERR DRV_NAME ": unable to allocate MIC GPIO\n");
 		return -EIO;
 	}
-	gpio_direction_output(OLPC_GPIO_MIC_AC, 0);
 
 	/* drop the original AD1888 HPF control */
 	memset(&elem, 0, sizeof(elem));
diff -u -p a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c
--- a/sound/soc/blackfin/bf5xx-ac97.c 2011-01-19 18:51:20.000000000 +0100
+++ b/sound/soc/blackfin/bf5xx-ac97.c 2011-03-21 08:55:24.000000000 +0100
@@ -215,8 +215,7 @@ static void bf5xx_ac97_warm_reset(struct
 	pr_debug("%s enter\n", __func__);
 
 	peripheral_free(per);
-	gpio_request(gpio, "bf5xx-ac97");
-	gpio_direction_output(gpio, 1);
+	gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "bf5xx-ac97");
 	udelay(2);
 	gpio_set_value(gpio, 0);
 	udelay(1);
@@ -321,13 +320,13 @@ static int bf5xx_ac97_probe(struct snd_s
 
 #ifdef CONFIG_SND_BF5XX_HAVE_COLD_RESET
 	/* Request PB3 as reset pin */
-	if (gpio_request(CONFIG_SND_BF5XX_RESET_GPIO_NUM, "SND_AD198x RESET")) {
+	if (gpio_request_one(CONFIG_SND_BF5XX_RESET_GPIO_NUM,
+			     GPIOF_OUT_INIT_HIGH, "SND_AD198x RESET")) {
 		pr_err("Failed to request GPIO_%d for reset\n",
 				CONFIG_SND_BF5XX_RESET_GPIO_NUM);
 		ret =  -1;
 		goto gpio_err;
 	}
-	gpio_direction_output(CONFIG_SND_BF5XX_RESET_GPIO_NUM, 1);
 #endif
 	sport_handle = sport_init(&sport_params[sport_num], 2, \
 			sizeof(struct ac97_frame), NULL);
diff -u -p a/sound/soc/blackfin/bf5xx-ad73311.c b/sound/soc/blackfin/bf5xx-ad73311.c
--- a/sound/soc/blackfin/bf5xx-ad73311.c 2010-11-24 07:55:12.000000000 +0100
+++ b/sound/soc/blackfin/bf5xx-ad73311.c 2011-03-21 08:55:25.000000000 +0100
@@ -131,13 +131,11 @@ static int snd_ad73311_configure(void)
 static int bf5xx_probe(struct platform_device *pdev)
 {
 	int err;
-	if (gpio_request(GPIO_SE, "AD73311_SE")) {
+	if (gpio_request_one(GPIO_SE, GPIOF_OUT_INIT_LOW, "AD73311_SE")) {
 		printk(KERN_ERR "%s: Failed ro request GPIO_%d\n", __func__, GPIO_SE);
 		return -EBUSY;
 	}
 
-	gpio_direction_output(GPIO_SE, 0);
-
 	err = snd_ad73311_configure();
 	if (err < 0)
 		return -EFAULT;
diff -u -p a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
--- a/sound/soc/codecs/tlv320aic3x.c 2010-12-26 10:19:08.000000000 +0100
+++ b/sound/soc/codecs/tlv320aic3x.c 2011-03-21 08:55:24.000000000 +0100
@@ -1379,10 +1379,10 @@ static int aic3x_probe(struct snd_soc_co
 
 	if (gpio_is_valid(aic3x->gpio_reset) &&
 	    !aic3x_is_shared_reset(aic3x)) {
-		ret = gpio_request(aic3x->gpio_reset, "tlv320aic3x reset");
+		ret = gpio_request_one(aic3x->gpio_reset, GPIOF_OUT_INIT_LOW,
+				       "tlv320aic3x reset");
 		if (ret != 0)
 			goto err_gpio;
-		gpio_direction_output(aic3x->gpio_reset, 0);
 	}
 
 	for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++)
diff -u -p a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
--- a/sound/soc/codecs/tlv320dac33.c 2011-03-14 17:19:19.000000000 +0100
+++ b/sound/soc/codecs/tlv320dac33.c 2011-03-21 08:55:22.000000000 +0100
@@ -1553,14 +1553,14 @@ static int __devinit dac33_i2c_probe(str
 
 	/* Check if the reset GPIO number is valid and request it */
 	if (dac33->power_gpio >= 0) {
-		ret = gpio_request(dac33->power_gpio, "tlv320dac33 reset");
+		ret = gpio_request_one(dac33->power_gpio, GPIOF_OUT_INIT_LOW,
+				       "tlv320dac33 reset");
 		if (ret < 0) {
 			dev_err(&client->dev,
 				"Failed to request reset GPIO (%d)\n",
 				dac33->power_gpio);
 			goto err_gpio;
 		}
-		gpio_direction_output(dac33->power_gpio, 0);
 	}
 
 	for (i = 0; i < ARRAY_SIZE(dac33->supplies); i++)
diff -u -p a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
--- a/sound/soc/codecs/tpa6130a2.c 2011-01-19 18:51:20.000000000 +0100
+++ b/sound/soc/codecs/tpa6130a2.c 2011-03-21 08:55:22.000000000 +0100
@@ -393,13 +393,13 @@ static int __devinit tpa6130a2_probe(str
 						TPA6130A2_MUTE_L;
 
 	if (data->power_gpio >= 0) {
-		ret = gpio_request(data->power_gpio, "tpa6130a2 enable");
+		ret = gpio_request_one(data->power_gpio, GPIOF_OUT_INIT_LOW,
+				       "tpa6130a2 enable");
 		if (ret < 0) {
 			dev_err(dev, "Failed to request power GPIO (%d)\n",
 				data->power_gpio);
 			goto err_gpio;
 		}
-		gpio_direction_output(data->power_gpio, 0);
 	}
 
 	switch (data->id) {
diff -u -p a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c
--- a/sound/soc/omap/n810.c 2011-01-09 09:32:58.000000000 +0100
+++ b/sound/soc/omap/n810.c 2011-03-21 08:55:22.000000000 +0100
@@ -369,10 +369,10 @@ static int __init n810_soc_init(void)
 	clk_set_parent(sys_clkout2_src, func96m_clk);
 	clk_set_rate(sys_clkout2, 12000000);
 
-	BUG_ON((gpio_request(N810_HEADSET_AMP_GPIO, "hs_amp") < 0) ||
+	BUG_ON((gpio_request_one(N810_HEADSET_AMP_GPIO, GPIOF_OUT_INIT_LOW,
+				 "hs_amp") < 0) ||
 	       (gpio_request(N810_SPEAKER_AMP_GPIO, "spk_amp") < 0));
 
-	gpio_direction_output(N810_HEADSET_AMP_GPIO, 0);
 	gpio_direction_output(N810_SPEAKER_AMP_GPIO, 0);
 
 	return 0;
diff -u -p a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c
--- a/sound/soc/omap/zoom2.c 2010-11-24 07:55:12.000000000 +0100
+++ b/sound/soc/omap/zoom2.c 2011-03-21 08:55:22.000000000 +0100
@@ -260,11 +260,11 @@ static int __init zoom2_soc_init(void)
 	if (ret)
 		goto err1;
 
-	BUG_ON(gpio_request(ZOOM2_HEADSET_MUX_GPIO, "hs_mux") < 0);
-	gpio_direction_output(ZOOM2_HEADSET_MUX_GPIO, 0);
+	BUG_ON(gpio_request_one(ZOOM2_HEADSET_MUX_GPIO, GPIOF_OUT_INIT_LOW,
+				"hs_mux") < 0);
 
-	BUG_ON(gpio_request(ZOOM2_HEADSET_EXTMUTE_GPIO, "ext_mute") < 0);
-	gpio_direction_output(ZOOM2_HEADSET_EXTMUTE_GPIO, 0);
+	BUG_ON(gpio_request_one(ZOOM2_HEADSET_EXTMUTE_GPIO,
+				GPIOF_OUT_INIT_LOW, "ext_mute") < 0);
 
 	return 0;
 
diff -u -p a/sound/soc/samsung/s3c24xx_uda134x.c b/sound/soc/samsung/s3c24xx_uda134x.c
--- a/sound/soc/samsung/s3c24xx_uda134x.c 2011-02-02 17:27:40.000000000 +0100
+++ b/sound/soc/samsung/s3c24xx_uda134x.c 2011-03-21 08:55:24.000000000 +0100
@@ -266,12 +266,11 @@ static struct uda134x_platform_data s3c2
 
 static int s3c24xx_uda134x_setup_pin(int pin, char *fun)
 {
-	if (gpio_request(pin, "s3c24xx_uda134x") < 0) {
+	if (gpio_request_one(pin, GPIOF_OUT_INIT_LOW, "s3c24xx_uda134x") < 0) {
 		printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: "
 		       "l3 %s pin already in use", fun);
 		return -EBUSY;
 	}
-	gpio_direction_output(pin, 0);
 	return 0;
 }
 
diff -u -p a/sound/soc/tegra/harmony.c b/sound/soc/tegra/harmony.c
--- a/sound/soc/tegra/harmony.c 2011-02-19 08:28:53.000000000 +0100
+++ b/sound/soc/tegra/harmony.c 2011-03-21 08:55:22.000000000 +0100
@@ -201,35 +201,30 @@ static int harmony_asoc_init(struct snd_
 	struct harmony_audio_platform_data *pdata = harmony->pdata;
 	int ret;
 
-	ret = gpio_request(pdata->gpio_spkr_en, "spkr_en");
+	ret = gpio_request_one(pdata->gpio_spkr_en, GPIOF_OUT_INIT_LOW,
+			       "spkr_en");
 	if (ret) {
 		dev_err(card->dev, "cannot get spkr_en gpio\n");
 		return ret;
 	}
 	harmony->gpio_requested |= GPIO_SPKR_EN;
 
-	gpio_direction_output(pdata->gpio_spkr_en, 0);
-
-	ret = gpio_request(pdata->gpio_int_mic_en, "int_mic_en");
+	ret = gpio_request_one(pdata->gpio_int_mic_en, GPIOF_OUT_INIT_LOW,
+			       "int_mic_en");
 	if (ret) {
 		dev_err(card->dev, "cannot get int_mic_en gpio\n");
 		return ret;
 	}
 	harmony->gpio_requested |= GPIO_INT_MIC_EN;
 
-	/* Disable int mic; enable signal is active-high */
-	gpio_direction_output(pdata->gpio_int_mic_en, 0);
-
-	ret = gpio_request(pdata->gpio_ext_mic_en, "ext_mic_en");
+	ret = gpio_request_one(pdata->gpio_ext_mic_en, GPIOF_OUT_INIT_LOW,
+			       "ext_mic_en");
 	if (ret) {
 		dev_err(card->dev, "cannot get ext_mic_en gpio\n");
 		return ret;
 	}
 	harmony->gpio_requested |= GPIO_EXT_MIC_EN;
 
-	/* Enable ext mic; enable signal is active-low */
-	gpio_direction_output(pdata->gpio_ext_mic_en, 0);
-
 	ret = snd_soc_add_controls(codec, harmony_controls,
 				   ARRAY_SIZE(harmony_controls));
 	if (ret < 0)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/2] ARM: mx5/mx53_evk: Remove unneeded gpio_set_value call
  2011-03-21  7:48           ` Grant Likely
@ 2011-03-21  8:01             ` Julia Lawall
  0 siblings, 0 replies; 20+ messages in thread
From: Julia Lawall @ 2011-03-21  8:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 21 Mar 2011, Grant Likely wrote:

> 2011/3/15 Julia Lawall <julia@diku.dk>:
> > On Tue, 15 Mar 2011, Uwe Kleine-K?nig wrote:
> >
> >> On Tue, Mar 15, 2011 at 10:41:37AM +0100, Julia Lawall wrote:
> >> > I tried the following
> >> >
> >> > @@
> >> > expression E1,E2;
> >> > @@
> >> >
> >> > ? ? ? gpio_direction_output(E1,E2);
> >> > ? ? ? ...
> >> > - ? ? gpio_set_value(E1,E2);
> >> >
> >> > and found occurrences in 15 files. ?In some cases there seems to be some
> >> > delay before the call to gpio_set_value. ?Does that have any impacton
> >> > whether it is needed?
> >> gpio_direction_output(E1,E2) implies gpio_set_value(E1,E2), so unless
> >> there is a gpio_set_value(E1,!E2) before gpio_set_value(E1,E2) is a
> >> noop.
> >>
> >> I still don't know how to work with coccinelle, so if you point me to a
> >> concrete location I can be more specific.
> >
> > OK. ?I have changed the semantic patch to the following:
> >
> > @@
> > expression E1,E2,E3;
> > @@
> >
> > ? ? ?gpio_direction_output(E1,E2);
> > ? ? ?... when != gpio_set_value(E1,E3)
> > - ? ? gpio_set_value(E1,E2);
> >
> > Now it doesn't do all the cases where there is an earlier set ofr some
> > other value. ?The patch I obtain is below. ?This only concerns 5 files.
> > I haven't checked the result at all.
> >
> > julia
> 
> Hi Julia,
> 
> Similar to my other reply, even though this patch is much smaller, I'm
> not particularly excited about changing all the drivers wholesale
> unless someone with hardware can give it a test.

I wasn't proposing either as an actual patch.  Only as a way to see what 
the actual code looks like and what issues should be taken into account.

thanks,
julia

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2011-03-21  8:01 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-14 18:21 [PATCH 1/2] ARM: mx5/babbage: Remove unneeded gpio_set_value call Fabio Estevam
2011-03-14 18:21 ` [PATCH 2/2] ARM: mx5/mx53_evk: " Fabio Estevam
2011-03-15  9:06   ` Uwe Kleine-König
2011-03-15  9:41     ` Julia Lawall
2011-03-15  9:49       ` Uwe Kleine-König
2011-03-15 10:19         ` Julia Lawall
2011-03-15 10:29           ` Wolfram Sang
2011-03-16  8:33           ` Uwe Kleine-König
2011-03-16  9:15             ` Julia Lawall
2011-03-16 14:19             ` Fabio Estevam
2011-03-20 17:56             ` Julia Lawall
2011-03-20 19:24               ` Wolfram Sang
2011-03-20 20:51                 ` Julia Lawall
2011-03-20 21:30                   ` Wolfram Sang
2011-03-20 21:42                     ` Julia Lawall
2011-03-20 21:04                 ` Julia Lawall
2011-03-21  7:43                   ` Grant Likely
2011-03-21  7:59                     ` Julia Lawall
2011-03-21  7:48           ` Grant Likely
2011-03-21  8:01             ` Julia Lawall

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).