Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753273AbdG1Xux convert rfc822-to-8bit (ORCPT ); Fri, 28 Jul 2017 19:50:53 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:32408 "EHLO lhrrgout.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752987AbdG1Xuv (ORCPT ); Fri, 28 Jul 2017 19:50:51 -0400 From: Salil Mehta To: Andrew Lunn CC: "davem@davemloft.net" , "Zhuangyuzeng (Yisen)" , huangdaode , "lipeng (Y)" , "mehta.salil.lnk@gmail.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-rdma@vger.kernel.org" , Linuxarm Subject: RE: [PATCH V5 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Thread-Topic: [PATCH V5 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Thread-Index: AQHTB/DFF2KBu87m90Sc3N4NhPX+9qJpv+cAgAAnqDA= Date: Fri, 28 Jul 2017 23:50:38 +0000 Message-ID: References: <20170728222652.118448-1-salil.mehta@huawei.com> <20170728222652.118448-7-salil.mehta@huawei.com> <20170728232428.GA16080@lunn.ch> In-Reply-To: <20170728232428.GA16080@lunn.ch> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.203.181.161] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.597BCDD9.011E,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=169.254.1.170, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 3d18812e9a6ba4b9c6bf9636f8a7dc0a Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2116 Lines: 76 Hi Andrew, > -----Original Message----- > From: Andrew Lunn [mailto:andrew@lunn.ch] > Sent: Saturday, July 29, 2017 12:24 AM > To: Salil Mehta > Cc: davem@davemloft.net; Zhuangyuzeng (Yisen); huangdaode; lipeng (Y); > mehta.salil.lnk@gmail.com; netdev@vger.kernel.org; linux- > kernel@vger.kernel.org; linux-rdma@vger.kernel.org; Linuxarm > Subject: Re: [PATCH V5 net-next 6/8] net: hns3: Add MDIO support to > HNS3 Ethernet driver for hip08 SoC > > > +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() Ok sure. Will replace in next patch. > > > +} > > + > > +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? No, it did not. > > > + } > > + > > + 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. Yes, I think NULL check for phy should be present here as well. > > Andrew