From patchwork Thu Jan 2 22:06:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 234603 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 5324CC3276F for ; Thu, 2 Jan 2020 22:47:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D2B6217F4 for ; Thu, 2 Jan 2020 22:47:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578005223; bh=jP6KN6XiXG5xNENjBcemcMG4vu/MV2NrrgYH7HFgZ+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ILpSvCNLkkAzf6h0WJLKi7jp98Dr9qbkfQ+PYkJ+NnN7FnMJn44jZY8defrAjivnm sjvf/Wyx86o0/DMjm18T355a39/c+EBHbp2hb/sFKioX1I7tD6y+xA6WC/a3Olqaw9 BYJLa5Bn0njDl2xlJyUengpg1dSKbaEuU7/YCnJk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729846AbgABWaM (ORCPT ); Thu, 2 Jan 2020 17:30:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:33620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730138AbgABWaL (ORCPT ); Thu, 2 Jan 2020 17:30:11 -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 A44ED222C3; Thu, 2 Jan 2020 22:30:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004210; bh=jP6KN6XiXG5xNENjBcemcMG4vu/MV2NrrgYH7HFgZ+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2aRfdZXr1iSqC4eMyceDFEi/C2wL/X1JyHewzNGbStX55xaCiacqWzV1JxCTM//sC e6mJcoY99rOQFTvW4vq0Fk4ASOhYO6sYRZtY4lyslCawUKZpA8NsMAxSBYZ13Ee9vq 1dpHiMeZ2pqhGMuKAuscdiXsJh7ubkZaMmH0Qgqw= 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.9 084/171] net: phy: initialise phydev speed and duplex sanely Date: Thu, 2 Jan 2020 23:06:55 +0100 Message-Id: <20200102220558.639058050@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.960200039@linuxfoundation.org> References: <20200102220546.960200039@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 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 5c2c72b1ef8b..3289fd910c4a 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -324,8 +324,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;