netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Russell King <rmk+kernel@armlinux.org.uk>,
	Jakub Kicinski <jakub.kicinski@netronome.com>,
	Sasha Levin <sashal@kernel.org>,
	netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.19 177/177] net: phy: initialise phydev speed and duplex sanely
Date: Tue, 10 Dec 2019 16:32:21 -0500	[thread overview]
Message-ID: <20191210213221.11921-177-sashal@kernel.org> (raw)
In-Reply-To: <20191210213221.11921-1-sashal@kernel.org>

From: Russell King <rmk+kernel@armlinux.org.uk>

[ Upstream commit a5d66f810061e2dd70fb7a108dcd14e535bc639f ]

When a phydev is created, the speed and duplex are set to zero and
-1 respectively, rather than using the predefined SPEED_UNKNOWN and
DUPLEX_UNKNOWN constants.

There is a window at initialisation time where we may report link
down using the 0/-1 values.  Tidy this up and use the predefined
constants, so debug doesn't complain with:

"Unsupported (update phy-core.c)/Unsupported (update phy-core.c)"

when the speed and duplex settings are printed.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/phy/phy_device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 6144146aec29d..43c4f358eeb8a 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -420,8 +420,8 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
 	mdiodev->device_free = phy_mdio_device_free;
 	mdiodev->device_remove = phy_mdio_device_remove;
 
-	dev->speed = 0;
-	dev->duplex = -1;
+	dev->speed = SPEED_UNKNOWN;
+	dev->duplex = DUPLEX_UNKNOWN;
 	dev->pause = 0;
 	dev->asym_pause = 0;
 	dev->link = 0;
-- 
2.20.1


      parent reply	other threads:[~2019-12-10 21:36 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191210213221.11921-1-sashal@kernel.org>
2019-12-10 21:29 ` [PATCH AUTOSEL 4.19 011/177] rtlwifi: prevent memory leak in rtl_usb_probe Sasha Levin
2019-12-10 21:29 ` [PATCH AUTOSEL 4.19 012/177] libertas: fix a potential NULL pointer dereference Sasha Levin
2019-12-10 21:29 ` [PATCH AUTOSEL 4.19 013/177] ath10k: fix backtrace on coredump Sasha Levin
2019-12-10 21:29 ` [PATCH AUTOSEL 4.19 023/177] ath10k: fix offchannel tx failure when no ath10k_mac_tx_frm_has_freq Sasha Levin
2019-12-10 21:29 ` [PATCH AUTOSEL 4.19 026/177] selftests/bpf: Correct path to include msg + path Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 038/177] mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 054/177] ath10k: Correct error handling of dma_map_single() Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 062/177] Bluetooth: missed cpu_to_le16 conversion in hci_init4_req Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 063/177] Bluetooth: Workaround directed advertising bug in Broadcom controllers Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 064/177] Bluetooth: hci_core: fix init for HCI_USER_CHANNEL Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 065/177] bpf/stackmap: Fix deadlock with rq_lock in bpf_get_stack() Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 071/177] rtl8xxxu: fix RTL8723BU connection failure issue after warm reboot Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 077/177] i40e: initialize ITRN registers with correct values Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 078/177] net: phy: dp83867: enable robust auto-mdix Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 085/177] net: dsa: LAN9303: select REGMAP when LAN9303 enable Sasha Levin
2019-12-10 21:30 ` [PATCH AUTOSEL 4.19 090/177] net: hns3: add struct netdev_queue debug info for TX timeout Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 096/177] libbpf: Fix error handling in bpf_map__reuse_fd() Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 097/177] Bluetooth: Fix advertising duplicated flags Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 099/177] ixgbe: protect TX timestamping from API misuse Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 103/177] rfkill: allocate static minor Sasha Levin
2019-12-11  7:52   ` Greg Kroah-Hartman
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 104/177] bnx2x: Fix PF-VF communication over multi-cos queues Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 107/177] rtlwifi: fix memory leak in rtl92c_set_fw_rsvdpagepkt() Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 117/177] perf tools: Splice events onto evlist even on error Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 121/177] perf parse: If pmu configuration fails free terms Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 127/177] ath10k: fix get invalid tx rate for Mesh metric Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 132/177] ice: delay less Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 141/177] net: bcmgenet: Add RGMII_RXID support Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 150/177] iwlwifi: mvm: fix unaligned read of rx_pkt_status Sasha Levin
2019-12-10 21:31 ` [PATCH AUTOSEL 4.19 153/177] tun: fix data-race in gro_normal_list() Sasha Levin
2019-12-10 21:32 ` [PATCH AUTOSEL 4.19 163/177] brcmfmac: remove monitor interface when detaching Sasha Levin
2019-12-10 21:32 ` [PATCH AUTOSEL 4.19 164/177] iwlwifi: check kasprintf() return value Sasha Levin
2019-12-10 21:32 ` [PATCH AUTOSEL 4.19 166/177] net: ethernet: ti: ale: clean ale tbl on init and intf restart Sasha Levin
2019-12-10 21:32 ` [PATCH AUTOSEL 4.19 170/177] mac80211: consider QoS Null frames for STA_NULLFUNC_ACKED Sasha Levin
2019-12-10 21:32 ` Sasha Levin [this message]

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=20191210213221.11921-177-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=jakub.kicinski@netronome.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).