Subject: Re: [PATCH 2/3] net: phy: add support for reset-controller

From: Andrew Lunn <[email-masked]>
Date: Mon, 15 Apr 2019 19:01:04 +0200

On Mon, Apr 15, 2019 at 02:38:39PM +0200, David Bauer wrote:
> +static int mdiobus_register_reset(struct mdio_device *mdiodev)
> +{
> +	struct reset_control *reset = NULL;
> +
> +	if (mdiodev->dev.of_node)
> +		reset = devm_reset_control_get_exclusive(&mdiodev->dev,
> +							 "phy");
> +	if (PTR_ERR(reset) == -ENOENT ||
> +	    PTR_ERR(reset) == -ENOTSUPP)
> +		reset = NULL;
> +	else if (IS_ERR(reset))
> +		return PTR_ERR(reset);
> +
> +	mdiodev->reset_ctrl = reset;
> +
> +	/* Assert the reset signal */
> +	mdio_device_reset(mdiodev, 1);

Hi David

The mdiobus_register_gpiod() function also has a call to
mdio_device_reset(). So we end up resetting the GPIO twice.

It is probably better to pull this out of here, and
mdiobus_register_gpiod(), and do it once in mdiobus_register_device().

	  Andrew