Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3549495pxu; Tue, 15 Dec 2020 09:29:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwl61adJUKWwYHTUocthZq2mf4kXvhHs5bvhoGBDRO0R7YbHTNcGHvpPPBMD/J39xC3lXEp X-Received: by 2002:aa7:dbca:: with SMTP id v10mr14798891edt.219.1608053364634; Tue, 15 Dec 2020 09:29:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608053364; cv=none; d=google.com; s=arc-20160816; b=ixxQRR1kv6xZHuBe23anmQSO8pUBYsxLJVTxB4C5H0co6+f8phvwyOzV7XwhQfeCC4 QLcV0xg8vxfFSTMD8Cduf0oONlA5ZnVLWRHSUqdbIybhhlhHgNbTQthLbb+t0Vrf0OEe NdO5ZnUcQ8G/l/Y1x/vlB4EokmWM0cLL8eT/SfJ43D80GkiAKOzvIHAJuAXOXoh+SBh9 mFc+h9b+Jja50ttzfo68Y7srT9Jowg9xcG0IpNh+QG7d9PGWtPytfwCswI0TVyC1cXHK 6+hrbIlZynn17l8wz+9e6RNuyhNJpjBQO3U2AO0K5PjaryDe09lZIs1/7SOm5sB+esoL 2VCQ== 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=XeL1JU3AOBCtCTm27JOBPqHW8xm0HoyApoO+BoICFoU=; b=RssNGQUmewupga/m6qPyDa4IdW4dt9AHfgi2cSfM7hpWqQbCN4ODu+qpJDvpZzSIfU j6lg6ZC3UWBjJ8hZiQsq/sOPv9evs9ILwX2Yk3U9ogH6cEEfOYQiWOTpisdy2iKgln9+ glxO8ZCQtfCNRbPFwSKHFdxUmMxnACrNZbtNtFNmvc9Nc7v5dLoNEkiaVKr9bBm32s0e JPD0SeVpJTj+yg4zvLAuL4Zb5xFEgs/kjz4dkUqgVVqIL+O2PvFAtH5NTnqxUOwrBBxS mFGEa2BIocLACxmPfMfsymA+OpkfRGjehjyu+LA1/00OPJuabRIsCwM9bl4fkita5dZD Zsog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hCYCkhMN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cb24si1158074edb.552.2020.12.15.09.28.59; Tue, 15 Dec 2020 09:29:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hCYCkhMN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729848AbgLORYR (ORCPT + 99 others); Tue, 15 Dec 2020 12:24:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730108AbgLORXX (ORCPT ); Tue, 15 Dec 2020 12:23:23 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49C2DC06179C; Tue, 15 Dec 2020 09:22:38 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id x126so6085557pfc.7; Tue, 15 Dec 2020 09:22:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XeL1JU3AOBCtCTm27JOBPqHW8xm0HoyApoO+BoICFoU=; b=hCYCkhMNCb5c3Qi3sKAbtkY2DbxHCykfyTbKzsCqY5VYCDSmlW+kTMmwb878sI9X97 rMZ9VPVySFSYLuA6YFIcpva7mc2MFXvfhugMjJ6u3dQ5S20eSaKHz+APO6Z3RNT4yNP1 I1iidbRLw+YB6yz3uBa2VBYmJXraUtSsXrYpl18x2XZooy+qoKHjw4tAbm8RmfOyRXzQ mqOjjH//0w393EOzIrpysg0fKc42k2znubj7LmaTaAuAaILFoC1vjtpZXYfCR57AlGbr CkxP9+jYvDwYK1dP2VYrZob51LKwF/jWxD5+muO4AhKWmFnfgL2d3y9yjyt2WReMRCLY lCcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XeL1JU3AOBCtCTm27JOBPqHW8xm0HoyApoO+BoICFoU=; b=ENZVn2wMRZ8xNaWzzU0k4vLBz0Y+mJsjbbscV0ixmoqkwoAGLKMLJdA8fEJiATsy7u TZYLacJ4oWcbCJiaP+pKQzjbQK4LbkYqBhtfa0mphNCOU7/OH9iuk3YF6oZauApohbZC vslcYQVPvhsZooUIfdCnv/Lqh6ndHi3M3nXo8BdRiNyqC7l5Law/NrORhrIRTY9ByaRQ /07AMTDmnnhcx+l1aT708cTAXYCePZMdoDbwsvQlVj4q7ucy4fyHTtApTWNuzfU3VzSE ij4yRTef8hTFMRpg1lNETmyIIiTCgnhUEzUp9/fGZficCDEaCk9Y60bHdtXq+GUA5hD1 QFOg== X-Gm-Message-State: AOAM532mpWm8a0Ds85haQ4l/cXQWPdzTqrqOozkTQwJ0m3vY94t/O3j6 Whqv+5HR0G35UYCdltPOHYZ/EPIeMNI3c0kJHfM= X-Received: by 2002:a63:74b:: with SMTP id 72mr2438639pgh.4.1608052957796; Tue, 15 Dec 2020 09:22:37 -0800 (PST) MIME-Version: 1.0 References: <20201215164315.3666-1-calvin.johnson@oss.nxp.com> <20201215164315.3666-3-calvin.johnson@oss.nxp.com> In-Reply-To: <20201215164315.3666-3-calvin.johnson@oss.nxp.com> From: Andy Shevchenko Date: Tue, 15 Dec 2020 19:23:26 +0200 Message-ID: Subject: Re: [net-next PATCH v2 02/14] net: phy: Introduce phy related fwnode functions To: Calvin Johnson Cc: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , "linux.cj" , Laurentiu Tudor , Diana Madalina Craciun , ACPI Devel Maling List , Linux Kernel Mailing List , linux-arm Mailing List , netdev , "David S. Miller" , Heiner Kallweit , Jakub Kicinski Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 15, 2020 at 6:44 PM Calvin Johnson wrote: > > Define fwnode_phy_find_device() to iterate an mdiobus and find the > phy device of the provided phy fwnode. Additionally define > device_phy_find_device() to find phy device of provided device. > > Define fwnode_get_phy_node() to get phy_node using named reference. ... > +#include Not sure we need this. See below. ... > +/** > + * fwnode_phy_find_device - Find phy_device on the mdiobus for the provided > + * phy_fwnode. Can we keep a summary on one line? > + * @phy_fwnode: Pointer to the phy's fwnode. > + * > + * If successful, returns a pointer to the phy_device with the embedded > + * struct device refcount incremented by one, or NULL on failure. > + */ > +struct phy_device *fwnode_phy_find_device(struct fwnode_handle *phy_fwnode) > +{ > + struct mdio_device *mdiodev; > + struct device *d; > + if (!phy_fwnode) > + return NULL; Why is this needed? Perhaps a comment to the function description explains a case when @phy_fwnode == NULL. > + d = bus_find_device_by_fwnode(&mdio_bus_type, phy_fwnode); > + if (d) { > + mdiodev = to_mdio_device(d); > + if (mdiodev->flags & MDIO_DEVICE_FLAG_PHY) > + return to_phy_device(d); > + put_device(d); > + } > + > + return NULL; > +} ... > + * For ACPI, only "phy-handle" is supported. DT supports all the three > + * named references to the phy node. ... > + /* Only phy-handle is used for ACPI */ > + phy_node = fwnode_find_reference(fwnode, "phy-handle", 0); > + if (is_acpi_node(fwnode) || !IS_ERR(phy_node)) > + return phy_node; So, what is the problem with going through the rest on ACPI? Usually we describe the restrictions in the documentation. -- With Best Regards, Andy Shevchenko