From: Andrew Lunn Subject: Re: [PATCH net-next v2 01/10] r8169: add basic phylib support Date: Tue, 10 Jul 2018 21:10:51 +0200 Message-ID: <20180710191051.GB11754@lunn.ch> References: <84ac1cb7-bafd-5f15-8cda-e8dfd7d0deb3@gmail.com> <9816ca13-1347-5a1c-62d6-1d7c799bde60@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: David Miller , Florian Fainelli , Realtek linux nic maintainers , "netdev@vger.kernel.org" To: Heiner Kallweit Return-path: Received: from vps0.lunn.ch ([185.16.172.187]:57820 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732378AbeGJTLW (ORCPT ); Tue, 10 Jul 2018 15:11:22 -0400 Content-Disposition: inline In-Reply-To: <9816ca13-1347-5a1c-62d6-1d7c799bde60@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: > +static int r8169_mdio_read_reg(struct mii_bus *mii_bus, int phyaddr, int phyreg) > +{ > + struct rtl8169_private *tp = mii_bus->priv; > + > + if (phyaddr > 0) > + return -EINVAL; Please use ENODEV. The mdio bus is scanned for devices in __mdiobus_register(). If mdiobus_scan() returns -ENODEV, it is not considered an error, and it will continue scanning other addresses on the bus. Any other error is a real error, and will abort the scan. That will probably abort the bus registration. > +static int r8169_mdio_register(struct rtl8169_private *tp) > +{ > + struct pci_dev *pdev = tp->pci_dev; > + struct mii_bus *new_bus; > + int ret; > + > + new_bus = devm_mdiobus_alloc(&pdev->dev); > + if (!new_bus) > + return -ENOMEM; > + > + new_bus->name = "r8169"; > + new_bus->phy_mask = ~1; Once your handling of addr > 0 is correct, you don't need this. Let is scan all addresses, just like a normal MDIO bus. The more we can keep it normal, the better. Andrew