linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] driver: base: pinctrl: return error from, pinctrl_bind_pins()
@ 2016-09-14  6:34 Deepak Das
  2016-09-14 12:39 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Deepak Das @ 2016-09-14  6:34 UTC (permalink / raw)
  To: Linus Walleij; +Cc: vzapolsk, linux-gpio, linux-kernel

strict pin controller returns -EINVAL in case of pin request which
is already claimed by somebody else.
Following is the sequence of calling pin_request() from
pinctrl_bind_pins():-
pinctrl_bind_pins()->pinctrl_select_state()->pinmux_enable_setting()->
pin_request()

But pinctrl_bind_pins() only returns -EPROBE_DEFER which makes device
driver probe successful even if the pin request is rejected by the pin
controller subsystem.

This commit modifies pinctrl_bind_pins() to return error if the pin is
rejected by pin control subsystem.

Signed-off-by: Deepak Das <deepak_das@mentor.com>
---
Changes from v1 to v2:
* Modified the comment to indicate return error in case of
   invalid pin requests

  drivers/base/pinctrl.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/pinctrl.c b/drivers/base/pinctrl.c
index 5fb74b4..12f0eb5 100644
--- a/drivers/base/pinctrl.c
+++ b/drivers/base/pinctrl.c
@@ -80,8 +80,8 @@ cleanup_alloc:
         devm_kfree(dev, dev->pins);
         dev->pins = NULL;

-       /* Only return deferrals */
-       if (ret != -EPROBE_DEFER)
+       /* Return deferrals & invalid pin requests */
+       if ((ret != -EPROBE_DEFER) && (ret != -EINVAL))
                 ret = 0;

         return ret;
--
1.9.1

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

* Re: [PATCH v2] driver: base: pinctrl: return error from, pinctrl_bind_pins()
  2016-09-14  6:34 [PATCH v2] driver: base: pinctrl: return error from, pinctrl_bind_pins() Deepak Das
@ 2016-09-14 12:39 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2016-09-14 12:39 UTC (permalink / raw)
  To: Deepak Das; +Cc: vzapolsk, linux-gpio, linux-kernel

On Wed, Sep 14, 2016 at 8:34 AM, Deepak Das <deepak_das@mentor.com> wrote:

> Changes from v1 to v2:
> * Modified the comment to indicate return error in case of
>   invalid pin requests

I already applied something similar, the semantics should be the
same. (Your patch, just edited around with it.)

Yours,
Linus Walleij

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

end of thread, other threads:[~2016-09-14 12:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-14  6:34 [PATCH v2] driver: base: pinctrl: return error from, pinctrl_bind_pins() Deepak Das
2016-09-14 12:39 ` Linus Walleij

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