[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZF1Q9Tc6wHKhnp/q@nimitz>
Date: Thu, 11 May 2023 22:32:53 +0200
From: Piotr Raczynski <piotr.raczynski@...el.com>
To: Jiawen Wu <jiawenwu@...stnetic.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
> +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?
> +
> + txgbe->mdiodev = mdiodev;
> + txgbe->xpcs = xpcs;
> +
> + return 0;
> +}
Powered by blists - more mailing lists