Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1699156
| From | Andrew Lunn <andrew@lunn.ch> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH V5 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC |
| Date | 2017-07-29 01:30 +0200 |
| Message-ID | <u8mRH-24E-9@gated-at.bofh.it> (permalink) |
| References | <u8lVD-1pM-3@gated-at.bofh.it> <u8lVE-1pM-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> +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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH V5 net-next 0/8] Hisilicon Network Subsystem 3 Ethernet Driver Salil Mehta <salil.mehta@huawei.com> - 2017-07-29 00:30 +0200
[PATCH V5 net-next 5/8] net: hns3: Add support of TX Scheduler & Shaper to HNS3 driver Salil Mehta <salil.mehta@huawei.com> - 2017-07-29 00:30 +0200
[PATCH V5 net-next 8/8] net: hns3: Add HNS3 driver to kernel build framework & MAINTAINERS Salil Mehta <salil.mehta@huawei.com> - 2017-07-29 00:30 +0200
[PATCH V5 net-next 2/8] net: hns3: Add support of the HNAE3 framework Salil Mehta <salil.mehta@huawei.com> - 2017-07-29 00:30 +0200
Re: [PATCH V5 net-next 2/8] net: hns3: Add support of the HNAE3 framework Leon Romanovsky <leon@kernel.org> - 2017-07-30 12:00 +0200
RE: [PATCH V5 net-next 2/8] net: hns3: Add support of the HNAE3 framework Salil Mehta <salil.mehta@huawei.com> - 2017-07-31 11:10 +0200
[PATCH V5 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Salil Mehta <salil.mehta@huawei.com> - 2017-07-29 00:30 +0200
Re: [PATCH V5 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Andrew Lunn <andrew@lunn.ch> - 2017-07-29 01:30 +0200
RE: [PATCH V5 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Salil Mehta <salil.mehta@huawei.com> - 2017-07-29 02:00 +0200
Re: [PATCH V5 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Andrew Lunn <andrew@lunn.ch> - 2017-07-29 01:30 +0200
RE: [PATCH V5 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Salil Mehta <salil.mehta@huawei.com> - 2017-07-29 02:00 +0200
[PATCH V5 net-next 3/8] net: hns3: Add HNS3 IMP(Integrated Mgmt Proc) Cmd Interface Support Salil Mehta <salil.mehta@huawei.com> - 2017-07-29 00:40 +0200
csiph-web