lkml.org 
[lkml]   [2023]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 20/26] selftests/resctrl: Create struct for input parameters
From
Hi Ilpo,

On 11/20/2023 3:13 AM, Ilpo Järvinen wrote:

...

>
> +static void init_user_params(struct user_params *uparams)
> +{
> + uparams->cpu = 1;
> + uparams->bits = 0;
> +}
> +
> int main(int argc, char **argv)
> {
> bool mbm_test = true, mba_test = true, cmt_test = true;
> - const char *benchmark_cmd[BENCHMARK_ARGS] = {};
> - int c, cpu_no = 1, i, no_of_bits = 0;
> + struct user_params uparams = {};
> char *span_str = NULL;
> bool cat_test = true;
> int tests = 0;
> - int ret;
> + int ret, c, i;
> +
> + init_user_params(&uparams);
>

It is unexpected that this uses a combination of designated
initializer (via {}) as well as an explicit init function to
initialize the struct. I think it would be simpler to do
all initialization in the init function.

Reinette

\
 
 \ /
  Last update: 2023-11-28 23:21    [W:2.324 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site