From: heiko@sntech.de (Heiko Stübner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] pinctrl: return real error codes when pinctrl is not included
Date: Sat, 23 Feb 2013 18:56:34 +0100 [thread overview]
Message-ID: <201302231856.35083.heiko@sntech.de> (raw)
In-Reply-To: <201302231855.47560.heiko@sntech.de>
Currently the fallback functions when pinctrl is not being built do
return either NULL or 0, either no pinctrl handle or no error,
making them fail silently.
All drivers using pinctrl do only test for error conditions, which
made for example the i2c-s3c2410 driver fail on a devicetree based
machine without pinctrl, as the conditional
if (IS_ERR(i2c->pctrl) && s3c24xx_i2c_parse_dt_gpio(i2c))
did not reach the second part to initialize the gpios from dt.
Therefore let the fallback pinctrl functions return -ENOTSUPP
or the equivalent ERR_PTR to indicate that pinctrl is not supported.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
include/linux/pinctrl/consumer.h | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
index 4aad3ce..69d145f 100644
--- a/include/linux/pinctrl/consumer.h
+++ b/include/linux/pinctrl/consumer.h
@@ -44,7 +44,7 @@ extern void devm_pinctrl_put(struct pinctrl *p);
static inline int pinctrl_request_gpio(unsigned gpio)
{
- return 0;
+ return -ENOTSUPP;
}
static inline void pinctrl_free_gpio(unsigned gpio)
@@ -53,17 +53,17 @@ static inline void pinctrl_free_gpio(unsigned gpio)
static inline int pinctrl_gpio_direction_input(unsigned gpio)
{
- return 0;
+ return -ENOTSUPP;
}
static inline int pinctrl_gpio_direction_output(unsigned gpio)
{
- return 0;
+ return -ENOTSUPP;
}
static inline struct pinctrl * __must_check pinctrl_get(struct device *dev)
{
- return NULL;
+ return ERR_PTR(-ENOTSUPP);
}
static inline void pinctrl_put(struct pinctrl *p)
@@ -74,18 +74,18 @@ static inline struct pinctrl_state * __must_check pinctrl_lookup_state(
struct pinctrl *p,
const char *name)
{
- return NULL;
+ return ERR_PTR(-ENOTSUPP);
}
static inline int pinctrl_select_state(struct pinctrl *p,
struct pinctrl_state *s)
{
- return 0;
+ return -ENOTSUPP;
}
static inline struct pinctrl * __must_check devm_pinctrl_get(struct device *dev)
{
- return NULL;
+ return ERR_PTR(-ENOTSUPP);
}
static inline void devm_pinctrl_put(struct pinctrl *p)
--
1.7.2.3
next prev parent reply other threads:[~2013-02-23 17:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-23 17:55 [PATCH] pinctrl or i2c-s3c2410: fix pinctrl NULL return values in stubs Heiko Stübner
2013-02-23 17:56 ` Heiko Stübner [this message]
2013-02-24 0:40 ` [PATCH] pinctrl: return real error codes when pinctrl is not included Linus Walleij
2013-02-24 22:34 ` Heiko Stübner
2013-02-24 22:42 ` Linus Walleij
2013-02-24 23:15 ` Heiko Stübner
2013-02-23 17:57 ` [PATCH] i2c: s3c2410: check for NULL pinctrl handle Heiko Stübner
2013-02-24 0:16 ` Linus Walleij
2013-02-24 0:38 ` Tomasz Figa
2013-02-24 0:47 ` Linus Walleij
2013-02-24 0:58 ` Tomasz Figa
2013-02-24 1:01 ` Linus Walleij
2013-02-24 17:00 ` Tomasz Figa
2013-02-24 22:39 ` Linus Walleij
2013-02-24 23:16 ` Heiko Stübner
2013-02-25 0:02 ` Tomasz Figa
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=201302231856.35083.heiko@sntech.de \
--to=heiko@sntech.de \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).