* [PATCH 1/4] mfd: aat2870-core: Use gpio_request_one
@ 2011-12-01 1:47 Axel Lin
2011-12-01 1:49 ` [PATCH 2/4] mfd: dm355evm_msp: " Axel Lin
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Axel Lin @ 2011-12-01 1:47 UTC (permalink / raw)
To: linux-kernel; +Cc: Jin Park, Samuel Ortiz
Use gpio_request_one() instead of multiple gpiolib calls.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/mfd/aat2870-core.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c
index 02c4201..7620617 100644
--- a/drivers/mfd/aat2870-core.c
+++ b/drivers/mfd/aat2870-core.c
@@ -407,13 +407,13 @@ static int aat2870_i2c_probe(struct i2c_client *client,
aat2870->init(aat2870);
if (aat2870->en_pin >= 0) {
- ret = gpio_request(aat2870->en_pin, "aat2870-en");
+ ret = gpio_request_one(aat2870->en_pin, GPIOF_OUT_INIT_HIGH,
+ "aat2870-en");
if (ret < 0) {
dev_err(&client->dev,
"Failed to request GPIO %d\n", aat2870->en_pin);
goto out_kfree;
}
- gpio_direction_output(aat2870->en_pin, 1);
}
aat2870_enable(aat2870);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] mfd: dm355evm_msp: Use gpio_request_one
2011-12-01 1:47 [PATCH 1/4] mfd: aat2870-core: Use gpio_request_one Axel Lin
@ 2011-12-01 1:49 ` Axel Lin
2011-12-01 1:53 ` [PATCH 3/4] mfd: omap-usb-host: " Axel Lin
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Axel Lin @ 2011-12-01 1:49 UTC (permalink / raw)
To: linux-kernel; +Cc: David Brownell, Samuel Ortiz
Use gpio_request_one() instead of multiple gpiolib calls.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/mfd/dm355evm_msp.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c
index 8ad88da..7710227 100644
--- a/drivers/mfd/dm355evm_msp.c
+++ b/drivers/mfd/dm355evm_msp.c
@@ -308,8 +308,7 @@ static int add_children(struct i2c_client *client)
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);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] mfd: omap-usb-host: Use gpio_request_one
2011-12-01 1:47 [PATCH 1/4] mfd: aat2870-core: Use gpio_request_one Axel Lin
2011-12-01 1:49 ` [PATCH 2/4] mfd: dm355evm_msp: " Axel Lin
@ 2011-12-01 1:53 ` Axel Lin
2011-12-01 8:02 ` Igor Grinberg
2011-12-01 1:55 ` [PATCH 4/4] mfd: twl6040-core: " Axel Lin
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Axel Lin @ 2011-12-01 1:53 UTC (permalink / raw)
To: linux-kernel; +Cc: Keshava Munegowda, Samuel Ortiz
Use gpio_request_one() instead of multiple gpiolib calls.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/mfd/omap-usb-host.c | 20 +++++++-------------
1 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 86e1458..6533ecc 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -715,19 +715,13 @@ static int usbhs_enable(struct device *dev)
clk_enable(omap->usbtll_ick);
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], 0);
- }
+ if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
+ gpio_request_one(pdata->ehci_data->reset_gpio_port[0],
+ GPIOF_OUT_INIT_LOW, "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], 0);
- }
+ if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
+ gpio_request_one(pdata->ehci_data->reset_gpio_port[1],
+ GPIOF_OUT_INIT_LOW, "USB2 PHY reset");
/* Hold the PHY in RESET for enough time till DIR is high */
udelay(10);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] mfd: twl6040-core: Use gpio_request_one
2011-12-01 1:47 [PATCH 1/4] mfd: aat2870-core: Use gpio_request_one Axel Lin
2011-12-01 1:49 ` [PATCH 2/4] mfd: dm355evm_msp: " Axel Lin
2011-12-01 1:53 ` [PATCH 3/4] mfd: omap-usb-host: " Axel Lin
@ 2011-12-01 1:55 ` Axel Lin
2011-12-01 8:02 ` Igor Grinberg
2011-12-01 8:38 ` [PATCH 1/4] mfd: aat2870-core: " Jinyoung Park
2011-12-19 11:13 ` Samuel Ortiz
4 siblings, 1 reply; 10+ messages in thread
From: Axel Lin @ 2011-12-01 1:55 UTC (permalink / raw)
To: linux-kernel; +Cc: Misael Lopez Cruz, Jorge Eduardo Candelaria, Samuel Ortiz
Use gpio_request_one() instead of multiple gpiolib calls.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/mfd/twl6040-core.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c
index 268f80f..e57b1d1 100644
--- a/drivers/mfd/twl6040-core.c
+++ b/drivers/mfd/twl6040-core.c
@@ -509,13 +509,10 @@ static int __devinit twl6040_probe(struct platform_device *pdev)
twl6040->audpwron = -EINVAL;
if (gpio_is_valid(twl6040->audpwron)) {
- ret = gpio_request(twl6040->audpwron, "audpwron");
+ ret = gpio_request_one(twl6040->audpwron, GPIOF_OUT_INIT_LOW,
+ "audpwron");
if (ret)
goto gpio1_err;
-
- ret = gpio_direction_output(twl6040->audpwron, 0);
- if (ret)
- goto gpio2_err;
}
/* codec interrupt */
--
1.7.5.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 3/4] mfd: omap-usb-host: Use gpio_request_one
2011-12-01 1:53 ` [PATCH 3/4] mfd: omap-usb-host: " Axel Lin
@ 2011-12-01 8:02 ` Igor Grinberg
0 siblings, 0 replies; 10+ messages in thread
From: Igor Grinberg @ 2011-12-01 8:02 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Keshava Munegowda, Samuel Ortiz
Hi Axel,
On 12/01/11 03:53, Axel Lin wrote:
> Use gpio_request_one() instead of multiple gpiolib calls.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> drivers/mfd/omap-usb-host.c | 20 +++++++-------------
> 1 files changed, 7 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
> index 86e1458..6533ecc 100644
> --- a/drivers/mfd/omap-usb-host.c
> +++ b/drivers/mfd/omap-usb-host.c
> @@ -715,19 +715,13 @@ static int usbhs_enable(struct device *dev)
> clk_enable(omap->usbtll_ick);
>
> 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], 0);
> - }
> + if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0]))
> + gpio_request_one(pdata->ehci_data->reset_gpio_port[0],
> + GPIOF_OUT_INIT_LOW, "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], 0);
> - }
> + if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1]))
> + gpio_request_one(pdata->ehci_data->reset_gpio_port[1],
> + GPIOF_OUT_INIT_LOW, "USB2 PHY reset");
I was wondering, if we need the gpio_is_valid() check here and above?
gpio_request() already does the gpio_is_valid() check,
so why should we double check?
--
Regards,
Igor.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/4] mfd: twl6040-core: Use gpio_request_one
2011-12-01 1:55 ` [PATCH 4/4] mfd: twl6040-core: " Axel Lin
@ 2011-12-01 8:02 ` Igor Grinberg
2011-12-01 8:18 ` Axel Lin
0 siblings, 1 reply; 10+ messages in thread
From: Igor Grinberg @ 2011-12-01 8:02 UTC (permalink / raw)
To: Axel Lin
Cc: linux-kernel, Misael Lopez Cruz, Jorge Eduardo Candelaria, Samuel Ortiz
On 12/01/11 03:55, Axel Lin wrote:
> Use gpio_request_one() instead of multiple gpiolib calls.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> drivers/mfd/twl6040-core.c | 7 ++-----
> 1 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c
> index 268f80f..e57b1d1 100644
> --- a/drivers/mfd/twl6040-core.c
> +++ b/drivers/mfd/twl6040-core.c
> @@ -509,13 +509,10 @@ static int __devinit twl6040_probe(struct platform_device *pdev)
> twl6040->audpwron = -EINVAL;
>
> if (gpio_is_valid(twl6040->audpwron)) {
> - ret = gpio_request(twl6040->audpwron, "audpwron");
> + ret = gpio_request_one(twl6040->audpwron, GPIOF_OUT_INIT_LOW,
> + "audpwron");
> if (ret)
> goto gpio1_err;
> -
> - ret = gpio_direction_output(twl6040->audpwron, 0);
> - if (ret)
> - goto gpio2_err;
> }
same here, double check gpio_is_valid()?
--
Regards,
Igor.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/4] mfd: twl6040-core: Use gpio_request_one
2011-12-01 8:02 ` Igor Grinberg
@ 2011-12-01 8:18 ` Axel Lin
2011-12-01 9:10 ` Igor Grinberg
0 siblings, 1 reply; 10+ messages in thread
From: Axel Lin @ 2011-12-01 8:18 UTC (permalink / raw)
To: Igor Grinberg
Cc: linux-kernel, Misael Lopez Cruz, Jorge Eduardo Candelaria, Samuel Ortiz
2011/12/1 Igor Grinberg <grinberg@compulab.co.il>:
> On 12/01/11 03:55, Axel Lin wrote:
>> Use gpio_request_one() instead of multiple gpiolib calls.
>>
>> Signed-off-by: Axel Lin <axel.lin@gmail.com>
>> ---
>> drivers/mfd/twl6040-core.c | 7 ++-----
>> 1 files changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c
>> index 268f80f..e57b1d1 100644
>> --- a/drivers/mfd/twl6040-core.c
>> +++ b/drivers/mfd/twl6040-core.c
>> @@ -509,13 +509,10 @@ static int __devinit twl6040_probe(struct platform_device *pdev)
>> twl6040->audpwron = -EINVAL;
>>
>> if (gpio_is_valid(twl6040->audpwron)) {
>> - ret = gpio_request(twl6040->audpwron, "audpwron");
>> + ret = gpio_request_one(twl6040->audpwron, GPIOF_OUT_INIT_LOW,
>> + "audpwron");
>> if (ret)
>> goto gpio1_err;
>> -
>> - ret = gpio_direction_output(twl6040->audpwron, 0);
>> - if (ret)
>> - goto gpio2_err;
>> }
>
> same here, double check gpio_is_valid()?
In the case of
twl6040->audpwron = -EINVAL; ( see line 509 )
gpio_is_valid returns false, we just don't request gpio.
If we remove the gpio_is_valid checking here,
then gpio_request_one will return -EINVAL.
Then the code always goes to the error path if twl6040->audpwron is -EINVAL.
Axel
>
>
> --
> Regards,
> Igor.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] mfd: aat2870-core: Use gpio_request_one
2011-12-01 1:47 [PATCH 1/4] mfd: aat2870-core: Use gpio_request_one Axel Lin
` (2 preceding siblings ...)
2011-12-01 1:55 ` [PATCH 4/4] mfd: twl6040-core: " Axel Lin
@ 2011-12-01 8:38 ` Jinyoung Park
2011-12-19 11:13 ` Samuel Ortiz
4 siblings, 0 replies; 10+ messages in thread
From: Jinyoung Park @ 2011-12-01 8:38 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Samuel Ortiz
Acked-by: Jin Park <jinyoungp@nvidia.com>
On 2011-12-01 오전 10:47, Axel Lin wrote:
> Use gpio_request_one() instead of multiple gpiolib calls.
>
> Signed-off-by: Axel Lin<axel.lin@gmail.com>
> ---
> drivers/mfd/aat2870-core.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c
> index 02c4201..7620617 100644
> --- a/drivers/mfd/aat2870-core.c
> +++ b/drivers/mfd/aat2870-core.c
> @@ -407,13 +407,13 @@ static int aat2870_i2c_probe(struct i2c_client *client,
> aat2870->init(aat2870);
>
> if (aat2870->en_pin>= 0) {
> - ret = gpio_request(aat2870->en_pin, "aat2870-en");
> + ret = gpio_request_one(aat2870->en_pin, GPIOF_OUT_INIT_HIGH,
> + "aat2870-en");
> if (ret< 0) {
> dev_err(&client->dev,
> "Failed to request GPIO %d\n", aat2870->en_pin);
> goto out_kfree;
> }
> - gpio_direction_output(aat2870->en_pin, 1);
> }
>
> aat2870_enable(aat2870);
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 4/4] mfd: twl6040-core: Use gpio_request_one
2011-12-01 8:18 ` Axel Lin
@ 2011-12-01 9:10 ` Igor Grinberg
0 siblings, 0 replies; 10+ messages in thread
From: Igor Grinberg @ 2011-12-01 9:10 UTC (permalink / raw)
To: axel.lin
Cc: linux-kernel, Misael Lopez Cruz, Jorge Eduardo Candelaria, Samuel Ortiz
On 12/01/11 10:18, Axel Lin wrote:
> 2011/12/1 Igor Grinberg <grinberg@compulab.co.il>:
>> On 12/01/11 03:55, Axel Lin wrote:
>>> Use gpio_request_one() instead of multiple gpiolib calls.
>>>
>>> Signed-off-by: Axel Lin <axel.lin@gmail.com>
>>> ---
>>> drivers/mfd/twl6040-core.c | 7 ++-----
>>> 1 files changed, 2 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c
>>> index 268f80f..e57b1d1 100644
>>> --- a/drivers/mfd/twl6040-core.c
>>> +++ b/drivers/mfd/twl6040-core.c
>>> @@ -509,13 +509,10 @@ static int __devinit twl6040_probe(struct platform_device *pdev)
>>> twl6040->audpwron = -EINVAL;
>>>
>>> if (gpio_is_valid(twl6040->audpwron)) {
>>> - ret = gpio_request(twl6040->audpwron, "audpwron");
>>> + ret = gpio_request_one(twl6040->audpwron, GPIOF_OUT_INIT_LOW,
>>> + "audpwron");
>>> if (ret)
>>> goto gpio1_err;
>>> -
>>> - ret = gpio_direction_output(twl6040->audpwron, 0);
>>> - if (ret)
>>> - goto gpio2_err;
>>> }
>>
>> same here, double check gpio_is_valid()?
>
> In the case of
> twl6040->audpwron = -EINVAL; ( see line 509 )
> gpio_is_valid returns false, we just don't request gpio.
>
> If we remove the gpio_is_valid checking here,
> then gpio_request_one will return -EINVAL.
> Then the code always goes to the error path if twl6040->audpwron is -EINVAL.
Thanks for the explanation.
So the GPIO is optional - now it makes sense to me.
--
Regards,
Igor.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] mfd: aat2870-core: Use gpio_request_one
2011-12-01 1:47 [PATCH 1/4] mfd: aat2870-core: Use gpio_request_one Axel Lin
` (3 preceding siblings ...)
2011-12-01 8:38 ` [PATCH 1/4] mfd: aat2870-core: " Jinyoung Park
@ 2011-12-19 11:13 ` Samuel Ortiz
4 siblings, 0 replies; 10+ messages in thread
From: Samuel Ortiz @ 2011-12-19 11:13 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Jin Park
Hi Axel,
On Thu, Dec 01, 2011 at 09:47:54AM +0800, Axel Lin wrote:
> Use gpio_request_one() instead of multiple gpiolib calls.
All 4 patches applied, thanks.
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-12-19 11:08 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-01 1:47 [PATCH 1/4] mfd: aat2870-core: Use gpio_request_one Axel Lin
2011-12-01 1:49 ` [PATCH 2/4] mfd: dm355evm_msp: " Axel Lin
2011-12-01 1:53 ` [PATCH 3/4] mfd: omap-usb-host: " Axel Lin
2011-12-01 8:02 ` Igor Grinberg
2011-12-01 1:55 ` [PATCH 4/4] mfd: twl6040-core: " Axel Lin
2011-12-01 8:02 ` Igor Grinberg
2011-12-01 8:18 ` Axel Lin
2011-12-01 9:10 ` Igor Grinberg
2011-12-01 8:38 ` [PATCH 1/4] mfd: aat2870-core: " Jinyoung Park
2011-12-19 11:13 ` Samuel Ortiz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.