public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Salil Mehta <salil.mehta@huawei.com>
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
Date: Sat, 29 Jul 2017 01:24:28 +0200	[thread overview]
Message-ID: <20170728232428.GA16080@lunn.ch> (raw)
In-Reply-To: <20170728222652.118448-7-salil.mehta@huawei.com>

> +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

  reply	other threads:[~2017-07-28 23:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-28 22:26 [PATCH V5 net-next 0/8] Hisilicon Network Subsystem 3 Ethernet Driver Salil Mehta
2017-07-28 22:26 ` [PATCH V5 net-next 1/8] net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC Salil Mehta
2017-07-28 22:26 ` [PATCH V5 net-next 2/8] net: hns3: Add support of the HNAE3 framework Salil Mehta
     [not found]   ` <20170728222652.118448-3-salil.mehta-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-07-30  9:58     ` Leon Romanovsky
2017-07-31  9:04       ` Salil Mehta
     [not found] ` <20170728222652.118448-1-salil.mehta-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-07-28 22:26   ` [PATCH V5 net-next 3/8] net: hns3: Add HNS3 IMP(Integrated Mgmt Proc) Cmd Interface Support Salil Mehta
2017-07-28 22:26 ` [PATCH V5 net-next 4/8] net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support Salil Mehta
2017-07-28 22:26 ` [PATCH V5 net-next 5/8] net: hns3: Add support of TX Scheduler & Shaper to HNS3 driver Salil Mehta
2017-07-28 22:26 ` [PATCH V5 net-next 6/8] net: hns3: Add MDIO support to HNS3 Ethernet driver for hip08 SoC Salil Mehta
2017-07-28 23:24   ` Andrew Lunn [this message]
     [not found]     ` <20170728232428.GA16080-g2DYL2Zd6BY@public.gmane.org>
2017-07-28 23:50       ` Salil Mehta
     [not found]   ` <20170728222652.118448-7-salil.mehta-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2017-07-28 23:28     ` Andrew Lunn
2017-07-28 23:52       ` Salil Mehta
2017-07-28 22:26 ` [PATCH V5 net-next 7/8] net: hns3: Add Ethtool support to HNS3 driver Salil Mehta
2017-07-28 23:49   ` Andrew Lunn
2017-07-28 23:57     ` Salil Mehta
2017-07-31 15:05     ` Salil Mehta
2017-07-28 22:26 ` [PATCH V5 net-next 8/8] net: hns3: Add HNS3 driver to kernel build framework & MAINTAINERS Salil Mehta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170728232428.GA16080@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=huangdaode@hisilicon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lipeng321@huawei.com \
    --cc=mehta.salil.lnk@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=salil.mehta@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox