From: Alex Elder <elder@linaro.org>
To: Arvind Yadav <arvind.yadav.cs@gmail.com>,
hvaibhav.linux@gmail.com, johan@kernel.org, elder@kernel.org,
gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, greybus-dev@lists.linaro.org,
linux-kernel@vger.kernel.org
Subject: Re: [greybus-dev] [PATCH] staging: greybus: Use gpio_is_valid()
Date: Fri, 27 Apr 2018 07:17:57 -0500 [thread overview]
Message-ID: <7ebee672-6413-6f1d-fe57-2e278c90cf9e@linaro.org> (raw)
In-Reply-To: <785eda4d65f396b353393e9538eba21095ce876e.1524825902.git.arvind.yadav.cs@gmail.com>
On 04/27/2018 05:52 AM, Arvind Yadav wrote:
> Replace the manual validity checks for the GPIO with the
> gpio_is_valid().
I haven't looked through the code paths very closely, but I
think that get_named_gpio() might return -EPROBE_DEFER, which
would be something we want to pass to the caller.
So rather than returning -ENODEV and hiding the reason the
call to of_get_named_gpio() failed, you should continue
returning the errno it supplies (if not a valid gpio number).
-Alex
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> drivers/staging/greybus/arche-platform.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c
> index 83254a7..fc6bf60 100644
> --- a/drivers/staging/greybus/arche-platform.c
> +++ b/drivers/staging/greybus/arche-platform.c
> @@ -448,9 +448,9 @@ static int arche_platform_probe(struct platform_device *pdev)
> arche_pdata->svc_reset_gpio = of_get_named_gpio(np,
> "svc,reset-gpio",
> 0);
> - if (arche_pdata->svc_reset_gpio < 0) {
> + if (!gpio_is_valid(arche_pdata->svc_reset_gpio)) {
> dev_err(dev, "failed to get reset-gpio\n");
> - return arche_pdata->svc_reset_gpio;
> + return -ENODEV;
> }
> ret = devm_gpio_request(dev, arche_pdata->svc_reset_gpio, "svc-reset");
> if (ret) {
> @@ -468,9 +468,9 @@ static int arche_platform_probe(struct platform_device *pdev)
> arche_pdata->svc_sysboot_gpio = of_get_named_gpio(np,
> "svc,sysboot-gpio",
> 0);
> - if (arche_pdata->svc_sysboot_gpio < 0) {
> + if (!gpio_is_valid(arche_pdata->svc_sysboot_gpio)) {
> dev_err(dev, "failed to get sysboot gpio\n");
> - return arche_pdata->svc_sysboot_gpio;
> + return -ENODEV;
> }
> ret = devm_gpio_request(dev, arche_pdata->svc_sysboot_gpio, "sysboot0");
> if (ret) {
> @@ -487,9 +487,9 @@ static int arche_platform_probe(struct platform_device *pdev)
> arche_pdata->svc_refclk_req = of_get_named_gpio(np,
> "svc,refclk-req-gpio",
> 0);
> - if (arche_pdata->svc_refclk_req < 0) {
> + if (!gpio_is_valid(arche_pdata->svc_refclk_req)) {
> dev_err(dev, "failed to get svc clock-req gpio\n");
> - return arche_pdata->svc_refclk_req;
> + return -ENODEV;
> }
> ret = devm_gpio_request(dev, arche_pdata->svc_refclk_req,
> "svc-clk-req");
>
next prev parent reply other threads:[~2018-04-27 12:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-27 10:52 Arvind Yadav
2018-04-27 12:17 ` Alex Elder [this message]
2018-04-27 12:50 ` [greybus-dev] " Arvind Yadav
2018-04-27 13:02 ` Alex Elder
2018-04-28 4:30 ` arvindY
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7ebee672-6413-6f1d-fe57-2e278c90cf9e@linaro.org \
--to=elder@linaro.org \
--cc=arvind.yadav.cs@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=greybus-dev@lists.linaro.org \
--cc=hvaibhav.linux@gmail.com \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®