[PATCH v3 i-g-t 1/2] igt_core_get_igt_hook: igt_hook pointer for other libs
Kamil Konieczny
kamil.konieczny at linux.intel.com
Fri Jul 18 15:34:25 UTC 2025
Hi Peter,
On 2025-07-15 at 15:37:21 +0200, Peter Senna Tschudin wrote:
please change subject from
[PATCH v3 i-g-t 1/2] igt_core_get_igt_hook: igt_hook pointer for other libs
to something like:
[PATCH v3 i-g-t 1/2] lib/igt_core: Expose igt_hook pointer for other libs
This could be done at merge time, no need for resend.
Regards,
Kamil
> Previously, all igt_hooks were defined, initialized, and freed within
> lib/igt_core.c, limiting hook creation to this file. To enable other
> libraries to add hooks, introduce a function that returns a pointer to
> the main hook structure.
>
> This change allows hooks to be created from external libraries without
> requiring separate initialization or teardown of the hook
> infrastructure.
>
> Reviewed-by: Gustavo Sousa <gustavo.sousa at intel.com>
> Signed-off-by: Peter Senna Tschudin <peter.senna at linux.intel.com>
> ---
> v3:
> - unchanged
>
> v2:
> - change function name to igt_core_get_igt_hook()
> - remove duplicated documentation from header
>
> lib/igt_core.c | 12 ++++++++++++
> lib/igt_core.h | 2 ++
> 2 files changed, 14 insertions(+)
>
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index c2674a272..4bfffc3a8 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -3604,3 +3604,15 @@ unsigned int igt_measured_usleep(unsigned int usec)
>
> return igt_nsec_elapsed(&ts) / NSEC_PER_USEC;
> }
> +
> +/**
> + * igt_core_get_igt_hook: To allow for using hooks from other libraries, this
> + * function returns the pointer to the struct that is likely already
> + * initialized.
> + *
> + * Returns: Pointer to the igt_hook structure.
> + */
> +struct igt_hook *igt_core_get_igt_hook(void)
> +{
> + return igt_hook;
> +}
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index 2db579423..e658737b0 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -1601,4 +1601,6 @@ void igt_pci_system_cleanup(void);
> void igt_emit_ignore_dmesg_regex(const char *ignore_dmesg_regex);
>
> unsigned int igt_measured_usleep(unsigned int usec);
> +
> +struct igt_hook *igt_core_get_igt_hook(void);
> #endif /* IGT_CORE_H */
> --
> 2.43.0
>
More information about the igt-dev
mailing list