Re: [PATCH v4 27/28] tools/testing/cxl: Make event logs dynamic
From: Ira Weiny
Date: Wed Oct 23 2024 - 21:59:25 EST
Jonathan Cameron wrote:
> On Mon, 07 Oct 2024 18:16:33 -0500
> Ira Weiny <ira.weiny@xxxxxxxxx> wrote:
>
[snip]
> >
> > Signed-off-by: Ira Weiny <ira.weiny@xxxxxxxxx>
> Might be worth breaking up into refactor (the static cases) and
> then new stuff.
I had it split but the rework became difficult. And this is test code so
I merged it. I'd rather keep it as is.
>
> Otherwise one trivial comment inline.
>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
Thanks.
>
> >
> > ---
> > Changes:
> > [iweiny: rebase to 6.12]
> > ---
> > tools/testing/cxl/test/mem.c | 268 ++++++++++++++++++++++++++-----------------
> > 1 file changed, 162 insertions(+), 106 deletions(-)
> >
> > diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c
> > index ccdd6a504222..5e453aa2819b 100644
> > --- a/tools/testing/cxl/test/mem.c
> > +++ b/tools/testing/cxl/test/mem.c
> > @@ -126,18 +126,26 @@ static struct {
>
> > /* Handle can never be 0 use 1 based indexing for handle */
> > -static u16 event_get_clear_handle(struct mock_event_log *log)
> > +static u16 event_inc_handle(u16 handle)
> > {
> > - return log->clear_idx + 1;
> > + handle = (handle + 1) % CXL_TEST_EVENT_ARRAY_SIZE;
> > + if (!handle)
> > + handle = handle + 1;
>
> That's a little confusing for me
>
> if (handle == 0)
> handle = 1;
Done.
Ira