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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 225DAC2D0DA for ; Sun, 29 Dec 2019 17:35:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E8920206DB for ; Sun, 29 Dec 2019 17:35:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640909; bh=QZriP42SgxFT1RwFa1gb7ml26ZmfpRh4EpqdYgHb5q8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=GtO7zEPWc0ltfa/3f6o7dXUPCDSfLnq++BxaL+vxTyP1Dc93pBziwul68Riw02/tY vD+/J7SSXL5GGymQIzBTNqnfh/truvUc4m7q9HrINjM4FFX6pembFOuR3+UoXo4xE5 NlX+9ka4wMeafvyTiOF7Ui9UpYC4GCFIC0p6DxjE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729377AbfL2RfE (ORCPT ); Sun, 29 Dec 2019 12:35:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:39014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729485AbfL2RfD (ORCPT ); Sun, 29 Dec 2019 12:35:03 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4DFC821744; Sun, 29 Dec 2019 17:35:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577640902; bh=QZriP42SgxFT1RwFa1gb7ml26ZmfpRh4EpqdYgHb5q8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=15d5PbCFALZ8yZm3MPLCdcomWPImFnLk0FN1cQffEZZwQRO5uIAAzDMvWrFhPN0BY GTQoFo8BszZYMxobkU3nQgx9vapfzlJpx3GySP8d9enFnSwyH8R797ji/mUUZRR4a3 bqIwhPaQAA1myC3o81DqrVuD6jZHs13tK/NQp3b4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Russell King , Jakub Kicinski , Sasha Levin Subject: [PATCH 4.19 187/219] net: phy: initialise phydev speed and duplex sanely Date: Sun, 29 Dec 2019 18:19:49 +0100 Message-Id: <20191229162537.769925264@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229162508.458551679@linuxfoundation.org> References: <20191229162508.458551679@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 6144146aec29..43c4f358eeb8 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