pinctrl: return real error codes when pinctrl is not included

A patch from »pinctrl or i2c-s3c2410: fix pinctrl NULL return values in stubs« in state Obsolete for linux-kernel

From: Heiko Stuebner <heiko@...> Date: Sat, 23 Feb 2013 18:07:46 +0100

Commit-Message

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

Patch-Comment

include/linux/pinctrl/consumer.h | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)

Statistics

  • 7 lines added
  • 7 lines removed

Changes

----------------------- include/linux/pinctrl/consumer.h -----------------------
index 4aad3ce..69d145f 100644
@@ -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)
 
 

Recent Patches

About Us

Sed lacus. Donec lectus. Nullam pretium nibh ut turpis. Nam bibendum. In nulla tortor, elementum vel, tempor at, varius non, purus. Mauris vitae nisl nec metus placerat consectetuer.

Read More...