[PATCH v4 13/15] lib: utils: fdt_pmu: Do not iterate over the fdt_pmu_evt_select table

Anup Patel anup at brainfault.org
Wed Dec 6 04:50:12 PST 2023


On Thu, Nov 30, 2023 at 6:14 PM Yu Chien Peter Lin
<peterlin at andestech.com> wrote:
>
> The valid entry count is tracking by hw_event_count so there
> is no need to check the whole table.
>
> Signed-off-by: Yu Chien Peter Lin <peterlin at andestech.com>

Looks good to me.

Reviewed-by: Anup Patel <anup at brainfault.org>

Regards,
Anup

> ---
> Changes v2 -> v3:
>   - New patch
> Changes v3 -> v4:
>   - No change
> ---
>  lib/utils/fdt/fdt_pmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/utils/fdt/fdt_pmu.c b/lib/utils/fdt/fdt_pmu.c
> index cf3220f..c531b9a 100644
> --- a/lib/utils/fdt/fdt_pmu.c
> +++ b/lib/utils/fdt/fdt_pmu.c
> @@ -25,7 +25,7 @@ uint64_t fdt_pmu_get_select_value(uint32_t event_idx)
>         int i;
>         struct fdt_pmu_hw_event_select_map *event;
>
> -       for (i = 0; i < SBI_PMU_HW_EVENT_MAX; i++) {
> +       for (i = 0; i < hw_event_count; i++) {
>                 event = &fdt_pmu_evt_select[i];
>                 if (event->eidx == event_idx)
>                         return event->select;
> --
> 2.34.1
>



More information about the opensbi mailing list