Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4712796rdh; Wed, 29 Nov 2023 08:37:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IF6zfQKQY//WllmMD9HuNRkWBuCAZEkzeh2VmkDu96M1xc0iohov0VCCGb0Bl5MLg56Juo+ X-Received: by 2002:a17:90b:314a:b0:285:a4f9:4595 with SMTP id ip10-20020a17090b314a00b00285a4f94595mr17203816pjb.43.1701275877428; Wed, 29 Nov 2023 08:37:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701275877; cv=none; d=google.com; s=arc-20160816; b=HwbgZ9aoB4QQL3jo1bxpqjOwgwFTWGmb9Lw5zLgtyMBtpS5y7JPof8NE6nJRXoaNnn C4zoqh209yH28SeOlShk2vfQHNfPvi55FeDjLAB4RGrp78ACh8Ap0VDCZgkQriGUbXM4 qymY+EAIOyX/LZEa5thbcbAwOwXMlEefxP4ZRa8jt7IC0HkjMfLlwvD+Kmp8rSry8d3v m/wIpkEDQjXk4k8IzhnQHDH6buxd6GZFRhx7GjKHl7DUGT+Oh5YTvBmtlYzDeI/XPlWf 6V0awQ4Hfk5Dko8kWGMMkDUtd9RE2qphK5iW6PjVPbVqnPoWtquhwHl+rD+9hdLMDaaq aJqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NEqUrySQxiqBK2Xf7e40ptVb8/7simBVDiwRFnhyJTI=; fh=LHVfHqkxtSfhDK3Auz+HtR9CGNiwZCQHjp1a868hmsY=; b=R44J8SmrpOQfr1FA/kqgRUXhs/UrW+gOhXGPWex5WsicfwelPXtPVdSepvAMO9J0vX CnXhs69ZuvQNHLyvePfhyVZ3g9k2hGcdzD7cHxPNKag3RPnXlS+7cLzbCFdxvEN22jVO n5mwJuKYcMHnnTx41rdczvjB7zjJJr0ZGVLq8PGTnvqrQWC/Fy6+a6sD4ykoM2+C//ke YfaheYGbCye+8ooXjtMi5/ZPc4pGpCEkle0QN8L1KcCM45JBjhf4YvtjBAAfc2jFKBoC iuDKD5vXA7nLzetWDJQcq12H4cjBQeRKhDMyMkz0Gd3AdrVTghEmMKMFx9OlWuzIUp+K swfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="SXq/ud+x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id z12-20020a17090ad78c00b002800fffeb61si1645131pju.5.2023.11.29.08.37.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 08:37:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="SXq/ud+x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3CA48802FA6C; Wed, 29 Nov 2023 08:37:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230493AbjK2Qhl (ORCPT + 99 others); Wed, 29 Nov 2023 11:37:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbjK2Qhg (ORCPT ); Wed, 29 Nov 2023 11:37:36 -0500 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 415E5D66 for ; Wed, 29 Nov 2023 08:37:42 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 5DF1FC0008; Wed, 29 Nov 2023 16:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701275861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NEqUrySQxiqBK2Xf7e40ptVb8/7simBVDiwRFnhyJTI=; b=SXq/ud+xRr+okUa1SU0hm65e4dwhrGCGmtXAmtbdIfDDODRbwMHu3+au+k9EscP3WiD4/y DaHuw4AR1q2u/215u0O8ZyIXuwSqyM3zPVI2/KdlsoCqRkfa7iv+r3Jyuq35FT13eoB09r 5sjZDc+XF9L5Sa3ez7WnL7cwrzTe91yAZMspzJK2uzhNK/7tU32TWGeuMsPv7EUPikXRfZ SzzSj2wxX1cMr411KbPaO9f1tnxkdF8F61TGc9G1UTm2dFZyh5o5MdDevXpOsag48ienZC IL7ZI1DsVZLYB+TeKTyHSitzJjpUUOQTgT3BRYc0tmWEgQ45wIR+NU+qh7e5ig== From: Miquel Raynal To: Srinivas Kandagatla , Greg Kroah-Hartman , Cc: Thomas Petazzoni , Robert Marko , Luca Ceresoli , Michael Walle , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Marco Felsch , Randy Dunlap , Chen-Yu Tsai , Daniel Golle , Miquel Raynal Subject: [PATCH v14 2/8] nvmem: Move of_nvmem_layout_get_container() in another header Date: Wed, 29 Nov 2023 17:37:31 +0100 Message-Id: <20231129163737.698317-3-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231129163737.698317-1-miquel.raynal@bootlin.com> References: <20231129163737.698317-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: miquel.raynal@bootlin.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 29 Nov 2023 08:37:56 -0800 (PST) nvmem-consumer.h is included by consumer devices, extracting data from NVMEM devices whereas nvmem-provider.h is included by devices providing NVMEM content. The only users of of_nvmem_layout_get_container() outside of the core are layout drivers, so better move its prototype to nvmem-provider.h. While we do so, we also move the kdoc associated with the function to the header rather than the .c file. Signed-off-by: Miquel Raynal --- drivers/nvmem/core.c | 8 -------- include/linux/nvmem-consumer.h | 7 ------- include/linux/nvmem-provider.h | 21 +++++++++++++++++++++ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 608b352a7d91..b5b6ec8e04bb 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -847,14 +847,6 @@ static int nvmem_add_cells_from_layout(struct nvmem_device *nvmem) } #if IS_ENABLED(CONFIG_OF) -/** - * of_nvmem_layout_get_container() - Get OF node to layout container. - * - * @nvmem: nvmem device. - * - * Return: a node pointer with refcount incremented or NULL if no - * container exists. Use of_node_put() on it when done. - */ struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem) { return of_get_child_by_name(nvmem->dev.of_node, "nvmem-layout"); diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index 6ec4b9743e25..2d306fa13b1a 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -247,7 +247,6 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, const char *id); struct nvmem_device *of_nvmem_device_get(struct device_node *np, const char *name); -struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem); #else static inline struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, const char *id) @@ -260,12 +259,6 @@ static inline struct nvmem_device *of_nvmem_device_get(struct device_node *np, { return ERR_PTR(-EOPNOTSUPP); } - -static inline struct device_node * -of_nvmem_layout_get_container(struct nvmem_device *nvmem) -{ - return NULL; -} #endif /* CONFIG_NVMEM && CONFIG_OF */ #endif /* ifndef _LINUX_NVMEM_CONSUMER_H */ diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h index e3930835235b..e5de21516387 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -244,6 +244,27 @@ nvmem_layout_get_match_data(struct nvmem_device *nvmem, #endif /* CONFIG_NVMEM */ +#if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) + +/** + * of_nvmem_layout_get_container() - Get OF node of layout container + * + * @nvmem: nvmem device + * + * Return: a node pointer with refcount incremented or NULL if no + * container exists. Use of_node_put() on it when done. + */ +struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem); + +#else /* CONFIG_NVMEM && CONFIG_OF */ + +static inline struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem) +{ + return NULL; +} + +#endif /* CONFIG_NVMEM && CONFIG_OF */ + #define module_nvmem_layout_driver(__layout_driver) \ module_driver(__layout_driver, nvmem_layout_register, \ nvmem_layout_unregister) -- 2.34.1