From patchwork Thu Jan 2 22:07:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 234651 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 12402C3276C for ; Thu, 2 Jan 2020 22:42:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D0D17217F4 for ; Thu, 2 Jan 2020 22:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004934; bh=psSNuHyV0x39rytkj+SP8pjVjZWAdMv+Y7KppM9mQcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Oe6ihsusYDyoCqyL+4vcku7621x4CFPN0U0UaWXWm9Ktjhg5fnJMVjShgm2kCcrRr fW5sabIiICO/e6AFVpTybyYilH5ss3XCosFJUmd/3NxiXCCkfTfNfJvTXpDKuF0lzp 8hd9/CZIJiQKn+8LxF+6gK02fvJypWpz32yTYQcc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730527AbgABWgS (ORCPT ); Thu, 2 Jan 2020 17:36:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:47180 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730924AbgABWgR (ORCPT ); Thu, 2 Jan 2020 17:36:17 -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 D7B7520866; Thu, 2 Jan 2020 22:36:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004576; bh=psSNuHyV0x39rytkj+SP8pjVjZWAdMv+Y7KppM9mQcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SaCXsikEm7RsmzwIGnBLBVG40Z8mWSnoIKl/5noNSaFlVazwJFnDTGCxogGe4l6Yz l0/cNgTvmfT+Fxtq+MBKDA5epS44R96OvM8DNn+yc2gEATYQ+D4NlnXD6qoRUsHc8R lnR7+i+3uHV3SYxZZ1YKw4ta2oWp33swpQEpd50M= 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.4 065/137] net: phy: initialise phydev speed and duplex sanely Date: Thu, 2 Jan 2020 23:07:18 +0100 Message-Id: <20200102220555.282764358@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.618583146@linuxfoundation.org> References: <20200102220546.618583146@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 c6a87834723d..b15eceb8b442 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -161,8 +161,8 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, dev->dev.release = phy_device_release; - dev->speed = 0; - dev->duplex = -1; + dev->speed = SPEED_UNKNOWN; + dev->duplex = DUPLEX_UNKNOWN; dev->pause = 0; dev->asym_pause = 0; dev->link = 1;