Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp382114imn; Wed, 27 Jul 2022 08:47:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uW8zrZS53Jq4n00m352cJu+vYLBm+Sn0Iu7mRg1SYJGnvxICEicCxELNpBtuwwF98d5nTv X-Received: by 2002:a17:902:cf09:b0:16d:6a06:f994 with SMTP id i9-20020a170902cf0900b0016d6a06f994mr16610151plg.62.1658936865931; Wed, 27 Jul 2022 08:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658936865; cv=none; d=google.com; s=arc-20160816; b=qvPfPzopmrOnz5qXWKp7k6HoTxTd31M5M2PAsQf4qEQto3wpU7solvuNlhcpQa8IV1 NSTqi3Komnyt/hV6Jtlusw781QZe0YcTwzgY9tQGU3nPO+FFN7KEMH70IWZq6TdmNKvf AizeGLDgZ6R0wln/mfbBfFzNAxrpd/EpZkCx/39J10eaAA0NqgQBVTrEoDo2+F23pRms Y49L5z9AWpTqg6p9Ot+k2yd1FU1vBZZnIOXt1fHF+IjVt2NltoHHFEkNlAlevyei2xCb Is7Tkm96GBr7U4jtbEk2b5sMslgI0JeWf+725Aw6LoMkQwxLs8cW84lPOXL3uKqUbz9c I7wg== 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=vrcDI9X9X/8Ry26dK2m6CeEEVy+vjVfPx3R3Bxv6JsY=; b=AOokKxnebBKVgOcLyilENUjlUKcra+tmZ2pgXiM/mBg+B+EdRrJBRCC1th2VX4tzU0 3NZrC6h8zwdBZOrFYLOBy8g63HK+SnOruXUobYYWREm9HC38uaRqH3YbWs5bO2ah2GOw eBCsQ4Xg52yadB3NNAeL+PVw6fb/o+Ubm+I2Jo+vyq/YDQRVDi21p48RA6Ldhp8U7e7J nvJBMTH7MByyBm4DwmV1ke1IpjDq8i0wdjfTPbcow3IpBQHZ5rCfvQuYf8XU7Jciay0x r/R0ClRVQLfnFUfNqO/LZUNJ6ZkOOgxLZuKIJi6OPfYLDKQ+U/B6aB1LzAPNJBzGEpTC C4iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b=TPw1PvWG; 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 k8-20020a170902d58800b001631214cc97si21647949plh.350.2022.07.27.08.47.28; Wed, 27 Jul 2022 08:47:45 -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=TPw1PvWG; 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 S233745AbiG0PSd (ORCPT + 99 others); Wed, 27 Jul 2022 11:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233239AbiG0PS3 (ORCPT ); Wed, 27 Jul 2022 11:18:29 -0400 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D35F93C17F for ; Wed, 27 Jul 2022 08:18:28 -0700 (PDT) Received: by mail-oi1-x234.google.com with SMTP id l188so9539929oia.4 for ; Wed, 27 Jul 2022 08:18:28 -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=vrcDI9X9X/8Ry26dK2m6CeEEVy+vjVfPx3R3Bxv6JsY=; b=TPw1PvWGxWhDQl3m14gKafds+/S++NkvHiWPh7/J6Dq2XfdTfvWSXIAqycQ7bGv/kv HiClXi9Vaj46dpYOV+b68aOARBSwVZXIyUj4eDnjFurL+N4ryKq5bcTeK96Mn6EzV4VW AaGgnh1HHu90X1hKNIRlk3/Mru2/MFvfJ/TcEdt4yLx8QEwWUnfC6C+CX+xeYMSWDug5 SU6QKrgchlzyYzpEcTew7ua2U/YlzoH82c0rJpdZ7PDiDH64L4Y6ILHkDhLVQ8A2txI6 AVp1cwNC9DZObCoisrQOXw3oX4kmEiqcUyZLldrIO/HJJNkuLGXbdZlHcLE9VwEM+kgO kqNg== 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=vrcDI9X9X/8Ry26dK2m6CeEEVy+vjVfPx3R3Bxv6JsY=; b=ic7avX5tFh8aGPNfqP0/4lncig+im15S/XgkmlnwIwv9SqGZ+YuSxxccEewwnFcFX0 9a9n6jwiOebqydQ+XHF+wMxDi5jhthicAk6I4djoJ8jvoibwOwYflQ9RchNpexyBCiZQ xYiTpPtPc+ZSpvSggAJ5zmwSFbMFF+uy4rwzpQvNCic7ZtQKAGlQS6bYuBB4kmNzMGMk TDnmlwzS1fmNKvHyVKGt3yN6SmBv0iOol17CuG1fRo6j+jURkXY1DtlzlflpNZnXnWBo AsbUfmObCEPC2neTEFE30HB/p0PYCpDZ3dTta9K8MERVLwqv9oy9ZXuB9FWRDdCvV4Z3 qbdQ== X-Gm-Message-State: AJIora9KVdIkzr0rs5cGCR3XMu1h6BTaHQeSu4Mk+P9zCEJIFQcA7Jzj 6NGr5BnrbyNFnKKeXQtDrrmDdCF8jvG17kkrruB69w== X-Received: by 2002:a05:6808:4d7:b0:33a:9437:32d with SMTP id a23-20020a05680804d700b0033a9437032dmr2061172oie.97.1658935108070; Wed, 27 Jul 2022 08:18:28 -0700 (PDT) MIME-Version: 1.0 References: <20220727064321.2953971-1-mw@semihalf.com> <20220727064321.2953971-7-mw@semihalf.com> <20220727143147.u6yd6wqslilspyhw@skbuf> In-Reply-To: <20220727143147.u6yd6wqslilspyhw@skbuf> From: Marcin Wojtas Date: Wed, 27 Jul 2022 17:18:16 +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 16:31 Vladimir Oltean napisa=C5= =82(a): > > On Wed, Jul 27, 2022 at 08:43:19AM +0200, Marcin Wojtas wrote: > > A helper function which allows getting the struct net_device pointer > > associated with a given device tree node can be more generic and > > also support alternative hardware description. Switch to fwnode_ > > and update the only existing caller in DSA subsystem. > > For that purpose use newly added fwnode_dev_node_match helper routine. > > > > Signed-off-by: Marcin Wojtas > > --- > > -struct net_device *of_find_net_device_by_node(struct device_node *np) > > +struct net_device *fwnode_find_net_device_by_node(struct fwnode_handle= *fwnode) > > { > > struct device *dev; > > > > - dev =3D class_find_device(&net_class, NULL, np, of_dev_node_match= ); > > + dev =3D class_find_device(&net_class, NULL, fwnode, fwnode_find_p= arent_dev_match); > > This needs to maintain compatibility with DSA masters that have > dev->of_node but don't have dev->fwnode populated. > Do you mean a situation analogous to what I addressed in: [net-next: PATCH v3 4/8] net: mvpp2: initialize port fwnode pointer ? I found indeed a couple of drivers that may require a similar change (e.g. dpaa2). IMO we have 2 options: - update these drivers - add some kind of fallback? If yes, I am wondering about an elegant solution - maybe add an extra check inside fwnode_find_parent_dev_match? What would you suggest? Best regards, Marcin > > if (!dev) > > return NULL; > > > > return to_net_dev(dev); > > } > > -EXPORT_SYMBOL(of_find_net_device_by_node); > > -#endif > > +EXPORT_SYMBOL(fwnode_find_net_device_by_node);