Re: [igt-dev] [PATCH i-g-t 1/3] lib: Add helper for reading modparam values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 18 Mar 2021 at 16:24, Tvrtko Ursulin
<tvrtko.ursulin@xxxxxxxxxxxxxxx> wrote:
>
> From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
>
> Add __igt_params_get for simple reading of modparams.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
> ---
>  lib/igt_params.c | 26 ++++++++++++++++++++++++++
>  lib/igt_params.h |  2 ++
>  2 files changed, 28 insertions(+)
>
> diff --git a/lib/igt_params.c b/lib/igt_params.c
> index c06416988baa..1dc6de77b2e0 100644
> --- a/lib/igt_params.c
> +++ b/lib/igt_params.c
> @@ -156,6 +156,32 @@ int igt_params_open(int device)
>         return params;
>  }
>
> +/**
> + * __igt_params_get:
> + * @device: fd of the device
> + * @parameter: the name of the parameter to set

to get

> + *
> + * This reads the value of the modparam.
> + *
> + * Returns:
> + * A nul-terminated string, must be freed by caller after use, or NULL
> + * on failure.
> + */
> +char *__igt_params_get(int device, const char *parameter)
> +{
> +       char *str;
> +       int dir;
> +
> +       dir = igt_params_open(device);
> +       if (dir < 0)
> +               return NULL;
> +
> +       str = igt_sysfs_get(dir, parameter);
> +       close(dir);
> +
> +       return str;
> +}

Reviewed-by: Matthew Auld <matthew.auld@xxxxxxxxx>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux