On 01.10.2019 08:08, Oleksij Rempel wrote:
> Use exact match for all IDs. We have no sanity checks, so we can peek
> a device with no exact ID and different register layout.
> 

I think it would be better to use PHY_ID_MATCH_EXACT for the newly
added AR9331 only. The mask 0xffffffef for the other Atheros PHY's
may be there for a reason. In this case other PHY's matching the
mask would be silently switched to the genphy driver and may
misbehave.

> Suggested-by: Heiner Kallweit <hkallwe...@gmail.com>
> Signed-off-by: Oleksij Rempel <o.rem...@pengutronix.de>
> ---
>  drivers/net/phy/at803x.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> index 6ad8b1c63c34..7895dbe600ac 100644
> --- a/drivers/net/phy/at803x.c
> +++ b/drivers/net/phy/at803x.c
> @@ -364,9 +364,8 @@ static int at803x_aneg_done(struct phy_device *phydev)
>  static struct phy_driver at803x_driver[] = {
>  {
>       /* ATHEROS 8035 */
> -     .phy_id                 = ATH8035_PHY_ID,
> +     PHY_ID_MATCH_EXACT(ATH8035_PHY_ID),
>       .name                   = "Atheros 8035 ethernet",
> -     .phy_id_mask            = AT803X_PHY_ID_MASK,
>       .probe                  = at803x_probe,
>       .config_init            = at803x_config_init,
>       .set_wol                = at803x_set_wol,
> @@ -378,9 +377,8 @@ static struct phy_driver at803x_driver[] = {
>       .config_intr            = at803x_config_intr,
>  }, {
>       /* ATHEROS 8030 */
> -     .phy_id                 = ATH8030_PHY_ID,
> +     PHY_ID_MATCH_EXACT(ATH8030_PHY_ID),
>       .name                   = "Atheros 8030 ethernet",
> -     .phy_id_mask            = AT803X_PHY_ID_MASK,
>       .probe                  = at803x_probe,
>       .config_init            = at803x_config_init,
>       .link_change_notify     = at803x_link_change_notify,
> @@ -393,9 +391,8 @@ static struct phy_driver at803x_driver[] = {
>       .config_intr            = at803x_config_intr,
>  }, {
>       /* ATHEROS 8031 */
> -     .phy_id                 = ATH8031_PHY_ID,
> +     PHY_ID_MATCH_EXACT(ATH8031_PHY_ID),
>       .name                   = "Atheros 8031 ethernet",
> -     .phy_id_mask            = AT803X_PHY_ID_MASK,
>       .probe                  = at803x_probe,
>       .config_init            = at803x_config_init,
>       .set_wol                = at803x_set_wol,
> @@ -411,9 +408,7 @@ static struct phy_driver at803x_driver[] = {
>  module_phy_driver(at803x_driver);
>  
>  static struct mdio_device_id __maybe_unused atheros_tbl[] = {
> -     { ATH8030_PHY_ID, AT803X_PHY_ID_MASK },
> -     { ATH8031_PHY_ID, AT803X_PHY_ID_MASK },
> -     { ATH8035_PHY_ID, AT803X_PHY_ID_MASK },
> +     { PHY_ID_MATCH_VENDOR(ATH8030_PHY_ID) },
>       { }
>  };
>  
> 

Reply via email to