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 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 67492C433EF for ; Tue, 29 Mar 2022 20:11:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B10F784071; Tue, 29 Mar 2022 22:10:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="UlWQhcNU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5DC2F84072; Tue, 29 Mar 2022 22:09:27 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9894184078 for ; Tue, 29 Mar 2022 22:09:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1AF17616D2; Tue, 29 Mar 2022 20:09:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07615C34100; Tue, 29 Mar 2022 20:09:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648584546; bh=Gkitg/h1pYkY3ICBlmYBr9eVyPc1X7EBfKOAaHiKT2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UlWQhcNUW+OGXxyfPR8mc2owEN6t5SSIxBprYEHd4/yXXYbJXY3shcoGxx+7X9wnp LelRX2y0acUiafW5EJf0u7ysp3GLkf8VO1a2XfpKc3sgrsXUqDYHUYVNyxDl3SWM01 D8TwlvOPgrMZkeOKnTAGT1T8yJk0RroDGlNg72WWzt+KZGaD5KsyIWzvI3G+THwDED tj8hvl9Fbz8lMWJrVzZ31YEdFPf9Zfn9lAx4uk1YMxI8T6VRoESTPknL/xJ7QNQsQU bCTN2+oYq8NZufR2eWo8bXC3Xwq7I9YmeblddHFEcmZDqbjfDwzyoJUKM52kdPpkuB UnXMVvdAZW1ow== From: =?UTF-8?q?Marek=20Beh=C3=BAn?= To: Joe Hershberger , Ramon Fried Cc: u-boot@lists.denx.de, =?UTF-8?q?Marek=20Beh=C3=BAn?= Subject: [PATCH u-boot-net v3 11/14] net: phy: xilinx: Check interface type in ->config(), not ->probe() Date: Tue, 29 Mar 2022 22:08:42 +0200 Message-Id: <20220329200845.13435-12-kabel@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220329200845.13435-1-kabel@kernel.org> References: <20220329200845.13435-1-kabel@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean From: Marek BehĂșn We want to be able to have phydev->interface uninitialized during ->probe(). We should assume that phydev->interface is initialized only before ->config(). Signed-off-by: Marek BehĂșn Reviewed-by: Ramon Fried --- drivers/net/phy/xilinx_gmii2rgmii.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c index 635c0570ef..d92a364365 100644 --- a/drivers/net/phy/xilinx_gmii2rgmii.c +++ b/drivers/net/phy/xilinx_gmii2rgmii.c @@ -26,6 +26,11 @@ static int xilinxgmiitorgmii_config(struct phy_device *phydev) debug("%s\n", __func__); + if (phydev->interface != PHY_INTERFACE_MODE_GMII) { + printf("Incorrect interface type\n"); + return -EINVAL; + } + if (!ofnode_valid(node)) return -EINVAL; @@ -114,11 +119,6 @@ static int xilinxgmiitorgmii_probe(struct phy_device *phydev) { debug("%s\n", __func__); - if (phydev->interface != PHY_INTERFACE_MODE_GMII) { - printf("Incorrect interface type\n"); - return -EINVAL; - } - phydev->flags |= PHY_FLAG_BROKEN_RESET; return 0; -- 2.34.1