Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753211AbdG1XYh (ORCPT ); Fri, 28 Jul 2017 19:24:37 -0400 Received: from vps0.lunn.ch ([178.209.37.122]:44441 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753021AbdG1XYf (ORCPT ); Fri, 28 Jul 2017 19:24:35 -0400 Date: Sat, 29 Jul 2017 01:24:28 +0200 From: Andrew Lunn To: Salil Mehta Cc: davem@davemloft.net, yisen.zhuang@huawei.com, huangdaode@hisilicon.com, lipeng321@huawei.com, mehta.salil.lnk@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, linuxarm@huawei.com Subject: Re: [PATCH V5 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Message-ID: <20170728232428.GA16080@lunn.ch> References: <20170728222652.118448-1-salil.mehta@huawei.com> <20170728222652.118448-7-salil.mehta@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170728222652.118448-7-salil.mehta@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1430 Lines: 58 > +static void hclge_mac_adjust_link(struct net_device *netdev) > +{ > + struct hnae3_handle *h = *((void **)netdev_priv(netdev)); > + struct hclge_vport *vport = hclge_get_vport(h); > + struct hclge_dev *hdev = vport->back; > + int duplex, speed; > + int ret; > + > + speed = netdev->phydev->speed; > + duplex = netdev->phydev->duplex; > + > + ret = hclge_cfg_mac_speed_dup(hdev, speed, duplex); > + if (ret) > + dev_err(&hdev->pdev->dev, "adjust link fail.\n"); Here and hclge_mac_start_phy() you have a netdev, so you should be using netdev_err() > +} > + > +int hclge_mac_start_phy(struct hclge_dev *hdev) > +{ > + struct net_device *netdev = hdev->vport[0].nic.netdev; > + struct phy_device *phydev = hdev->hw.mac.phydev; > + int ret; > + > + if (!phydev) > + return 0; > + > + ret = phy_connect_direct(netdev, phydev, > + hclge_mac_adjust_link, > + PHY_INTERFACE_MODE_SGMII); > + if (ret) { > + pr_info("phy_connect_direct err"); > + return ret; netdev_err(). checkpatch probably gave you a warning about this? > + } > + > + phy_start(phydev); > + > + return 0; > +} > + > +void hclge_mac_stop_phy(struct hclge_dev *hdev) > +{ > + struct net_device *netdev = hdev->vport[0].nic.netdev; > + struct phy_device *phydev = netdev->phydev; > + > + phy_stop(phydev); > + phy_disconnect(phydev); > +} In hclge_mac_start_phy() you check for !phydev. Here you unconditionally use phydev. Seems inconsistent. Andrew