mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 01:46:14 +00:00
lib/igt_debugfs: implement a singleton igt_debugfs_t instance
Allows us to remove every so little bit of boilerplate from tests, once it's all rolled out. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
8fe0c50871
commit
28b6e41142
@ -121,6 +121,22 @@ void igt_debugfs_init(igt_debugfs_t *debugfs)
|
||||
igt_assert(__igt_debugfs_init(debugfs));
|
||||
}
|
||||
|
||||
static igt_debugfs_t *__igt_debugfs_singleton(void)
|
||||
{
|
||||
static igt_debugfs_t singleton;
|
||||
static bool init_done = false;
|
||||
|
||||
if (init_done)
|
||||
return &singleton;
|
||||
|
||||
if (__igt_debugfs_init(&singleton)) {
|
||||
init_done = true;
|
||||
return &singleton;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* igt_debugfs_open:
|
||||
* @debugfs: debugfs access structure
|
||||
|
Loading…
x
Reference in New Issue
Block a user