All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: Jijie Shao <shaojijie@huawei.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <andrew+netdev@lunn.ch>, <horms@kernel.org>,
	<Frank.Sae@motor-comm.com>, <hkallweit1@gmail.com>,
	<linux@armlinux.org.uk>, <shenjian15@huawei.com>,
	<liuyonglong@huawei.com>, <chenhao418@huawei.com>,
	<salil.mehta@huawei.com>, <shiyongbang@huawei.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RFC net-next 1/6] net: phy: change of_phy_leds() to fwnode_phy_leds()
Date: Wed, 17 Dec 2025 10:37:01 +0000	[thread overview]
Message-ID: <20251217103701.000066f8@huawei.com> (raw)
In-Reply-To: <20251215125705.1567527-2-shaojijie@huawei.com>

On Mon, 15 Dec 2025 20:57:00 +0800
Jijie Shao <shaojijie@huawei.com> wrote:

> Change of_phy_leds() to fwnode_phy_leds(), to support
> of node, acpi node, and software node together.
> 
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>

One minor suggestion inline. It is a 'while you are here'
and whilst there are uses of the _scoped loops
in drivers/net I'm not sure how much appetite there is
for using them wider.

Jonathan


> ---
>  drivers/net/phy/phy_device.c | 37 +++++++++++++++++-------------------
>  1 file changed, 17 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 81984d4ebb7c..c5ce057f88ff 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c


> -static int of_phy_leds(struct phy_device *phydev)
> +static int fwnode_phy_leds(struct phy_device *phydev)
>  {
> -	struct device_node *node = phydev->mdio.dev.of_node;
> -	struct device_node *leds;
> +	struct fwnode_handle *fwnode = dev_fwnode(&phydev->mdio.dev);
> +	struct fwnode_handle *leds, *led;
>  	int err;
>  
> -	if (!IS_ENABLED(CONFIG_OF_MDIO))
> -		return 0;
> -
> -	if (!node)
> +	if (!fwnode)
>  		return 0;
>  
> -	leds = of_get_child_by_name(node, "leds");
> +	leds = fwnode_get_named_child_node(fwnode, "leds");
>  	if (!leds)
>  		return 0;
>  
> @@ -3311,17 +3308,17 @@ static int of_phy_leds(struct phy_device *phydev)
>  		goto exit;
>  	}
>  
> -	for_each_available_child_of_node_scoped(leds, led) {
> -		err = of_phy_led(phydev, led);
> +	fwnode_for_each_available_child_node(leds, led) {

Maybe use the _scoped version to simplify this a little given
you are changing it.

> +		err = fwnode_phy_led(phydev, led);
>  		if (err) {
> -			of_node_put(leds);
> +			fwnode_handle_put(leds);
>  			phy_leds_unregister(phydev);
>  			return err;
>  		}
>  	}
>  
>  exit:
> -	of_node_put(leds);
> +	fwnode_handle_put(leds);
>  	return 0;
>  }
>  
> @@ -3516,7 +3513,7 @@ static int phy_probe(struct device *dev)
>  	 * LEDs for them.
>  	 */
>  	if (IS_ENABLED(CONFIG_PHYLIB_LEDS) && !phy_driver_is_genphy(phydev))
> -		err = of_phy_leds(phydev);
> +		err = fwnode_phy_leds(phydev);
>  
>  out:
>  	/* Re-assert the reset signal on error */


  reply	other threads:[~2025-12-17 10:37 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15 12:56 [PATCH RFC net-next 0/6] Support PHY LED for hibmcge driver Jijie Shao
2025-12-15 12:57 ` [PATCH RFC net-next 1/6] net: phy: change of_phy_leds() to fwnode_phy_leds() Jijie Shao
2025-12-17 10:37   ` Jonathan Cameron [this message]
2025-12-17 13:18     ` Jijie Shao
2025-12-15 12:57 ` [PATCH RFC net-next 2/6] net: phy: add support to set default rules Jijie Shao
2025-12-16  7:09   ` Andrew Lunn
2025-12-17 12:54     ` Jijie Shao
2025-12-17 13:53       ` Andrew Lunn
2025-12-18  1:35         ` Jijie Shao
2025-12-18 10:12           ` Andrew Lunn
2026-01-07  9:40             ` Jijie Shao
2026-01-07 13:09           ` Andrew Lunn
2026-01-08  7:00             ` Jijie Shao
2026-01-08 14:31               ` Andrew Lunn
2026-01-02 11:26       ` Russell King (Oracle)
2026-01-07  9:43         ` Jijie Shao
2026-01-07  9:50           ` Russell King (Oracle)
2026-01-07 10:12             ` Jijie Shao
2025-12-15 12:57 ` [PATCH RFC net-next 3/6] net: hibmcge: create a software node for phy_led Jijie Shao
2025-12-16  7:17   ` Andrew Lunn
2025-12-17 12:57     ` Jijie Shao
2026-01-07 10:09     ` Jijie Shao
2026-01-07 13:04       ` Andrew Lunn
2026-01-08  6:57         ` Jijie Shao
2026-01-08 13:59           ` Andrew Lunn
2025-12-15 12:57 ` [PATCH RFC net-next 4/6] net: hibmcge: support get phy_leds_reg from spec register Jijie Shao
2025-12-16  7:19   ` Andrew Lunn
2025-12-17 13:02     ` Jijie Shao
2025-12-15 12:57 ` [PATCH RFC net-next 5/6] net: hibmcge: support get phy device from apci Jijie Shao
2025-12-19  4:29   ` kernel test robot
2025-12-15 12:57 ` [PATCH RFC net-next 6/6] net: phy: motorcomm: fix duplex setting error for phy leds Jijie Shao
2025-12-16  7:21   ` Andrew Lunn
2025-12-17 13:05     ` Jijie Shao
2025-12-17 13:49       ` Andrew Lunn
2025-12-18  1:39         ` Jijie Shao
2025-12-15 14:46 ` [PATCH RFC net-next 0/6] Support PHY LED for hibmcge driver Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251217103701.000066f8@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=Frank.Sae@motor-comm.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=chenhao418@huawei.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=liuyonglong@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=salil.mehta@huawei.com \
    --cc=shaojijie@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=shiyongbang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.