From patchwork Mon Oct 6 20:17:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Pargmann X-Patchwork-Id: 5039511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B5811C11AC for ; Mon, 6 Oct 2014 20:20:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E308F2017A for ; Mon, 6 Oct 2014 20:20:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9337B2015E for ; Mon, 6 Oct 2014 20:20:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XbEju-0000zL-RM; Mon, 06 Oct 2014 20:18:38 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XbEjp-0000pV-JD for linux-arm-kernel@lists.infradead.org; Mon, 06 Oct 2014 20:18:34 +0000 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1XbEj5-0006r1-JO; Mon, 06 Oct 2014 22:17:47 +0200 Received: from mpa by dude.hi.pengutronix.de with local (Exim 4.84) (envelope-from ) id 1XbEj4-0003LT-FM; Mon, 06 Oct 2014 22:17:46 +0200 From: Markus Pargmann To: Mark Brown Subject: [PATCH 1/5] regulator: Add ena_gpio_valid config Date: Mon, 6 Oct 2014 22:17:11 +0200 Message-Id: <1412626635-7404-2-git-send-email-mpa@pengutronix.de> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1412626635-7404-1-git-send-email-mpa@pengutronix.de> References: <1412626635-7404-1-git-send-email-mpa@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: mpa@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141006_131833_847725_F877F4C7 X-CRM114-Status: GOOD ( 13.75 ) X-Spam-Score: -0.0 (/) Cc: kernel@pengutronix.de, Markus Pargmann , Liam Girdwood , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Most drivers do not set the ena_gpio field of struct regulator_config before passing it to the regulator core. This is fine as long as the gpio identifier that is passed is a positive integer. But the gpio identifier 0 is also valid. So we are not able to decide wether we got a real gpio identifier or not. To be able to decide if it is a valid gpio that got passed, this patch adds a ena_gpio_valid field that should be set if ena_gpio is a valid gpio and should be used. It is a preperation patch for multiple patches that adapt the drivers and fix the regulator core checks for this field. Signed-off-by: Markus Pargmann --- include/linux/regulator/driver.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index bbe03a1924c0..c561f0faaf61 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -292,6 +292,8 @@ struct regulator_desc { * NULL). * @regmap: regmap to use for core regmap helpers if dev_get_regulator() is * insufficient. + * @ena_gpio_valid: GPIO controlling regulator enable is valid and should be + * used. * @ena_gpio: GPIO controlling regulator enable. * @ena_gpio_invert: Sense for GPIO enable control. * @ena_gpio_flags: Flags to use when calling gpio_request_one() @@ -303,6 +305,7 @@ struct regulator_config { struct device_node *of_node; struct regmap *regmap; + bool ena_gpio_valid; int ena_gpio; unsigned int ena_gpio_invert:1; unsigned int ena_gpio_flags;