diff mbox

pinctrl: consumer: use correct retval for placeholder functions

Message ID 1418723959-10253-1-git-send-email-wsa@the-dreams.de (mailing list archive)
State Rejected
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Wolfram Sang Dec. 16, 2014, 9:59 a.m. UTC
From: Wolfram Sang <wsa+renesas@sang-engineering.com>

These functions are supposed to return an error pointer, not NULL.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 include/linux/pinctrl/consumer.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Linus Walleij Jan. 13, 2015, 8:56 a.m. UTC | #1
On Tue, Dec 16, 2014 at 10:59 AM, Wolfram Sang <wsa@the-dreams.de> wrote:

> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> These functions are supposed to return an error pointer, not NULL.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Worried that some driver may depend on this behaviour, but
patch applied anyway, let's deal with it.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang Feb. 9, 2015, 3 p.m. UTC | #2
Hi Linus,

> > From: Wolfram Sang <wsa+renesas@sang-engineering.com>
> >
> > These functions are supposed to return an error pointer, not NULL.
> >
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> Worried that some driver may depend on this behaviour, but
> patch applied anyway, let's deal with it.

I sent a similar patch to Russell for the clk API and he rightfully
NAKed it. NULL is a valid cookie from clk_get and the whole clk API is
able to deal with NULL. That ensures that for !HAVE_CLK, clk_get is
still successful and won't fail driver_probe while the other clk API
functions don't really do anything. If the gpio API is similar to that,
we should revert my patch.

Sorry for the nuisance,

   Wolfram
Linus Walleij March 5, 2015, 9:10 a.m. UTC | #3
On Mon, Feb 9, 2015 at 4:00 PM, Wolfram Sang <wsa@the-dreams.de> wrote:
> Hi Linus,
>
>> > From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>> >
>> > These functions are supposed to return an error pointer, not NULL.
>> >
>> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>>
>> Worried that some driver may depend on this behaviour, but
>> patch applied anyway, let's deal with it.
>
> I sent a similar patch to Russell for the clk API and he rightfully
> NAKed it. NULL is a valid cookie from clk_get and the whole clk API is
> able to deal with NULL. That ensures that for !HAVE_CLK, clk_get is
> still successful and won't fail driver_probe while the other clk API
> functions don't really do anything. If the gpio API is similar to that,
> we should revert my patch.

OK reverted for fixes, no big deal.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index e96eea7a835c..5e949122529d 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -83,7 +83,7 @@  static inline int pinctrl_gpio_direction_output(unsigned gpio)
 
 static inline struct pinctrl * __must_check pinctrl_get(struct device *dev)
 {
-	return NULL;
+	return ERR_PTR(-ENOSYS);
 }
 
 static inline void pinctrl_put(struct pinctrl *p)
@@ -94,7 +94,7 @@  static inline struct pinctrl_state * __must_check pinctrl_lookup_state(
 							struct pinctrl *p,
 							const char *name)
 {
-	return NULL;
+	return ERR_PTR(-ENOSYS);
 }
 
 static inline int pinctrl_select_state(struct pinctrl *p,
@@ -109,7 +109,7 @@  static inline void pinctrl_deselect_state(struct pinctrl *p)
 
 static inline struct pinctrl * __must_check devm_pinctrl_get(struct device *dev)
 {
-	return NULL;
+	return ERR_PTR(-ENOSYS);
 }
 
 static inline void devm_pinctrl_put(struct pinctrl *p)