lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e211b522-83ed-46f9-a114-9cae30f44977@linaro.org>
Date: Thu, 2 Jan 2025 10:40:59 +0100
From: neil.armstrong@...aro.org
To: Martin Blumenstingl <martin.blumenstingl@...glemail.com>,
 linux-amlogic@...ts.infradead.org, linux-phy@...ts.infradead.org
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
 vkoul@...nel.org, kishon@...nel.org
Subject: Re: [PATCH 1/2] phy: amlogic: meson8b-usb2: Use FIELD_PREP instead of
 _SHIFT macros

On 31/12/2024 20:17, Martin Blumenstingl wrote:
> This simplifies the code by re-using the FIELD_PREP helper. No
> functional changes inteded.
> 
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@...glemail.com>
> ---
>   drivers/phy/amlogic/phy-meson8b-usb2.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/phy/amlogic/phy-meson8b-usb2.c b/drivers/phy/amlogic/phy-meson8b-usb2.c
> index d63147c41b8c..d9c761b7c15c 100644
> --- a/drivers/phy/amlogic/phy-meson8b-usb2.c
> +++ b/drivers/phy/amlogic/phy-meson8b-usb2.c
> @@ -5,6 +5,7 @@
>    * Copyright (C) 2016 Martin Blumenstingl <martin.blumenstingl@...glemail.com>
>    */
>   
> +#include <linux/bitfield.h>
>   #include <linux/clk.h>
>   #include <linux/delay.h>
>   #include <linux/io.h>
> @@ -39,9 +40,7 @@
>   	#define REG_CTRL_TX_BITSTUFF_ENN		BIT(18)
>   	#define REG_CTRL_COMMON_ON			BIT(19)
>   	#define REG_CTRL_REF_CLK_SEL_MASK		GENMASK(21, 20)
> -	#define REG_CTRL_REF_CLK_SEL_SHIFT		20
>   	#define REG_CTRL_FSEL_MASK			GENMASK(24, 22)
> -	#define REG_CTRL_FSEL_SHIFT			22
>   	#define REG_CTRL_PORT_RESET			BIT(25)
>   	#define REG_CTRL_THREAD_ID_MASK			GENMASK(31, 26)
>   
> @@ -170,10 +169,10 @@ static int phy_meson8b_usb2_power_on(struct phy *phy)
>   			   REG_CONFIG_CLK_32k_ALTSEL);
>   
>   	regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_REF_CLK_SEL_MASK,
> -			   0x2 << REG_CTRL_REF_CLK_SEL_SHIFT);
> +			   FIELD_PREP(REG_CTRL_REF_CLK_SEL_MASK, 0x2));
>   
>   	regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_FSEL_MASK,
> -			   0x5 << REG_CTRL_FSEL_SHIFT);
> +			   FIELD_PREP(REG_CTRL_FSEL_MASK, 0x5));
>   
>   	/* reset the PHY */
>   	regmap_update_bits(priv->regmap, REG_CTRL, REG_CTRL_POWER_ON_RESET,

Reviewed-by: Neil Armstrong <neil.armstrong@...aro.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ