netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Wong Vee Khee <vee.khee.wong@linux.intel.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC net-next 0/2] Introduce MDIO probe order C45 over C22
Date: Wed, 2 Jun 2021 04:19:43 +0200	[thread overview]
Message-ID: <YLbqv0Sy/3E2XaVU@lunn.ch> (raw)
In-Reply-To: <20210601230352.GA28209@linux.intel.com>

> Yeah, you're right. Thanks for pointing that out. It should be:
> 
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 1539ea021ac0..73bfde770f2d 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -862,11 +862,22 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45)
>         c45_ids.mmds_present = 0;
>         memset(c45_ids.device_ids, 0xff, sizeof(c45_ids.device_ids));
> 
> -       if (is_c45)
> +       if (is_c45) {
>                 r = get_phy_c45_ids(bus, addr, &c45_ids);
> -       else
> +       } else {
>                 r = get_phy_c22_id(bus, addr, &phy_id);
> 
> +               if (phy_id == 0) {
> +                       r = get_phy_c45_ids(bus, addr, &c45_ids);
> +                       if (r == -ENOTSUPP || r == -ENODEV)
> +                               return phy_device_create(bus, addr, phy_id,
> +                                                        false, &c45_ids);
> +                       else
> +                               return phy_device_create(bus, addr, phy_id,
> +                                                        true, &c45_ids);

Still not correct. Think about when get_phy_c22_id() returns an
error. Walk through all the different code paths and check they do the
right thing. It is actually a lot more complex than what is shown
here. Think about all the different types of PHYs and all the
different types of MDIO bus drivers.

      Andrew

  reply	other threads:[~2021-06-02  2:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-25  5:58 [RFC net-next 0/2] Introduce MDIO probe order C45 over C22 Wong Vee Khee
2021-05-25 13:34 ` Andrew Lunn
2021-06-01 10:47   ` Wong Vee Khee
2021-06-01 13:04     ` Andrew Lunn
2021-06-01 15:44       ` Wong Vee Khee
2021-06-01 22:21         ` Andrew Lunn
2021-06-01 23:03           ` Wong Vee Khee
2021-06-02  2:19             ` Andrew Lunn [this message]
2021-06-02 14:15               ` Wong Vee Khee
2021-06-02 15:03                 ` Andrew Lunn
2021-06-02 23:51                   ` Wong Vee Khee
2021-06-05  0:37                     ` Wong Vee Khee
2021-06-05 18:36                       ` Andrew Lunn
2021-06-06  0:54                         ` Wong Vee Khee

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=YLbqv0Sy/3E2XaVU@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=vee.khee.wong@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).