From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AC3CC43603 for ; Tue, 10 Dec 2019 22:06:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D94642053B for ; Tue, 10 Dec 2019 22:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576015560; bh=6GAzeJnc3BpVSu5YGYql2j/HbyBd4pfeYwlXFb1L5SY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xip16WoGHVgsPe4uvX1HH56cXVFuutonOx7M75ww+43Hp158AcJVc3FSGj05qjy5I pNFJKcBEAzkfxwE95x6LN6gj7zrD7lmv/XOGEMbObpARIp93Hv2ytj9TobUXHb+Dbk 8pz2xyPSZfwb+X9PqCCrtVf6lmPXmoVjZAI+kQbQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730031AbfLJWFi (ORCPT ); Tue, 10 Dec 2019 17:05:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:37282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727779AbfLJWFh (ORCPT ); Tue, 10 Dec 2019 17:05:37 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4EF5820838; Tue, 10 Dec 2019 22:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576015537; bh=6GAzeJnc3BpVSu5YGYql2j/HbyBd4pfeYwlXFb1L5SY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VrXb5PmmjBrS7RFu1fD7zSsu2RduG2iu7Sw/V99yJb/s1GroWGjsNC6SBp6hhhH8T DM0bHoEnMgHkzV+yGMJSHwg7aTD4XcHpO2OW3jiHu2QQFjCHYIK5aeN5y2oNmrZGOz GOafNYcd/tCofsB9vN6HGeeC5ZLVSlw/kHH+z9PU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Russell King , Jakub Kicinski , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 130/130] net: phy: initialise phydev speed and duplex sanely Date: Tue, 10 Dec 2019 17:03:01 -0500 Message-Id: <20191210220301.13262-130-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191210220301.13262-1-sashal@kernel.org> References: <20191210220301.13262-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Russell King [ 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 Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- 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 ed7e3c70b511a..a98c227a4c2eb 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -367,8 +367,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 = 1; -- 2.20.1