[v4,4/4] net: ethernet: ti: davinci_mdio: Deferring probe when soc_device_match() returns NULL
Message ID | 20221108181144.433087-5-nfrayer@baylibre.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2869836wru; Tue, 8 Nov 2022 10:15:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf4qBsdca7qTwRRLFFKGzyHZMQAT7j3e2Rov70jw+pERgUulL7eGT7kTad8Ux8zKBVrDVWo5 X-Received: by 2002:a17:90a:49c9:b0:217:c5f6:4092 with SMTP id l9-20020a17090a49c900b00217c5f64092mr15995650pjm.33.1667931323992; Tue, 08 Nov 2022 10:15:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667931323; cv=none; d=google.com; s=arc-20160816; b=mWUAdNelJR82OgqtNCSzhwQDL8KDdxVb0Tqm7szgGF3zKUArQA1yoZ1cVaVYO0O2UJ PsqRjDupRcjF/AfXqbOM8RS6+FHuXRonEU7aA0G77FvqlUil6bwFJxCpPWHqax/jiJS/ p1jsfLohHMS+TCERy/k3rIJApGd2Nc30uJtnlyJSCHWc28MmEkSQh4Jh155OUaxHCIwu T0+3XuHuW4uXTKJvm5StBal0Spojb9NFeoPeVxX4NgN+RGwzMRNibHyD7BWf3ZXV8iI7 ZWWS7TCE3NcEmh9Rhz4u2EQrr83f0hD1h3TXmKdOO+RS0/B+MTX9ys+mneXBH3KuOh2G xTPw== 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=ZusLhzKKZ9ZvXwH/3HZ+FFn0DEP+Zib5GkEH1QOxmpA=; b=VcOVIHuLX5BKu6NA3oe0vgmU7G5EOzbQ56qWVkrRp76A5e5q4Kx+outdH7zQep0JT9 l8w56MBo3vi7Q4fQZOeIVv570rqYxK4/yxjSHzA7a8evGFLCsZnHc1BXbjSUFl/97B1q h+uc4M1dEJvKDPp8+H+lPA1o8mo0eo8mtZffKtEXg+ENUtbSn0jX6y+a6M0bD1AAAQc9 ktEkTwQfbSGgK3VPkqdDl52VaknxXEdOm0eqoOU54KxoqxzlKOrv7W/4tAmj4296j9NV a8wK46qbiqHhoZHii86fEJnU+JRAHhYAC4DuutYTDoRCALZjgH/vN+Y8n90KjaD8t3qy cuYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=TN4Kwq+G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d32-20020a634f20000000b00439ce36e9d3si15741256pgb.570.2022.11.08.10.15.10; Tue, 08 Nov 2022 10:15:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=TN4Kwq+G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234468AbiKHSMV (ORCPT <rfc822;tony84727@gmail.com> + 99 others); Tue, 8 Nov 2022 13:12:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234638AbiKHSME (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 8 Nov 2022 13:12:04 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3008D554FE for <linux-kernel@vger.kernel.org>; Tue, 8 Nov 2022 10:12:02 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id bs21so22291412wrb.4 for <linux-kernel@vger.kernel.org>; Tue, 08 Nov 2022 10:12:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZusLhzKKZ9ZvXwH/3HZ+FFn0DEP+Zib5GkEH1QOxmpA=; b=TN4Kwq+GRjs5+zBvs1r+RGwFJlxGXQnDNX2FUczEPoh4sFnBht35WaD3gP66abT6bA 4zwLVWULr58InVVYA+v0eGF9y1tELhTOccAdkikdImsNKMqLEarKsnalnyH2AJXDfJCH /fXnfYwQqbxzbjyJfYJV4tigjgjZajeV0lSH/C54DM9E4vp0IyNqlJ8tTsVju5vNKrzm qoSBuO3tLxLXDKQJwlM+EBW+NbxUd4GBaK+jwdjA9XgjDh0/8hIY3lS2q6hjG+OJs19h msrm5Bf4OQ2lt7alUFdQl+IQd2lXZSSsDKGzG8ennGFtTpgTuC8Qmx0ICnCRK8PLN9mC fM8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZusLhzKKZ9ZvXwH/3HZ+FFn0DEP+Zib5GkEH1QOxmpA=; b=3Og/VX5sNPMefcV1bxC3je8j114VVW/9GvBXou36rLeKM8KIeO5HQenlxbGhEACMHZ aW3RPcu9LOOlhsRiv2Nc+EisZW5cu9Ud30i9ZjSSo7UPhHoy7n4RYnihGzoeLhNkN5jN Qfh3Y67A2w/Wz3oGpuRnZ0cagyvtQbYsTkWoK8N7WDRAnOB+7q5cpVYLJ4hOOhxoaWRt I5cQeZV/gS8NXj+M16BHsxfqZIELytSEIZ+zmICDHlMb5Zv3MDMpw8KYXs2NGM/jBBT4 QF8PTWusJsu+aVhxzEtHxiNQlQhNNC210rTjB03cB9PwaNqyv4ptIb5Yq3C5wUnsjVgY 8dTA== X-Gm-Message-State: ACrzQf2V/EJumvG9vvHLBwObi3JlqHUI6qFr8SH/eIa6MxCn2Gdokdul lu5obvotqhN6xL7IW+W74WwP8w== X-Received: by 2002:adf:dc82:0:b0:236:e2b2:6f01 with SMTP id r2-20020adfdc82000000b00236e2b26f01mr28675227wrj.358.1667931120754; Tue, 08 Nov 2022 10:12:00 -0800 (PST) Received: from nicolas-Precision-3551.home ([2001:861:5180:dcc0:7d10:e9e8:fd9a:2f72]) by smtp.gmail.com with ESMTPSA id q12-20020a5d61cc000000b002238ea5750csm13037109wrv.72.2022.11.08.10.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Nov 2022 10:12:00 -0800 (PST) From: Nicolas Frayer <nfrayer@baylibre.com> To: nm@ti.com, ssantosh@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, peter.ujfalusi@gmail.com, vkoul@kernel.org, dmaengine@vger.kernel.org, grygorii.strashko@ti.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-omap@vger.kernel.org, netdev@vger.kernel.org Cc: khilman@baylibre.com, glaroque@baylibre.com, nfrayer@baylibre.com Subject: [PATCH v4 4/4] net: ethernet: ti: davinci_mdio: Deferring probe when soc_device_match() returns NULL Date: Tue, 8 Nov 2022 19:11:44 +0100 Message-Id: <20221108181144.433087-5-nfrayer@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221108181144.433087-1-nfrayer@baylibre.com> References: <20221108181144.433087-1-nfrayer@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748952756339062138?= X-GMAIL-MSGID: =?utf-8?q?1748952756339062138?= |
Series |
soc: ti: Add module build support to the socinfo
|
|
Commit Message
Nicolas Frayer
Nov. 8, 2022, 6:11 p.m. UTC
When the k3 socinfo driver is built as a module, there is a possibility
that it will probe after the davinci mdio driver. By deferring the mdio
probe we allow the k3 socinfo to probe and register the
soc_device_attribute structure needed by the mdio driver.
Signed-off-by: Nicolas Frayer <nfrayer@baylibre.com>
---
drivers/net/ethernet/ti/davinci_mdio.c | 4 ++++
1 file changed, 4 insertions(+)
Comments
Hello, On Tue, 2022-11-08 at 19:11 +0100, Nicolas Frayer wrote: > When the k3 socinfo driver is built as a module, there is a possibility > that it will probe after the davinci mdio driver. By deferring the mdio > probe we allow the k3 socinfo to probe and register the > soc_device_attribute structure needed by the mdio driver. > > Signed-off-by: Nicolas Frayer <nfrayer@baylibre.com> I guess this one will go via the arm tree, right? I'm dropping it from the netdev PW. Thanks, Paolo
Le jeu. 10 nov. 2022 à 12:21, Paolo Abeni <pabeni@redhat.com> a écrit : > > Hello, > > On Tue, 2022-11-08 at 19:11 +0100, Nicolas Frayer wrote: > > When the k3 socinfo driver is built as a module, there is a possibility > > that it will probe after the davinci mdio driver. By deferring the mdio > > probe we allow the k3 socinfo to probe and register the > > soc_device_attribute structure needed by the mdio driver. > > > > Signed-off-by: Nicolas Frayer <nfrayer@baylibre.com> > > I guess this one will go via the arm tree, right? > > I'm dropping it from the netdev PW. > > Thanks, > > Paolo > Hello Paolo, I will resend this series as individual patches, so can you please apply this mdio patch individually as it's independent from the others ? Thanks, Nicolas
Hi Nicolas, On 08/11/22 11:41 pm, Nicolas Frayer wrote: > When the k3 socinfo driver is built as a module, there is a possibility > that it will probe after the davinci mdio driver. By deferring the mdio > probe we allow the k3 socinfo to probe and register the > soc_device_attribute structure needed by the mdio driver. > > Signed-off-by: Nicolas Frayer <nfrayer@baylibre.com> > --- > drivers/net/ethernet/ti/davinci_mdio.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c > index 946b9753ccfb..095198b6b7be 100644 > --- a/drivers/net/ethernet/ti/davinci_mdio.c > +++ b/drivers/net/ethernet/ti/davinci_mdio.c > @@ -533,6 +533,10 @@ static int davinci_mdio_probe(struct platform_device *pdev) > const struct soc_device_attribute *soc_match_data; > > soc_match_data = soc_device_match(k3_mdio_socinfo); > + > + if (!soc_match_data) > + return -EPROBE_DEFER; I dont think this is right way to detect if socinfo driver is probed. Per documentation of soc_device_match() , function will return NULL if it does not match any of the entries in k3_mdio_socinfo (ie if we are running on any platforms other that ones in the list) Note that this driver is used on TI's 32 bit SoCs too that dont even have a k3-socinfo driver equivalent. In such case, this code will end up probe deferring indefinitely. > + > if (soc_match_data && soc_match_data->data) { > const struct k3_mdio_soc_data *socdata = > soc_match_data->data;
Hi Vignesh, Vignesh Raghavendra <vigneshr@ti.com> writes: > Hi Nicolas, > > On 08/11/22 11:41 pm, Nicolas Frayer wrote: >> When the k3 socinfo driver is built as a module, there is a possibility >> that it will probe after the davinci mdio driver. By deferring the mdio >> probe we allow the k3 socinfo to probe and register the >> soc_device_attribute structure needed by the mdio driver. >> >> Signed-off-by: Nicolas Frayer <nfrayer@baylibre.com> >> --- >> drivers/net/ethernet/ti/davinci_mdio.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c >> index 946b9753ccfb..095198b6b7be 100644 >> --- a/drivers/net/ethernet/ti/davinci_mdio.c >> +++ b/drivers/net/ethernet/ti/davinci_mdio.c >> @@ -533,6 +533,10 @@ static int davinci_mdio_probe(struct platform_device *pdev) >> const struct soc_device_attribute *soc_match_data; >> >> soc_match_data = soc_device_match(k3_mdio_socinfo); >> + >> + if (!soc_match_data) >> + return -EPROBE_DEFER; > > I dont think this is right way to detect if socinfo driver is probed. > Per documentation of soc_device_match() , function will return NULL if > it does not match any of the entries in k3_mdio_socinfo (ie if we are > running on any platforms other that ones in the list) > > Note that this driver is used on TI's 32 bit SoCs too that dont even > have a k3-socinfo driver equivalent. In such case, this code will end up > probe deferring indefinitely. Yes, you're right. This is not the right solution and this patch should be dropped. We'll need to have a deeper look at socinfo to figure out if/how it could be configured to support a fully modular kernel. Kevin
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c index 946b9753ccfb..095198b6b7be 100644 --- a/drivers/net/ethernet/ti/davinci_mdio.c +++ b/drivers/net/ethernet/ti/davinci_mdio.c @@ -533,6 +533,10 @@ static int davinci_mdio_probe(struct platform_device *pdev) const struct soc_device_attribute *soc_match_data; soc_match_data = soc_device_match(k3_mdio_socinfo); + + if (!soc_match_data) + return -EPROBE_DEFER; + if (soc_match_data && soc_match_data->data) { const struct k3_mdio_soc_data *socdata = soc_match_data->data;