From patchwork Wed Nov 28 10:43:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152244 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp923578ljp; Wed, 28 Nov 2018 02:44:13 -0800 (PST) X-Google-Smtp-Source: AJdET5es42ofixUwcb+8Wdjg+T58YNAddXj2mZSinQHqv2kIxMvuukzMmLHdG2o9ug8g+w+aujSk X-Received: by 2002:a62:1f9d:: with SMTP id l29mr36910954pfj.14.1543401852876; Wed, 28 Nov 2018 02:44:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401852; cv=none; d=google.com; s=arc-20160816; b=AVE8pNHnJwtVqQT9gbZNtg28qH7oeYibjPfEJMwgOQvGdbnLuvdqd4rhunMFBSu+Xb fqZwl3VR9o7GcMAWfP380IFQxcAQN8ISvJbq5BkegGcz+oVyQUgeFzf9yW9nJtkUQ7aH mSi2Wk/UQanp6CvN2QkZCix2bSsuiX5c98xZv6B5LVEhe7LAwfJHJ56f6lUiMhdQHLXQ VH1e1ZlqiqUjeCTWqK+H86PpYZcdynbe7bwmVitOmh9gBYv17awZaikw1kf/MQBVSf8d gBF54Y3NEaPM9N775J8SvE6lHemHYPUTVresC3MJ4ncv5h6wIkU6z0xKpr2zeDLVH5HY +8Gw== 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=bERN1gHWFFWu4y/GIu0q47eugasKcAfYPgxYimfWOAc=; b=dnI62v7kGpW7YrJERKSaiHwL58/IrhRivW+vneNx+ixAia9zXU9AexofTfNxkqyEty yXKA6d6KdepLz2d0Spwur2IAmdGWBwIH5aFBO+Wltaz1weuAfii7sk2ffL7yqXZKb++4 X4dG04l0amgcvQszlcxOJBo3A+dmYkDXA10Zv6qluU3wS38LuzeOogtfrlf4IjXTLmC1 bhAtpQ6DFY/s/RKh2J+JX2jH9wxScSQbZRTtEE0MjDBC3RaJYMoLVGy4ZuNTDffrnfnK vjn9wgH8zyRtBIF8qtcun7/Rj7Yapt9JrNKEFmph/YUVsIcLXvs7pBqDEZv6fTFTCAgD ckpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Txmgq06A; 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 o68si7293550pfo.140.2018.11.28.02.44.12; Wed, 28 Nov 2018 02:44:12 -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=Txmgq06A; 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 S1728262AbeK1VpX (ORCPT + 32 others); Wed, 28 Nov 2018 16:45:23 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:38873 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728119AbeK1VpW (ORCPT ); Wed, 28 Nov 2018 16:45:22 -0500 Received: by mail-lf1-f65.google.com with SMTP id p86so18991209lfg.5 for ; Wed, 28 Nov 2018 02:44:09 -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=bERN1gHWFFWu4y/GIu0q47eugasKcAfYPgxYimfWOAc=; b=Txmgq06AWyWIxs4oH0GnuLdSwCl+s+vYjxdAXtWTOtv5nzK5nHs6kmoQlKhE3GBNxG PNOfSWKb0DsJu5SRz3Ty6JsYXgEEz/H0Jme0TNgcFwMHqZaVq8P6k4K1s6iMdnFc5iDC uQSZs6jI93XZ32u+34ifKWHdZ0ozCWciZ3gcI= 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=bERN1gHWFFWu4y/GIu0q47eugasKcAfYPgxYimfWOAc=; b=YTfrzd3utX4fwJjA5jB/XEXTmy6HmFYBoc6wbWAXg/Ry3geugFxIj77A3GGZ51oqdc U1VFG+9xIutIse6LRi5KqUhLM7wmWwUontEJoesiJCQTP2RylDFa3Vkz8z5ORktLf9a1 guEm9AbPOL0BChM1HF6gEN/cbXz878Uj2t+k98HQa/aUH9hnQ3nRsUzxPHA5WpHDAN1P BxMt6B3wQuCblsnHykTXcchy1kF0fkzoSM5lwhRk9ipuAQGF8/RksiSDPO4mdOnfYbT5 AbQmW2Z6jjRuJmARriqeApJPgcnw4E8WkRp/7ADpfZwAIvmRAo0EqLLeKx9Z0r+Xg117 TM6g== X-Gm-Message-State: AGRZ1gIc6tesr/RJ3QplaWzPStBX8r4AxSlI3LjfujGR84FDGZiBkJhk xPOXTa4u8tpQHT9TXJCK1AjwdQ== X-Received: by 2002:ac2:42c5:: with SMTP id n5mr20889914lfl.115.1543401848298; Wed, 28 Nov 2018 02:44:08 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id c20sm1095101lfj.67.2018.11.28.02.44.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 02:44:07 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 06/10] gpio: Export gpiod_get_from_of_node() Date: Wed, 28 Nov 2018 11:43:46 +0100 Message-Id: <20181128104350.31902-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181128104350.31902-1-linus.walleij@linaro.org> References: <20181128104350.31902-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 --- drivers/gpio/gpiolib.h | 6 ------ include/linux/gpio/consumer.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 6 deletions(-) -- 2.19.1 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,