All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Rosen Penev <rosenp@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, linux@armlinux.org.uk,
	linux-kernel@vger.kernel.org, o.rempel@pengutronix.de,
	p.zabel@pengutronix.de
Subject: Re: [PATCHv4 net-next] net: ag71xx: get reset control using devm api
Date: Tue, 27 Aug 2024 16:12:58 -0700	[thread overview]
Message-ID: <20240827161258.535f8835@kernel.org> (raw)
In-Reply-To: <20240826212205.187073-1-rosenp@gmail.com>

On Mon, 26 Aug 2024 14:21:57 -0700 Rosen Penev wrote:
> Currently, the of variant is missing reset_control_put in error paths.
> The devm variant does not require it.
> 
> Allows removing mdio_reset from the struct as it is not used outside the
> function.

> @@ -683,6 +682,7 @@ static int ag71xx_mdio_probe(struct ag71xx *ag)
>  	struct device *dev = &ag->pdev->dev;
>  	struct net_device *ndev = ag->ndev;
>  	static struct mii_bus *mii_bus;
> +	struct reset_control *mdio_reset;

nit: maintain the longest to shortest ordering of the variables
(sorted by line length not type length)

>  	struct device_node *np, *mnp;
>  	int err;
>  
> @@ -698,10 +698,10 @@ static int ag71xx_mdio_probe(struct ag71xx *ag)
>  	if (!mii_bus)
>  		return -ENOMEM;
>  
> -	ag->mdio_reset = of_reset_control_get_exclusive(np, "mdio");
> -	if (IS_ERR(ag->mdio_reset)) {
> +	mdio_reset = devm_reset_control_get_exclusive(dev, "mdio");
> +	if (IS_ERR(mdio_reset)) {
>  		netif_err(ag, probe, ndev, "Failed to get reset mdio.\n");
> -		return PTR_ERR(ag->mdio_reset);
> +		return PTR_ERR(mdio_reset);
>  	}
>  
>  	mii_bus->name = "ag71xx_mdio";
> @@ -712,10 +712,10 @@ static int ag71xx_mdio_probe(struct ag71xx *ag)
>  	mii_bus->parent = dev;
>  	snprintf(mii_bus->id, MII_BUS_ID_SIZE, "%s.%d", np->name, ag->mac_idx);
>  
> -	if (!IS_ERR(ag->mdio_reset)) {
> -		reset_control_assert(ag->mdio_reset);
> +	if (!IS_ERR(mdio_reset)) {

Are you planning to follow up to remove this check?
Would be nice to do that as second patch in the same series

> +		reset_control_assert(mdio_reset);
>  		msleep(100);
> -		reset_control_deassert(ag->mdio_reset);
> +		reset_control_deassert(mdio_reset);
>  		msleep(200);
>  	}
>  


  reply	other threads:[~2024-08-27 23:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-26 21:21 [PATCHv4 net-next] net: ag71xx: get reset control using devm api Rosen Penev
2024-08-27 23:12 ` Jakub Kicinski [this message]
2024-08-27 23:36   ` Rosen Penev
2024-08-29 22:20     ` Luiz Angelo Daros de Luca
2024-08-30  3:54       ` Rosen Penev
  -- strict thread matches above, loose matches on Subject: below --
2024-08-26 19:28 Rosen Penev
2024-08-28 21:09 ` Jacob Keller
2024-08-29  4:49 ` Oleksij Rempel
2024-08-29  5:56   ` Rosen Penev

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=20240827161258.535f8835@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=p.zabel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=rosenp@gmail.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.