[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <000101d984b3$4185cb00$c4916100$@trustnetic.com>
Date: Fri, 12 May 2023 17:22:21 +0800
From: Jiawen Wu <jiawenwu@...stnetic.com>
To: "'Piotr Raczynski'" <piotr.raczynski@...el.com>
Cc: <netdev@...r.kernel.org>,
<jarkko.nikula@...ux.intel.com>,
<andriy.shevchenko@...ux.intel.com>,
<mika.westerberg@...ux.intel.com>,
<jsd@...ihalf.com>,
<Jose.Abreu@...opsys.com>,
<andrew@...n.ch>,
<hkallweit1@...il.com>,
<linux@...linux.org.uk>,
<linux-i2c@...r.kernel.org>,
<linux-gpio@...r.kernel.org>,
<mengyuanlou@...-swift.com>
Subject: RE: [PATCH net-next v7 8/9] net: txgbe: Implement phylink pcs
On Friday, May 12, 2023 4:33 AM, Piotr Raczynski wrote:
> > +static int txgbe_mdio_pcs_init(struct txgbe *txgbe)
> > +{
> > + struct mdio_device *mdiodev;
> > + struct wx *wx = txgbe->wx;
> > + struct mii_bus *mii_bus;
> > + struct dw_xpcs *xpcs;
> > + struct pci_dev *pdev;
> > + int ret = 0;
> > +
> > + pdev = wx->pdev;
> > +
> > + mii_bus = devm_mdiobus_alloc(&pdev->dev);
> > + if (!mii_bus)
> > + return -ENOMEM;
> > +
> > + mii_bus->name = "txgbe_pcs_mdio_bus";
> > + mii_bus->read_c45 = &txgbe_pcs_read;
> > + mii_bus->write_c45 = &txgbe_pcs_write;
> > + mii_bus->parent = &pdev->dev;
> > + mii_bus->phy_mask = ~0;
> > + mii_bus->priv = wx;
> > + snprintf(mii_bus->id, MII_BUS_ID_SIZE, "txgbe_pcs-%x",
> > + (pdev->bus->number << 8) | pdev->devfn);
> > +
> > + ret = devm_mdiobus_register(&pdev->dev, mii_bus);
> > + if (ret)
> > + return ret;
> > +
> > + mdiodev = mdio_device_create(mii_bus, 0);
> > + if (IS_ERR(mdiodev))
> > + return PTR_ERR(mdiodev);
> > +
> > + xpcs = xpcs_create(mdiodev, PHY_INTERFACE_MODE_10GBASER);
> > + if (IS_ERR_OR_NULL(xpcs)) {
> > + mdio_device_free(mdiodev);
> > + return PTR_ERR(xpcs);
> > + }
>
> xpcs_create does not seem to return NULL but if it would then you'd
> return success here. Is this intentional?
Should be if (IS_ERR(xpcs)) ...
>
> > +
> > + txgbe->mdiodev = mdiodev;
> > + txgbe->xpcs = xpcs;
> > +
> > + return 0;
> > +}
>
Powered by blists - more mailing lists