[PATCH v5 03/13] coresight: Refactor etm4_config_timestamp_event()

Leo Yan leo.yan at arm.com
Thu Nov 20 06:25:20 PST 2025


On Thu, Nov 20, 2025 at 02:18:21PM +0000, Coresight ML wrote:

[...]

> Maybe define a general macro but with extra checking:
> 
>   #define TRCCNTCTLRn_RLDEVENT_MASK  GENMASK(15, 8)
> 
>   #define ETM4_RS_SEL_EVENT(paired, sel) ({  \
>       if (paired)                            \
>           assert(!(sel & ~GENMASK(3, 0)));   \
>       else                                   \
>           assert(!(sel & ~GENMASK(4, 0)));   \
>       FIELD_PREP(TRCCNTCTLRn_RLDEVENT_MASK,  \
>                  ((paird << 7) | sel));      \
>   })

It'd be better to use BUILD_BUG_ON() instead of assert().



More information about the linux-arm-kernel mailing list