[igt-dev] [PATCH i-g-t v2 1/3] lib/ioctl_wrapper: Add i915_get_param helper

Katarzyna Dec katarzyna.dec at intel.com
Mon Nov 26 06:18:33 UTC 2018


On Fri, Nov 23, 2018 at 04:25:07PM +0100, Lukasz Kalamarz wrote:
> getparam is used in few places across IGT, but no helper function
> is used to reduce code duplication.
> 
> Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz at intel.com>
> 
> Cc: Michal Winiarski <michal.winiarski at intel.com>
> Cc: Katarzyna Dec <katarzyna.dec at intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
> ---
>  lib/ioctl_wrappers.c | 13 +++++++++++++
>  lib/ioctl_wrappers.h |  1 +
>  2 files changed, 14 insertions(+)
> 
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index 9f255508..8fea9fa9 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -468,6 +468,19 @@ void gem_sync(int fd, uint32_t handle)
>  	errno = 0;
>  }
>  
> +int drm_get_param(int fd, uint32_t param)
> +{
> +	int value;
> +	drm_i915_getparam_t gp = {
> +		.param = param,
> +		.value = &value
> +	};
> +
> +	if (igt_ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp) == -1)
> +		return NULL;
Whole function returns int and here you are returning NULL. Compiler warns 
about it. Maybe -EINVAL or something similar?

Kasia :)


More information about the igt-dev mailing list