From patchwork Thu Apr 13 18:07:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 1768589 X-Patchwork-Delegate: rfried.dev@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256 header.s=ti-com-17Q1 header.b=SmYdKBss; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Py6xm0G75z1yZn for ; Fri, 14 Apr 2023 04:07:56 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B26AE85C6E; Thu, 13 Apr 2023 20:07:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="SmYdKBss"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A9B0085B34; Thu, 13 Apr 2023 20:07:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (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 2E85285A83 for ; Thu, 13 Apr 2023 20:07:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=nm@ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 33DI7F9b092862; Thu, 13 Apr 2023 13:07:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1681409235; bh=PBarXLfbgOiWo77GAmC248RQsY+OVZVLBthRTIxFD84=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=SmYdKBss/17qlk2q06kWWyOq6jDaOg1EbRYmVDtBh1B5Fr3+INduB7WrEZPLh/ne9 jGNeE2PZ2vWZzHiOgKCHbNYEX//tqDalGEZ4TG9LUhL4lcG+N6g1H1ZVVSK/kwuyQN 0MN5oEDrHOuj6GoUnzYNqHVbwX9kr0mpNUudZ9Ew= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 33DI7FXr028534 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 13 Apr 2023 13:07:15 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Thu, 13 Apr 2023 13:07:14 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16 via Frontend Transport; Thu, 13 Apr 2023 13:07:15 -0500 Received: from localhost (ileaxei01-snat.itg.ti.com [10.180.69.5]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 33DI7FfO021933; Thu, 13 Apr 2023 13:07:15 -0500 From: Nishanth Menon To: Marek Vasut , Tom Rini CC: Siddharth Vadapalli , Vignesh Raghavendra , Michal Simek , Ramon Fried , , Nishanth Menon Subject: [PATCH 1/2] net: phy: Make phy_interface_is_sgmii a switch statement Date: Thu, 13 Apr 2023 13:07:12 -0500 Message-ID: <20230413180713.2922524-2-nm@ti.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230413180713.2922524-1-nm@ti.com> References: <20230413180713.2922524-1-nm@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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.8 at phobos.denx.de X-Virus-Status: Clean Recent commit 75d28899e3e9 ("net: phy: Synchronize PHY interface modes with Linux") reordered the enum definitions. This caused the range of enums that this api was checking to go bad. While it is possible for the phy drivers to practically use the enum's directly, drivers such as dp83867 use this helper to manage the configuration of the phy correctly. Reported-by: Tom Rini Signed-off-by: Nishanth Menon --- include/phy.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/phy.h b/include/phy.h index a837fed72352..1c4dc23bc5ba 100644 --- a/include/phy.h +++ b/include/phy.h @@ -373,8 +373,16 @@ static inline bool phy_interface_is_rgmii(struct phy_device *phydev) */ static inline bool phy_interface_is_sgmii(struct phy_device *phydev) { - return phydev->interface >= PHY_INTERFACE_MODE_SGMII && - phydev->interface <= PHY_INTERFACE_MODE_QSGMII; + switch (phydev->interface) { + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_QUSGMII: + case PHY_INTERFACE_MODE_USXGMII: + case PHY_INTERFACE_MODE_QSGMII: + return 1; + default: + fallthrough; + } + return 0; } bool phy_interface_is_ncsi(void);