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 535CDC77B6E for ; Fri, 14 Apr 2023 08:39:11 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0B18085EE0; Fri, 14 Apr 2023 10:39:08 +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="nRC3U/uX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 511BD85EF5; Fri, 14 Apr 2023 10:39:03 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (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 D4CD685ECF for ; Fri, 14 Apr 2023 10:38:59 +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 0A2FD61616; Fri, 14 Apr 2023 08:38:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F015C433D2; Fri, 14 Apr 2023 08:38:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681461537; bh=VdEwjMnuSfG84/VH5Jr63YvqTcV0o+BhJU9zrKnXVfw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nRC3U/uXWMnboejWry219Z9yNEx1EjPSX511OuolACNbE1X+pUy7v01StXHxJXw4T 41Y/xkL06i7VD9uF+9ZFOSSfzNVg13wYoebrmZp0a7zxmgLeq9Xl5L72tUA9e+vjsO NLL62HAG6f6cIbOjRZvxpPpAl2Pxe5hw9UE/xQR0F+GKJcMKWqtAkiSQFejUsNcIk0 uloeRPiT7ZWc2zfvXFTpotKJ+ltjGYAVZEjtZSGIxbhV0c3AUs9ak+hWHEoPUZyrZz Y0N8DqLijGNQj41e08nBrQmcrUnqM2T1WBRq4lTMewXyQYIo3H3wh8v7LTvMSNFVnV ldFP82uN5D6RA== Date: Fri, 14 Apr 2023 10:38:52 +0200 From: Marek =?UTF-8?B?QmVow7pu?= To: Nishanth Menon Cc: Marek Vasut , Tom Rini , Siddharth Vadapalli , Vignesh Raghavendra , Michal Simek , Ramon Fried , Subject: Re: [PATCH V2 1/2] net: phy: Make phy_interface_is_sgmii a switch statement Message-ID: <20230414103852.38705065@dellmb> In-Reply-To: <20230414042433.3436425-2-nm@ti.com> References: <20230414042433.3436425-1-nm@ti.com> <20230414042433.3436425-2-nm@ti.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.37; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 On Thu, 13 Apr 2023 23:24:32 -0500 Nishanth Menon wrote: > 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. >=20 > 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. >=20 > Reported-by: Tom Rini > Signed-off-by: Nishanth Menon > --- > Changes Since v1: > * Switch update based on feedback from Marek >=20 > V1: https://lore.kernel.org/r/20230413180713.2922524-2-nm@ti.com >=20 > include/phy.h | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) >=20 > diff --git a/include/phy.h b/include/phy.h > index a837fed72352..51dadcf14478 100644 > --- a/include/phy.h > +++ b/include/phy.h > @@ -373,8 +373,15 @@ 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 >=3D PHY_INTERFACE_MODE_SGMII && > - phydev->interface <=3D 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: > + return 0; > + } > } > =20 > bool phy_interface_is_ncsi(void); Reviewed-by: Marek Beh=C3=BAn Please also consider dropping this function, since it is used only in one driver drivers/net/phy/dp83867.c and that device does not actually support QUSGMII, USXGMII nor QSGMII. It only supports SGMII. With rgmii, the corresponding phy_interface_is_rgmii() function makes sense, but for SGMII the four modes are entirely too different for this to make sense. Marek