lkml.org 
[lkml]   [2022]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 01/18] phy: mediatek: add a new helper to update bitfield
From
Il 20/09/22 11:00, Chunfeng Yun ha scritto:
> Due to FIELD_PREP() macro can be used to prepare a bitfield value,
> local ones can be remove; add the new helper to make bitfield update
> easier.
>
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
> drivers/phy/mediatek/phy-mtk-io.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/phy/mediatek/phy-mtk-io.h b/drivers/phy/mediatek/phy-mtk-io.h
> index 500fcdab165d..a723d4afc9b4 100644
> --- a/drivers/phy/mediatek/phy-mtk-io.h
> +++ b/drivers/phy/mediatek/phy-mtk-io.h
> @@ -8,6 +8,7 @@
> #ifndef __PHY_MTK_H__
> #define __PHY_MTK_H__
>
> +#include <linux/bitfield.h>
> #include <linux/io.h>
>
> static inline void mtk_phy_clear_bits(void __iomem *reg, u32 bits)
> @@ -35,4 +36,10 @@ static inline void mtk_phy_update_bits(void __iomem *reg, u32 mask, u32 val)
> writel(tmp, reg);
> }
>
> +/* field @mask should be constant and continuous */

"Field @mask shall be [...]"
^^^^^

> +static inline void mtk_phy_update_field(void __iomem *reg, u32 mask, u32 val)

...so, (void __iomem *reg, const u32 mask, u32 val)

> +{
> + mtk_phy_update_bits(reg, mask, FIELD_PREP(mask, val));
> +}
> +
> #endif


\
 
 \ /
  Last update: 2022-09-21 10:17    [W:0.145 / U:0.780 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site