[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ED73481.2010904@compulab.co.il>
Date: Thu, 01 Dec 2011 10:02:09 +0200
From: Igor Grinberg <grinberg@...pulab.co.il>
To: Axel Lin <axel.lin@...il.com>
CC: linux-kernel@...r.kernel.org,
Keshava Munegowda <keshava_mgowda@...com>,
Samuel Ortiz <sameo@...ux.intel.com>
Subject: Re: [PATCH 3/4] mfd: omap-usb-host: Use gpio_request_one
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@...il.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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists