Received: by 2002:a05:6512:e85:0:0:0:0 with SMTP id bi5csp3091423lfb; Tue, 28 Jun 2022 06:17:45 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uRIkeSOIEXgsqZzelZWSxbnkiPZVzfWOSMrxUkM+5k3jGs1ZJW70SsAL+FMVmkZde0PIxX X-Received: by 2002:a17:90a:e58a:b0:1e2:fe75:dd5f with SMTP id g10-20020a17090ae58a00b001e2fe75dd5fmr27982863pjz.138.1656422264782; Tue, 28 Jun 2022 06:17:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656422264; cv=none; d=google.com; s=arc-20160816; b=Pa15HQGreBnYAH+Dm9xzjsO5GI0AXiZp7GdU23bral4w18KKTjgi2iU53tJf+lzmeR iI49HBAU9eWCl3MBlEbe/hiALaBlxUSPoGFFlpfZlDKKofCz/cYVoqADKQAV5hk61q7h cOuuQiHEaJF7tdNEM09ZLesCTNIKkdyRZkbGN1x4x2goKIj616NegvUMRf8K1Zn7Kxky WFYKDaoLDxkr3b6LLtYe6xhmQHpsjA50c+MdWBuU+T+SqAvmb88mgWFjl2kTeH/7O1sX fecgSJCYCHg1Kn+vnDnpq7Z61qMqhq9oHZMQmIkWBQ5+lBQjN29m/P/6GHIVhhsu3J9J sQIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4Dndi5h/zWqB6In2E0grpesiVdBXsHnaC/f8f16Jrk8=; b=WdHC0UgZPQku0KFJ3mzk5xj+k0htCvE9UXx8c9NlsW5qZ7UaRzvgsTt1PTcczchFDJ nElIfW2Y+6GjWAB/Bq9Ya07H/q4uOcSlgLLQJQKb112qEj8KZyXBOSuXnNJ25Nu1VVOx xE3YlV/kbS8t5CVvTdmXChITbrnrxgN6wVs9H6ymGlpZpLG5KmK/jFb1Xnh3tijbZs2+ kqQNQOVb6rAdsFW8neYwZlZsBMIDhA7P+AJVYUfL53QwA/2LRQZOav5eqdLUuHmflIL7 JD56duahx48S5YHMjgRGOM831zN0f4Ot0ShM+xO5VBnvnzgz11rfX3iaHi+Kb94inymS 5rbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pP8lsUxH; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e15-20020a65648f000000b00408b78ce298si17527083pgv.669.2022.06.28.06.17.24; Tue, 28 Jun 2022 06:17:44 -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=@gmail.com header.s=20210112 header.b=pP8lsUxH; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345260AbiF1NMG (ORCPT + 99 others); Tue, 28 Jun 2022 09:12:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345971AbiF1NMD (ORCPT ); Tue, 28 Jun 2022 09:12:03 -0400 Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A49DF2BB1E; Tue, 28 Jun 2022 06:12:02 -0700 (PDT) Received: by mail-yb1-xb2c.google.com with SMTP id i15so22210032ybp.1; Tue, 28 Jun 2022 06:12:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4Dndi5h/zWqB6In2E0grpesiVdBXsHnaC/f8f16Jrk8=; b=pP8lsUxHbgrgAxUUSLLKxPjGo8ZmNEVDLuBB43wdxKDAHV010b0MC5nauihZkvEcJl Npn/VLm5YbA40u5T8EcufMt4J8qquis0LfnAklKKfwACXDlJauu4yfvCYs2JOmA/eBos AqJbHqJDYAvp4Xu36q7Q/t9ykyiwhrpoviNJ0+KbNpxVGHercIeTMHFC9hrWNemV6imY g3azcaJb8+cUgddg4kHfXjhKDgTGYJFzNIZJz3KiTfB1N4PgumTnr5TuOAz6IH9ghQaK ioRz48YYdbaXLtIeJEekYqO2o5s+5TV3QOCH1tu1pdF20sJi9u0KOuTzVQRn28rW/zPW 7PkA== 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; bh=4Dndi5h/zWqB6In2E0grpesiVdBXsHnaC/f8f16Jrk8=; b=6DKdpQJSAPmW0QY+SmZZpkb5D3Z/y9yTElJQJIDVJvJAGF1EXzXPYI6YIAK4lTvWxy OnG3PZ/X6kuCRyUyTwT0S2UBUliUaS5Gwa07b17NVbZCI0c/uVWnHGUmJMNqshmnwJIf uSlFrgG5nsx9yRclohQtYR2l/rejRT7yN3JvhbHe4uwN4AWS+JKsqZ7rWmPw3yFJuCPD Nw6XxEVpRvafgbhmZRdw3nROEfhm9eAeKoQIGQFzqcdAo7Uu270b2rKmWVXqdiOPQF4U yQ5fIs2eoVxkN6HsKxRYeEeyjV5g7QnRl5DpRrl3iZheg1gWlyWZUV8Xnm000oTCW0F7 Ng4w== X-Gm-Message-State: AJIora/MlU7Qg9iKzkNgk7skYnGi51miPiWeK+Yo+3tz1mHKV7fCtL1U KehVaHfTeW0F6XUaRgU0fAzRQQdMP1o+SjICebs= X-Received: by 2002:a25:187:0:b0:66c:eaea:71ec with SMTP id 129-20020a250187000000b0066ceaea71ecmr8995133ybb.570.1656421921710; Tue, 28 Jun 2022 06:12:01 -0700 (PDT) MIME-Version: 1.0 References: <4e1d5db9dea68d82c94336a1d6aac404@walle.cc> In-Reply-To: From: Andy Shevchenko Date: Tue, 28 Jun 2022 15:11:24 +0200 Message-ID: Subject: Re: fwnode_for_each_child_node() and OF backend discrepancy To: Michael Walle Cc: Andy Shevchenko , "Rafael J. Wysocki" , Rob Herring , Krzysztof Kozlowski , ACPI Devel Maling List , devicetree , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 On Tue, Jun 28, 2022 at 1:54 PM Michael Walle wrote: > > Am 2022-06-28 13:10, schrieb Andy Shevchenko: > > On Mon, Jun 27, 2022 at 02:49:51PM +0200, Michael Walle wrote: > >> Hi, > >> > >> I tired to iterate over all child nodes, regardless if they are > >> available > >> or not. Now there is that handy fwnode_for_each_child_node() (and the > >> fwnode_for_each_available_child_node()). The only thing is the OF > >> backend > >> already skips disabled nodes [1], making fwnode_for_each_child_node() > >> and > >> fwnode_for_each_available_child_node() behave the same with the OF > >> backend. > >> > >> Doesn't seem to be noticed by anyone for now. I'm not sure how to fix > >> that > >> one. fwnode_for_each_child_node() and also > >> fwnode_get_next_child_node() are > >> used by a handful of drivers. I've looked at some, but couldn't decide > >> whether they really want to iterate over all child nodes or just the > >> enabled > >> ones. > >> > >> Any thoughts? > > > > It was discussed at least twice this year (in regard to some new IIO > > drivers) > > and Rob told that iterating over disabled (not available) nodes in OF > > kinda > > legacy/design mistake. That's why device_for_each_child_node() goes > > only > > over available nodes only. > > Mh, but then the fwnode_for_each_child_node() is very misleading, esp. > with the presence of fwnode_for_each_available_child_node(). > > > So, why do you need to iterate over disabled ones? > > I was trying to fix the lan966x driver [1] which doesn't work if there > are disabled nodes in between. Can you elaborate what's wrong now in the behaviour of the driver? In the code it uses twice the _available variant. > My steps would have been: > (1) change fwnode_for_each_available_child_node() to > fwnode_for_each_child_node(), maybe with a fixes tag, as it's > easy to backport > (2) introduce new compatibles and deduce the number of ports > according to the compatible string and not by counting > the child nodes. > (3) keep the old behavior for the legacy compatible and mark it > as deprecated in the binding > (4) move the device tree over to the new compatible string > [1] > https://elixir.bootlin.com/linux/v5.19-rc4/source/drivers/net/ethernet/microchip/lan966x/lan966x_main.c -- With Best Regards, Andy Shevchenko