From patchwork Wed Oct 11 11:15:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 151292 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp460257vqb; Wed, 11 Oct 2023 04:16:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGX9wS1QjERgdOE0JfJOE0LA8vJOyQlW/0nqX04LN3lwKnikRitIjkHrRbOQ3NBh58u8XhW X-Received: by 2002:a17:90a:43c2:b0:278:f656:ca0e with SMTP id r60-20020a17090a43c200b00278f656ca0emr18548940pjg.0.1697023011359; Wed, 11 Oct 2023 04:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697023011; cv=none; d=google.com; s=arc-20160816; b=DjCt+otQfYOG2Nhz/EqW+NCZyhDVy8dV1Rrbn0YI9LeDu6tyReIYejSDsdjkzoxWti o76NuoeFF2oucR+uY6flaPOIhaAPSf3oI58cUG/bhlTOaDS4htezm4b7qGtSwz0xA9AE eQ0nECbCYeFy7rpKynBlTfFl41zoaMzwnFbyrA2ckngvQClfFgVvdj7uEDqV2gHWsjtm LO/qEBitawbwj/jo0N4UFlRweleyFNp20mgl4wH0KVWPRzv0Xcm5Vy3tC5vtPQwhTnyy dqbULmiKHnOvdMd+fGxJu+lkV5DyQAvs2SVUwpd4/rFqU2GK76OE3Kypfw9usAPzJtJp EunA== 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=EWJphzkvsBfSMHYq9wGyiA3n29gzaJOgdTbtajkF/ws=; fh=XQzgxiPMj/Cqsom9sWl23DkvcXkGD6r/vx0NuuBn5R0=; b=pa+i3ZuZ+Zb6hUVev9Ya5yzaCsZ2anBOiypTGf6CHd0VOGhopQJui0kJGGRN1LiKmU 0BWc6CrzRWYLbyHODq+NmUbSinH0KjKHYJ3UYRj1ALkwre94fDUP2I/1qHpqfH/WpwHY 4VNkTLPBZduGJK00b9g/JfYjK+DWsMAmqFG8vHsO6PFgDHJZlfzBhzJH/7iZQqiIEoGw 8ZPw+vIrBFzktZuNUNKjdonGZaWReSxRHchCteDqEMmzyjOX9vNyv07UcSEFP4eSmSv3 HOLjmTvjWdgsciYjxBhblQgxyDB/2JCB4chC3iJspX4YBb8Qo2nt/0HnJIAgyhBx+jmR iiEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="ETQ80/3N"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id q41-20020a17090a17ac00b0027455c727f5si13729904pja.84.2023.10.11.04.16.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 04:16:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="ETQ80/3N"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 02D8C816539A; Wed, 11 Oct 2023 04:16:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346031AbjJKLPt (ORCPT + 18 others); Wed, 11 Oct 2023 07:15:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345945AbjJKLPj (ORCPT ); Wed, 11 Oct 2023 07:15:39 -0400 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89F5AA7; Wed, 11 Oct 2023 04:15:37 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id AFF7B1C000D; Wed, 11 Oct 2023 11:15:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1697022936; 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=EWJphzkvsBfSMHYq9wGyiA3n29gzaJOgdTbtajkF/ws=; b=ETQ80/3NCigpiqIOmCoT2N5EM4fH22WgGKFhuBHealajufHyq8NiTpCSG+3rneaoSou6u/ UsxTMwHQTGzZZRs2RTY9lmw4WBBZHmUU5P+z4DFNRW4E2+RSaLGchATp2wN0WuL/CGJE1P qK9Dev0yi10dT/3cWpnLqPui1r7FRbuj/YS+pyFWdB1slsTiAtb0Egl5X0C7IXQ/Sj1jOl UCfY1kVzHcsDCjakgyPqVhBGzP7VUnU8mBl7ll/uYU099eIGzghKzh6vs2B5ER3z/zueGT Ta/Y2ILDKQaEvRplm9B/IVeMQPoxA9uKmG8LxJ+3Qdb2gpWr2YoqrFd3FrSBjQ== From: Miquel Raynal To: Srinivas Kandagatla , Greg Kroah-Hartman Cc: Michael Walle , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Rob Herring , Frank Rowand , devicetree@vger.kernel.org, , Robert Marko , Thomas Petazzoni , Luka Perkov , Randy Dunlap , Chen-Yu Tsai , Daniel Golle , Miquel Raynal Subject: [PATCH v13 2/6] nvmem: Move of_nvmem_layout_get_container() in another header Date: Wed, 11 Oct 2023 13:15:25 +0200 Message-Id: <20231011111529.86440-3-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231011111529.86440-1-miquel.raynal@bootlin.com> References: <20231011111529.86440-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: miquel.raynal@bootlin.com X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Wed, 11 Oct 2023 04:16:39 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779457601340377056 X-GMAIL-MSGID: 1779457601340377056 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 | 14 ++++++++++++++ 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index eaf6a3fe8ca6..93b867b3cdf9 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -841,14 +841,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 4523e4e83319..960728b10a11 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -241,7 +241,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) @@ -254,12 +253,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 dae26295e6be..2905f9e6fc2a 100644 --- a/include/linux/nvmem-provider.h +++ b/include/linux/nvmem-provider.h @@ -205,6 +205,16 @@ void nvmem_layout_unregister(struct nvmem_layout *layout); const void *nvmem_layout_get_match_data(struct nvmem_device *nvmem, struct nvmem_layout *layout); +/** + * 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 static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c) @@ -242,6 +252,10 @@ nvmem_layout_get_match_data(struct nvmem_device *nvmem, return NULL; } +static inline struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem) +{ + return NULL; +} #endif /* CONFIG_NVMEM */ #define module_nvmem_layout_driver(__layout_driver) \