From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Wed, 16 Mar 2022 08:31:12 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nUO7k-006Hu2-Ly for lore@lore.pengutronix.de; Wed, 16 Mar 2022 08:31:12 +0100 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nUO7i-0002zv-Ue for lore@pengutronix.de; Wed, 16 Mar 2022 08:31:11 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:To:Subject:MIME-Version: Date:Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=yAhiI7In0ZiphFk+fSwEoz8aNLwP13KtbB+TFT84aZU=; b=3Wkyxz/fy0KrMv3rv7Jc794NO0 shS5UATe481P5TMDDPchqU8BAg79Q/IvQrYFoG9DT2P4zKuPDE1e0U+3uey3z6goFm/EjhzLz9HfM zKlbFLbpyHtgYS6Rl47yusUSz9UEmULBJWIoQHy0ID/VGLSRI2Yx5dqa/gEXWzoZlHCRjOc9VuRA8 pw0cwvNMnlnJdgdqY2aWl9jAimb1JtUsfHz+K1TvztJ94PWACop97FQBE/nWDIxNKqxiyRLqn+UK/ +TItO65fgBcWAfg1uKQLmYddMKxu8/GE7xRe65qot9qOEQf0DwaZZv1ljfe0X3Fg+JzR2ZCvVDJL0 5qKdKNFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUO69-00Bwmh-R9; Wed, 16 Mar 2022 07:29:33 +0000 Received: from cpanel.siel.si ([46.19.9.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUO63-00BwlL-9R for barebox@lists.infradead.org; Wed, 16 Mar 2022 07:29:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=norik.com; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=dwn1axPSm5f9COK72//q8Y4eqxZt4Oh71TF4j+Y5vUQ=; b=ZkOBWmCk4RujVF/DW8o7rKcsy9 XsK+MMNyg2/8drIR5ucziiww83hNAksSokGN6L5rntpUtKGUXw3InifXpX1M7+hhpS9k5sFwQMAKW ocUinbcY3/yadCgj1BP3PtgfxlkBtGS+Dzzgva5aUACiVjfawnAoJHrlWjnoFlUqZkamVt6El66mf 088jMLHAbJJVq34VL1939RkUkduMGltGFr476ya9m8D0K+do5GQzpoTZqmA/k8X/995lpovM5k5kw ug4PzdU3TU377UAop5ngDbEkwXyDn+/Ee2ifXq9eRN97+BPsVuBDyXZVX7p8pzSFqRbeLvuYJlgMP y5sK+N1Q==; Received: from [213.250.26.126] (port=52202 helo=[192.168.26.172]) by cpanel.siel.si with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1nUO5p-00D8y6-Qp; Wed, 16 Mar 2022 08:29:21 +0100 Message-ID: Date: Wed, 16 Mar 2022 08:29:16 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Content-Language: en-GB To: Ahmad Fatoum , barebox@lists.infradead.org References: <20220315133942.537756-1-andrej.picej@norik.com> <1f57c0be-8dab-8b6d-ac1f-7c1f5c1b0caf@pengutronix.de> From: Andrej Picej In-Reply-To: <1f57c0be-8dab-8b6d-ac1f-7c1f5c1b0caf@pengutronix.de> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpanel.siel.si X-AntiAbuse: Original Domain - lists.infradead.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - norik.com X-Get-Message-Sender-Via: cpanel.siel.si: authenticated_id: andrej.picej@norik.com X-Authenticated-Sender: cpanel.siel.si: andrej.picej@norik.com X-Source: X-Source-Args: X-Source-Dir: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220316_002927_705418_45838DA2 X-CRM114-Status: GOOD ( 11.49 ) X-BeenThere: barebox@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "barebox" X-SA-Exim-Connect-IP: 2607:7c80:54:e::133 X-SA-Exim-Mail-From: barebox-bounces+lore=pengutronix.de@lists.infradead.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.ext.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-6.3 required=4.0 tests=AWL,BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Subject: Re: [PATCH 1/2] of: implement new of_device_ensured_probed_by_alias_stem X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on metis.ext.pengutronix.de) On 15. 03. 22 15:16, Ahmad Fatoum wrote: > Hello Andrej, > > On 15.03.22 14:39, Andrej Picej wrote: >> Function first goes through all the aliases which have the given stem. >> It then ensures that all the devices hiding under these aliases are >> probed. >> >> Signed-off-by: Andrej Picej >> --- >> drivers/of/base.c | 28 ++++++++++++++++++++++++++++ >> include/of.h | 6 ++++++ >> 2 files changed, 34 insertions(+) >> >> diff --git a/drivers/of/base.c b/drivers/of/base.c >> index 80465d6d50..055dba97ab 100644 >> --- a/drivers/of/base.c >> +++ b/drivers/of/base.c >> @@ -274,6 +274,34 @@ int of_alias_get_id_from(struct device_node *root, struct device_node *np, >> } >> EXPORT_SYMBOL_GPL(of_alias_get_id_from); >> >> +/** >> + * of_device_ensured_probed_by_alias_stem - Ensure all devices with alias base name >> + * are probed >> + * @stem: Alias stem of the given device_node >> + * >> + * The function ensures all devices with the given alias stem are probed. >> + * >> + * Returns 0 on success or error code. >> + */ >> +int of_device_ensured_probed_by_alias_stem(const char *stem) >> +{ >> + struct alias_prop *app; >> + int id = -ENODEV; >> + int ret; > > Can you early exit here if (!deep_probe_is_supported())? > > This saves non-deep probe users the hassle of needless iteration > and string comparisons. > Yes of course, I forgot about that. >> + >> + list_for_each_entry(app, &aliases_lookup, link) { >> + if (of_node_cmp(app->stem, stem) != 0) >> + continue; >> + >> + ret = of_device_ensure_probed(app->np); >> + if (ret) >> + return ret; >> + } >> + >> + return 0; >> +} >> +EXPORT_SYMBOL_GPL(of_device_ensured_probed_by_alias_stem); >> + >> const char *of_alias_get(struct device_node *np) >> { >> struct alias_prop *app; >> diff --git a/include/of.h b/include/of.h >> index 216d0ee763..95817c58a4 100644 >> --- a/include/of.h >> +++ b/include/of.h >> @@ -261,6 +261,7 @@ extern void of_alias_scan(void); >> extern int of_alias_get_id(struct device_node *np, const char *stem); >> extern int of_alias_get_id_from(struct device_node *root, struct device_node *np, >> const char *stem); >> +extern int of_device_ensured_probed_by_alias_stem(const char *stem); >> extern const char *of_alias_get(struct device_node *np); >> extern int of_modalias_node(struct device_node *node, char *modalias, int len); >> >> @@ -750,6 +751,11 @@ static inline int of_alias_get_id_from(struct device_node *root, struct device_n >> return -ENOSYS; >> } >> >> +static int of_device_ensured_probed_by_aliases(const char *stem) >> +{ >> + return -ENOSYS; >> +} >> + >> static inline const char *of_alias_get(struct device_node *np) >> { >> return NULL; > > _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox