From 6aa77bc0efc27d976f2d478ca54fa59a7c47e934 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 28 May 2023 18:38:52 -0700 Subject: til_setup,*: note settings path in til_setup_t This commit adds passing the settings instance to til_setup_new() which is used for deriving a path for the setup via til_settings_print_path() on the supplied settings. That path gets an allocated copy left in the returned til_setup_t at til_setup_t.path This path will exist for the lifetime of the til_setup_t, to be freed along with the rest of the baked setup instance when the refcount reaches 0. The incoming til_settings_t is only read @ til_setup_new() in constructing the path, no reference is kept. Basically the til_settings_t* is just passed in for convenience reasons, since constructing the path needs memory and may fail, this approach lets the existing til_setup_new() call error handling also capture the path allocation failures as-is turning til_setup_new() into a bit more of a convenience helper. Note that now all code may assume a til_setup_t has a set and valid til_setup_t.path, which should be useful for context creates when a setup is available. --- src/drm_fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/drm_fb.c') diff --git a/src/drm_fb.c b/src/drm_fb.c index d23a2f7..fe2fefd 100644 --- a/src/drm_fb.c +++ b/src/drm_fb.c @@ -301,7 +301,7 @@ static void drm_fb_setup_free(til_setup_t *setup) /* positive value indicates another setting is needed, described in next_setting */ static int drm_fb_setup(const til_settings_t *settings, til_setting_t **res_setting, const til_setting_desc_t **res_desc, til_setup_t **res_setup) { - drm_fb_setup_t *setup = til_setup_new(sizeof(*setup), drm_fb_setup_free); + drm_fb_setup_t *setup = til_setup_new(settings, sizeof(*setup), drm_fb_setup_free); til_setting_desc_generator_t generators[] = { { .key = "dev", -- cgit v1.2.1