Skip to content

Commit ff436ce

Browse files
rmurphy-armwilldeacon
authored andcommitted
perf/arm-cmn: Improve build-time assertion
These days we can use static_assert() in the logical place rather than jamming a BUILD_BUG_ON() into the nearest function scope. Signed-off-by: Robin Murphy <[email protected]> Link: https://lore.kernel.org/r/224ee8286f299100f1c768edb254edc898539f50.1725296395.git.robin.murphy@arm.com Signed-off-by: Will Deacon <[email protected]>
1 parent 359414b commit ff436ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/perf/arm-cmn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ struct arm_cmn_hw_event {
581581
bool wide_sel;
582582
enum cmn_filter_select filter_sel;
583583
};
584+
static_assert(sizeof(struct arm_cmn_hw_event) <= offsetof(struct hw_perf_event, target));
584585

585586
#define for_each_hw_dn(hw, dn, i) \
586587
for (i = 0, dn = hw->dn; i < hw->num_dns; i++, dn++)
@@ -591,7 +592,6 @@ struct arm_cmn_hw_event {
591592

592593
static struct arm_cmn_hw_event *to_cmn_hw(struct perf_event *event)
593594
{
594-
BUILD_BUG_ON(sizeof(struct arm_cmn_hw_event) > offsetof(struct hw_perf_event, target));
595595
return (struct arm_cmn_hw_event *)&event->hw;
596596
}
597597

0 commit comments

Comments
 (0)