Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp283204imn; Wed, 27 Jul 2022 23:52:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vWoCVtz7xt6ZVYHthkmcXXPaOSI9PfWZP4YZ3EQuWoMcixxagBYLgATUcUrldFfr1AE35Y X-Received: by 2002:a17:90a:d155:b0:1f2:4741:3b74 with SMTP id t21-20020a17090ad15500b001f247413b74mr8479855pjw.201.1658991148305; Wed, 27 Jul 2022 23:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658991148; cv=none; d=google.com; s=arc-20160816; b=vDR63NMhKNI9f6ZiBilGGYbA6LTedwenl95UvUS18mo1TPtNnrOh9I+TcJuYrEdKqt HPKNRtxPPSh/+56xuy+fMnvb3hq7MAV51PtOTuV94F279XXkzMLLVPQi5fks35RUQEcy rjkzVFhZaV4ctN5xyomRbkqZvCybl4DRE1nlnC+uJUdCfaznMRJUWBORBNHI4v/ZZOLy PFbBMEk4LoK7g69bLYrl7dAFrzntbHxvRMrvr4CUyOcTLdyAPeNhCEShcL9rC8s5TkFn M8lWMt6EbAd1Rfjm3fecE+s53/IYbeTcuHo05Psc9MJY2q1tzFnv9WykxpqRXGNkcGHs EIPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=HgwlQG4Lhx8whx7o14FpfCX9iHMs/wtL+rv0oLousaM=; b=AMNDIvfEez8a9nX/lGaWEp+iiqZPfFHvzAqQRNQzF67lERe4Us0rKQsskadYivMczx a1WcnOl93bUtZDsp4Kn6zC3F0Mxv6W8/qtZahqHTxUXQC6eCPqP7ZO2zchAkdDzu0lpF 99qQesEB7/bavxbYwDl6S9HzEp39n5pOwRL4Q+NIrn78pDShXpHsxPtTQYG6cY4t2/z6 QkpuATGSsH7KjXdMzq+l+CI4FHCpoIY2fO90quyF2LeNm2nbc6OV0yoPt30FQ9UqEvWm d54xhJnshQzSVv/E6HImtTY1xTIDzrgFnW3lGbalSvJ6lOuXKcQTt2PWi2goVF6DUeDR J5gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b=Lp+CwaWO; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a10-20020a63704a000000b0041ae5bf1290si278477pgn.246.2022.07.27.23.52.11; Wed, 27 Jul 2022 23:52:28 -0700 (PDT) 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=@semihalf.com header.s=google header.b=Lp+CwaWO; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=semihalf.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234136AbiG1GsN (ORCPT + 99 others); Thu, 28 Jul 2022 02:48:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233104AbiG1GsL (ORCPT ); Thu, 28 Jul 2022 02:48:11 -0400 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9E8F58B78 for ; Wed, 27 Jul 2022 23:48:09 -0700 (PDT) Received: by mail-oi1-x22b.google.com with SMTP id h125so1440775oif.8 for ; Wed, 27 Jul 2022 23:48:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=HgwlQG4Lhx8whx7o14FpfCX9iHMs/wtL+rv0oLousaM=; b=Lp+CwaWO4nw6MMzfwGVjyhC14OxkQxYBsfkzHny0qQnxwHloJEKmoVOZZGAnkpqHIo uPz7OhI2Ic2ymiyTnvboWdPU590QzG5fUzNr+WKNARr+TzbLjGgFWQ/p7hUrFF8nFmel lVePTIE766U+suinIq5Dr+2BJyEjSSWTtii+TZy7gpNA7A2yhvSCuVG68jZotyQuPM5N 5wvHmRNNkYHFFUKJazcwGEdIiwB8YuXKJ4tqQl+mQwb83tv7ycMPIqg50Kqc75VENa0M /kinDCpvUbgdEsMvqGP72oKu3x5tXmULOSw37vS4i1lRdAYXdBZaVrY0dtx/bE8ljZ6s ts7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=HgwlQG4Lhx8whx7o14FpfCX9iHMs/wtL+rv0oLousaM=; b=Sia2EJIkD/TYrwFtiCRRSN4r17vf6NLfX4USt27NdkQdSKstvvyRVcScuV/CXQE5sM C4ahlqnMQHYttf17AcF4L5g4pN/gMNglRunSLNIVpRVpRvuDMBAI3fYuWWLT3s809hmD 9jUJrDm3vww9Om+PZOyyfMbj3z6pDMd00wSiGFZ92K8YI1qisX77wmhUgYkwEUgWBho8 VzYeaexnK8x/oRh+69Cn/CZ8DFUjMwLgya66JCIVsmJFI0p8Yu4FTIVnosBCxSRcYbGU Y/JEt0mqW3h6LcZ0NOlDczxgUkPtOARRTRr/HLhKbKhwGNeyi4dQpFLaOFSvbamURTyn 5UmA== X-Gm-Message-State: AJIora/hz726xdCMpatflD1Qf4qfOQ5yxlyv7mVnjh/FN900jC50LALD E7mbZCiZsF6+YwjY+2sA1yRAMZi7HZl4wSQzt7H31g== X-Received: by 2002:aca:ba86:0:b0:33a:c6f7:3001 with SMTP id k128-20020acaba86000000b0033ac6f73001mr3375710oif.5.1658990889029; Wed, 27 Jul 2022 23:48:09 -0700 (PDT) MIME-Version: 1.0 References: <20220727064321.2953971-1-mw@semihalf.com> <20220727064321.2953971-7-mw@semihalf.com> <20220727143147.u6yd6wqslilspyhw@skbuf> <20220727163848.f4e2b263zz3vl2hc@skbuf> <20220727211112.kcpbxbql3tw5q5sx@skbuf> In-Reply-To: <20220727211112.kcpbxbql3tw5q5sx@skbuf> From: Marcin Wojtas Date: Thu, 28 Jul 2022 08:47:58 +0200 Message-ID: Subject: Re: [net-next: PATCH v3 6/8] net: core: switch to fwnode_find_net_device_by_node() To: Vladimir Oltean Cc: Linux Kernel Mailing List , ACPI Devel Maling List , netdev , "Rafael J. Wysocki" , Andy Shevchenko , Sean Wang , Landen Chao , Linus Walleij , Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King - ARM Linux , Heiner Kallweit , Grzegorz Bernacki , Grzegorz Jaszczyk , Tomasz Nowicki , Samer El-Haj-Mahmoud , upstream@semihalf.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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_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: X-Mailing-List: linux-kernel@vger.kernel.org =C5=9Br., 27 lip 2022 o 23:11 Vladimir Oltean napisa=C5= =82(a): > > On Wed, Jul 27, 2022 at 07:40:00PM +0200, Marcin Wojtas wrote: > > SET_NETDEV_DEV() fills net_device->dev.parent with &pdev->dev > > and in most cases it is sufficient apparently it is sufficient for > > fwnode_find_parent_dev_match (at least tests with mvneta case proves > > it's fine). > > Indeed, mvneta works, which is a plain old platform device that hasn't > even been converted to fwnode, so why don't the others? > > Well, as it turns out, it's one of the cases where I spoke to soon, > thinking I knew what was the problem why probing failed, before actually > debugging. > > I thought there was no dmesg output from DSA at all, which would have > indicated an eternal -EPROBE_DEFER situation. But there's one tiny line > I had overlooked: > > [ 5.094013] mscc_felix 0000:00:00.5: error -EINVAL: Failed to register= DSA switch > > This comes from here: > > static int dsa_port_parse_fw(struct dsa_port *dp, struct fwnode_handle *f= wnode) > { > struct fwnode_handle *ethernet =3D fwnode_find_reference(fwnode, = "ethernet", 0); > bool link =3D fwnode_property_present(fwnode, "link"); > const char *name =3D NULL; > int ret; > > ret =3D fwnode_property_read_string(fwnode, "label", &name); > // if (ret) > // return ret; > > dp->fwnode =3D fwnode; > > The 'label' property of a port was optional, you've made it mandatory by = accident. > It is used only by DSA drivers that register using platform data. Thanks for spotting that, I will make it optional again. > > (side note, I can't believe you actually have a 'label' property for the > CPU port and how many people are in the same situation as you; you know > it isn't used for anything, right? how do we stop the cargo cult?) > Well, given these results: ~/git/linux : git grep 'label =3D \"cpu\"' arch/arm/boot/dts/ | wc -l 79 ~/git/linux : git grep 'label =3D \"cpu\"' arch/arm64/boot/dts/ | wc -l 14 It's not a surprise I also have it defined in the platforms I test. I agree it doesn't serve any purpose in terms of creating the devices in DSA with DT, but it IMO increases readability of the description at least. > > Can you please check applying following diff: > > > > --- a/drivers/base/property.c > > +++ b/drivers/base/property.c > > @@ -695,20 +695,22 @@ EXPORT_SYMBOL_GPL(fwnode_get_nth_parent); > > * The routine can be used e.g. as a callback for class_find_device(). > > * > > * Returns: %1 - match is found > > * %0 - match not found > > */ > > int fwnode_find_parent_dev_match(struct device *dev, const void *data) > > { > > for (; dev; dev =3D dev->parent) { > > if (device_match_fwnode(dev, data)) > > return 1; > > + else if (device_match_of_node(dev, to_of_node(data)) > > + return 1; > > } > > > > return 0; > > } > > EXPORT_SYMBOL_GPL(fwnode_find_parent_dev_match); > > So, nothing to do with device_match_fwnode() failing, that would have > been strange, come to think about it. Sorry for the noise here. > Great, thank you for confirmation. > But looking at the deeper implementation of dev_fwnode() as: > > struct fwnode_handle *dev_fwnode(struct device *dev) > { > return IS_ENABLED(CONFIG_OF) && dev->of_node ? > of_fwnode_handle(dev->of_node) : dev->fwnode; > } > > I wonder, why did you have to modify mvpp2? It looks at dev->of_node > prior to returning dev->fwnode. It should work. When I boot with ACPI, the dev->of_node becomes NULL. With DT it's fine as-= is. Best regards, Marcin