From patchwork Thu Dec 6 12:43:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 153015 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp10479263ljp; Thu, 6 Dec 2018 04:44:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/WYPDNjSBWnmbZoeX3nxl3M2gxVZlFaZnjklg4DT9AxnniiLdh+HDCzitalEYDjwAfvsVeE X-Received: by 2002:a62:7e13:: with SMTP id z19mr28330103pfc.94.1544100259041; Thu, 06 Dec 2018 04:44:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544100259; cv=none; d=google.com; s=arc-20160816; b=nHLoPxZJ0w6e4oG04hQheYyyheTgwvdQqkVnggK99ZQ+ARRVss/cvV6G4tibMkmdK2 3F8vQLe0tob8ORq4SyzJK0asOcNFmAO9grVv45IoEgE1+f+d+IMOoo041XGnpRs49GNZ W6NyEhRO76Z7Yt6kn6MUA9KaEr2mjpeQFWDZb0jpVktZXWPDKpw3OBW1NsXxS0+hCB9n xeTDr+pXvAOP52ZIMMwthK+F6mzU0OJFyIroQIIhX5R0GO03gakqYtROD2sr7QBmMVPZ 6a6JMFnP1j4hZD9f55ZiwdqXTokcPZXqQJbM84druR8aYnCw8UXnkGaHSLXiY+TfFTBb l0fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=w6Ox8Mcvx6qj2ecBv6EZkuh7tLbIfkFEDjl421pVmOo=; b=kLb/PfON5AST2rHC9zRXWAnhF7HxpWoHAxfw2BvJYPIbGfQJgFzD8mDzNuZ7WpKqdk vqno8QRCTzesHxRhnY7gDovAPjcIlpmd/CNfQvLO2nRQYvOu/WK4QgVf9x6crUemhcCg pCFKEhcywED69rInqnAFS2x1kyhLNsxe3JD+c1o8O4+hZGJO8fcn183ZHY//1bTjnQar YFAUYujaN1mf3Zpxbdva4gLwyqdEiSykrIHUYbTGgmyOmQ7YdC9WJ+f1gGV0ndmeqJhE l+VLtL6FHmGwaXjovigGGOI37vW+hbhqOvkt6UfHLwu2c97W/T1sTbXJNyGUiWPTyzJZ +tUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Exs3l52N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si190892pgl.528.2018.12.06.04.44.18; Thu, 06 Dec 2018 04:44:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Exs3l52N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729563AbeLFMoR (ORCPT + 31 others); Thu, 6 Dec 2018 07:44:17 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:35143 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729654AbeLFMoO (ORCPT ); Thu, 6 Dec 2018 07:44:14 -0500 Received: by mail-lj1-f193.google.com with SMTP id x85-v6so306098ljb.2 for ; Thu, 06 Dec 2018 04:44:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w6Ox8Mcvx6qj2ecBv6EZkuh7tLbIfkFEDjl421pVmOo=; b=Exs3l52NznD1n7lUvDbYRlz83GaegJEOGuuT2CAyvobNmKs23nhCZ9PQf1619Xslnx 5Aj77Y++cxygbOfwBS0zSPPvOXl6LEFDZ28QEXFwYBzd2tZ+xS17KTpWJSsaE5FqtCuY 4gORsEiBnZzcM4yheYQlYacST6D65sWcHB/LE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w6Ox8Mcvx6qj2ecBv6EZkuh7tLbIfkFEDjl421pVmOo=; b=DCsHTQgVWlw98CvJoqjS1bMk1L6X2jhBI1//izkZGKZTHL/jdc5IzA9ra7Qi/amKhQ wGQABK2trrXbxaMH77yXDzxHA2iDRoyukLNSBbXALPUIFJpkGwbXlKXkf3T+8ydXyeUr 1EI/hhEyGLduXH3JmUFF2ZFLMZ/iiv9nX7H3ymKZZacF5akcAAoI4WHWRYL0ECl8yr8Y mcqZJBpHJGM3oLdloMllTJCCwYHAFNuUlhTV0fLflmWFnZXxEMXtnB3To5nHQbXRU6jv HDx7+4D0xgX5EeBJYvXMLq6xE7UtFi/+3rUK4oB8xsjACLkDOZaTQ3pskPeJ1qCCuEo/ UKEw== X-Gm-Message-State: AA+aEWY5w0vMI2pUgVo3ch7RLyYeqc856kLu0bLlLgf8FBOgZXyZoIA+ Sv3CWbDmxJapxY7raoAdzP9H6g== X-Received: by 2002:a2e:9059:: with SMTP id n25-v6mr18270637ljg.155.1544100252514; Thu, 06 Dec 2018 04:44:12 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id j25-v6sm44071lji.77.2018.12.06.04.44.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Dec 2018 04:44:11 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Marek Szyprowski , Linus Walleij Subject: [PATCH 06/15 v4] gpio: Export gpiod_get_from_of_node() Date: Thu, 6 Dec 2018 13:43:42 +0100 Message-Id: <20181206124351.10155-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181206124351.10155-1-linus.walleij@linaro.org> References: <20181206124351.10155-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This function already exist inside gpiolib, we were just reluctant to make it available to the kernel at large as the devm_* seemed to be enough for anyone. However we found out that regulators need to do their own lifecycle/refcounting on GPIO descriptors and explicitly call gpiod_put() when done with a descriptor, so export this function so we can hand the refcounting over to the regulator core for these descriptors after retrieveal. Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Resending. ChangeLog v2->v3: - Resending. ChangeLog v1->v2: - Resending --- drivers/gpio/gpiolib.h | 6 ------ include/linux/gpio/consumer.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 6 deletions(-) -- 2.19.2 diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 087d865286a0..bc57f0dc5953 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -201,12 +201,6 @@ int gpiod_set_array_value_complex(bool raw, bool can_sleep, struct gpio_array *array_info, unsigned long *value_bitmap); -/* This is just passed between gpiolib and devres */ -struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, - const char *propname, int index, - enum gpiod_flags dflags, - const char *label); - extern struct spinlock gpio_lock; extern struct list_head gpio_devices; diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index f2f887795d43..348885f2f3d3 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -172,6 +172,10 @@ int desc_to_gpio(const struct gpio_desc *desc); struct device_node; struct fwnode_handle; +struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, + const char *propname, int index, + enum gpiod_flags dflags, + const char *label); struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, struct device_node *node, const char *propname, int index, @@ -517,6 +521,15 @@ static inline int desc_to_gpio(const struct gpio_desc *desc) struct device_node; struct fwnode_handle; +static inline +struct gpio_desc *gpiod_get_from_of_node(struct device_node *node, + const char *propname, int index, + enum gpiod_flags dflags, + const char *label) +{ + return ERR_PTR(-ENOSYS); +} + static inline struct gpio_desc *devm_gpiod_get_from_of_node(struct device *dev, struct device_node *node,