From patchwork Wed Dec 5 12:47:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152902 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp9256469ljp; Wed, 5 Dec 2018 04:48:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/VH5ilW5dWtM3CXi0jFLaE19rds83fDAo/KVFCnL4CytnUV/sDscIBEKhoYIua+spmRQIT5 X-Received: by 2002:a63:77ce:: with SMTP id s197mr20244732pgc.89.1544014115553; Wed, 05 Dec 2018 04:48:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544014115; cv=none; d=google.com; s=arc-20160816; b=LhGQkN84VA5tiXC/0N2PiQMVHk3Hd7AdpYLrdRCltMyMye+w9orZK1YOJI8z78+dsV tmwaAnKainF71awsaArpnFiqQX7+vsqcUr33MTsFKhtZSDt/iOTYpOWxW0qSQRRsKgTa nMYisGL5pm/F7kFFBbAibDYTck5hkrb/i1tBFwawrBsShI/V0zbhWw/NletuBnfvF91a sOLWjwAw4WCC83WWUXxQfdIGNGUFgWG5pbedWn51EorgcDzlxtDcULE4iy7Sp4oUDf1a meo+tYdu7eOmwOBx8FDy2jbs4L77GB87XIAvoPfTJga2eoEApcjdNqnMMhFrdM2tvmIX 8A2w== 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=wc1j/0Qq8o4SJIOdzJVRjBHOW+PSsZdnGaM6qp9lzlo=; b=ZxhVAT4+B4KF/c9VjxqttGCljb7Z22ULabuaIC75MhWb1P2Z0ID1AB9d8LzlGdHUzQ yv2dxs6+LVOK7BCGBF8UmLP8ife6IJvRpGrw/GklGm/2Uy1iphqAPBcJN6yjPhuPyRDx GTOPLAS58auV+hjvjs/2Ye3XjWDTd5vhisksqBRXPyYqF9QjuJc1xK+E/c4hziDWlxBE duhfEZIFwqjwyM0QoyMaqRUXtk30PtrxysRe9U4vk+QQZLOCv3vQFIDJBkQ8qf22pzu9 FzlA40qNHU/JPyve3Vx1J8lmewQGqsVvphaFRxrfBIaRCaXox3MKnx/NI0Rwc+lKSlx2 62yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HK7+AjO8; 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 b4si16345958pgk.350.2018.12.05.04.48.35; Wed, 05 Dec 2018 04:48:35 -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=HK7+AjO8; 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 S1728044AbeLEMsd (ORCPT + 31 others); Wed, 5 Dec 2018 07:48:33 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:42162 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727884AbeLEMrq (ORCPT ); Wed, 5 Dec 2018 07:47:46 -0500 Received: by mail-lj1-f195.google.com with SMTP id l15-v6so18197207lja.9 for ; Wed, 05 Dec 2018 04:47:44 -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=wc1j/0Qq8o4SJIOdzJVRjBHOW+PSsZdnGaM6qp9lzlo=; b=HK7+AjO8+Q+QJM1J2np4NUI70PHgLQmmlqMs/rhoNn7mW6teTjDBtS92DmX3SyNjJ+ eUSK3tUSLMVH8f/K3SNllbphg0r7+rwhP921052TwI+xUvJBMF4EBcjiQU6uaSUG59mu kRc+MHSiYcVys8DWVOCD9rg14vbp/L7Fz7o6Q= 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=wc1j/0Qq8o4SJIOdzJVRjBHOW+PSsZdnGaM6qp9lzlo=; b=q9RrgBzK3u/PptOgpbw8YQ+LbyyT6JSb3jPwbufqqrFklVZsRWSqNg9mZD3ksTLvPK YiQmw/6/syJjzeGu64sJaW04BZiIYt7i4u/Knsh3pbRt3HM3BC6WYlo/s2HGeVCnAt8N kUlEsnTkvvBQxLD96zyLZ/jmsEcoucsfbczOuMRkO5S5fRBgy1Hv5o3MKQX8KhHkyhWj /YeZiYvbU82N00bSXF8Yppqg019BW0hy47kTFfwOKv93A/Zg8DzRowfTj70NVvolgF2X wfMhgznHzqnpgeU84anuCGjOKq59/gMpSAyG6gTjtlctPccakHjR9iolheuQVVri+Abt qCdw== X-Gm-Message-State: AA+aEWbKq20YJapFxWrGCtMNe7il2BnqhjBWN2vl5s1kLTtGmffyzX2V ZlSpKKRqOPIDy33pMHLv7mWYHA== X-Received: by 2002:a2e:5054:: with SMTP id v20-v6mr15366401ljd.45.1544014064091; Wed, 05 Dec 2018 04:47:44 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id e19-v6sm3797125ljf.67.2018.12.05.04.47.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Dec 2018 04:47:43 -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 07/15 v3] gpio: Export gpiod_get_from_of_node() Date: Wed, 5 Dec 2018 13:47:13 +0100 Message-Id: <20181205124721.26624-8-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181205124721.26624-1-linus.walleij@linaro.org> References: <20181205124721.26624-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 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,