From: =?UTF-8?Q?Andreas_Bie=c3=9fmann?= Date: Sun, 29 May 2016 00:32:18 +0200 Subject: [U-Boot] [PATCH v2 05/18] net: macb: Prepare for driver-model conversion In-Reply-To: <1462454902-6093-6-git-send-email-sjg@chromium.org> References: <1462454902-6093-1-git-send-email-sjg@chromium.org> <1462454902-6093-6-git-send-email-sjg@chromium.org> Message-ID: <497541b0-3b9e-b773-e5c0-67e3fe0d17ea@biessmann.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Simon, On 05.05.16 15:28, Simon Glass wrote: > Adjust this driver to avoid using struct netdev in functions that driver > model will call. Also refactor the receive function to be compatible with > driver model. > > Signed-off-by: Simon Glass > Reviewed-by: Heiko Schocher > Tested-on: smartweb, corvus, taurus, axm > Tested-by: Heiko Schocher > Reviewed-by: Joe Hershberger > --- > > Changes in v2: None > > drivers/net/macb.c | 199 +++++++++++++++++++++++++++++++++-------------------- > 1 file changed, 124 insertions(+), 75 deletions(-) > -static int macb_phy_init(struct macb_device *macb) > +static int macb_phy_init(struct macb_device *macb, const char *name) > { > - struct eth_device *netdev = &macb->netdev; > #ifdef CONFIG_PHYLIB > struct phy_device *phydev; > #endif > @@ -452,7 +450,7 @@ static int macb_phy_init(struct macb_device *macb) > int media, speed, duplex; > int i; > > - arch_get_mdio_control(netdev->name); > + arch_get_mdio_control(name); > #ifdef CONFIG_MACB_SEARCH_PHY > /* Auto-detect phy_addr */ > if (!macb_phy_find(macb)) > @@ -462,13 +460,13 @@ static int macb_phy_init(struct macb_device *macb) > /* Check if the PHY is up to snuff... */ > phy_id = macb_mdio_read(macb, MII_PHYSID1); > if (phy_id == 0xffff) { > - printf("%s: No PHY present\n", netdev->name); > + printf("%s: No PHY present\n", name); > return 0; > } > > #ifdef CONFIG_PHYLIB > /* need to consider other phy interface mode */ > - phydev = phy_connect(macb->bus, macb->phy_addr, netdev, > + phydev = phy_connect(macb->bus, macb->phy_addr, &macb->netdev, is this intentional? You removed every reference to netdev but retained this one. Well, it's clear to me that you have to provide an eth_device to phy_connect() but why change the function then and add the *name to function parameters? > PHY_INTERFACE_MODE_RGMII); > if (!phydev) { > printf("phy_connect failed\n"); No more questions ... Reviewed-by: Andreas Bie?mann