All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Florian Fainelli <f.fainelli@gmail.com>, <netdev@vger.kernel.org>
Cc: <Grygorii.Strashko@ti.com>
Subject: Re: [PATCH] net: phy: shift phy_init_hw after device_add during phy device registration
Date: Fri, 4 Apr 2014 16:41:46 +0300	[thread overview]
Message-ID: <533EB69A.5040606@ti.com> (raw)
In-Reply-To: <1396618728-4151-1-git-send-email-grygorii.strashko@ti.com>

Sorry, this is  [RFC PATCH].

On 04/04/2014 04:38 PM, Grygorii Strashko wrote:
> Now the call of phy_init_hw() in phy_device_register() is converted to
> be just a NOP, because phy_init_hw() is called before PHY devices probing
> and phydev->drv == NULL at this moment.
>
> phy_device_register()
>   |- phy_init_hw() -> NOP
>   |- device_add()
>      |- phy_probe() -> may be if driver is ready
>         |- phydev->drv = <&phy_driver>
>
> Hence, shift call of phy_init_hw() after device_add() and in such way
> increase possibility of its execution.
>
> This patch is RFC because:
> - this patch will change PHY's callbacks call order: .config_init() will
> be called after .probe()
> - i'm not sure that phy_init_hw() need to be called from phy_device_register() and
> maybe it can be moved in other place, like phy_probe()
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> ---
>   drivers/net/phy/phy_device.c |   10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 2f6989b..496940be 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -352,16 +352,16 @@ int phy_device_register(struct phy_device *phydev)
>   		return -EINVAL;
>   	phydev->bus->phy_map[phydev->addr] = phydev;
>
> -	/* Run all of the fixups for this PHY */
> -	err = phy_init_hw(phydev);
> +	err = device_add(&phydev->dev);
>   	if (err) {
> -		pr_err("PHY %d failed to initialize\n", phydev->addr);
> +		pr_err("PHY %d failed to add\n", phydev->addr);
>   		goto out;
>   	}
>
> -	err = device_add(&phydev->dev);
> +	/* Run all of the fixups for this PHY */
> +	err = phy_init_hw(phydev);
>   	if (err) {
> -		pr_err("PHY %d failed to add\n", phydev->addr);
> +		pr_err("PHY %d failed to initialize\n", phydev->addr);
>   		goto out;
>   	}
>
>

      reply	other threads:[~2014-04-04 12:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-04 13:38 [PATCH] net: phy: shift phy_init_hw after device_add during phy device registration Grygorii Strashko
2014-04-04 13:41 ` Grygorii Strashko [this message]

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=533EB69A.5040606@ti.com \
    --to=grygorii.strashko@ti.com \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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.