From patchwork Sat Feb 23 17:56:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Stuebner X-Patchwork-Id: 222741 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 10B662C02B0 for ; Sun, 24 Feb 2013 04:56:41 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757168Ab3BWR4j (ORCPT ); Sat, 23 Feb 2013 12:56:39 -0500 Received: from gloria.sntech.de ([95.129.55.99]:55902 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756488Ab3BWR4j (ORCPT ); Sat, 23 Feb 2013 12:56:39 -0500 Received: from 178-25-111-196-dynip.superkabel.de ([178.25.111.196] helo=marty.localnet) by gloria.sntech.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1U9JKu-0006Cl-L3; Sat, 23 Feb 2013 18:56:36 +0100 From: Heiko =?utf-8?q?St=C3=BCbner?= To: Linus Walleij , Wolfram Sang Subject: [PATCH] pinctrl: return real error codes when pinctrl is not included Date: Sat, 23 Feb 2013 18:56:34 +0100 User-Agent: KMail/1.13.7 (Linux/3.2.0-3-686-pae; KDE/4.8.4; i686; ; ) Cc: linux-kernel@vger.kernel.org, Kukjin Kim , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-i2c@vger.kernel.org, Tomasz Figa References: <201302231855.47560.heiko@sntech.de> In-Reply-To: <201302231855.47560.heiko@sntech.de> MIME-Version: 1.0 Message-Id: <201302231856.35083.heiko@sntech.de> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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 --- 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)