[LTP] [PATCH 1/4] tst_kernel: Add safe_check_driver()
Petr Vorel
pvorel@suse.cz
Fri Oct 13 14:24:08 CEST 2023
Hi All,
...
> int tst_check_driver(const char *driver);
> +/*
> + * Checks support for the kernel module (both built-in and loadable)
> + * and exit with TCONF if driver not available.
> + *
> + * @param driver The name of the driver.
> + * On Android it *always* passes (always expect the driver is available).
> + */
> +void safe_check_driver(const char *driver);
In the end, I haven't used this function in the second commit,
thus this function is useless (used only on single place).
I'll remove it in v2 (still waiting for more input if whole .modprobe option is
worth of merging).
Kind regards,
Petr
> +
> #endif /* TST_KERNEL_H__ */
> diff --git a/lib/tst_kernel.c b/lib/tst_kernel.c
> index 4b75ceadb..de4c28308 100644
> --- a/lib/tst_kernel.c
> +++ b/lib/tst_kernel.c
> @@ -198,3 +198,9 @@ int tst_check_driver(const char *driver)
> return -1;
> }
> +
> +void safe_check_driver(const char *driver)
> +{
> + if (tst_check_driver(driver))
> + tst_brkm(TCONF, NULL, "%s driver not available", driver);
> +}
> diff --git a/lib/tst_test.c b/lib/tst_test.c
> index c2f8f503f..087c62a16 100644
> --- a/lib/tst_test.c
> +++ b/lib/tst_test.c
> @@ -1191,8 +1191,7 @@ static void do_setup(int argc, char *argv[])
> int i;
> for (i = 0; (name = tst_test->needs_drivers[i]); ++i)
> - if (tst_check_driver(name))
> - tst_brk(TCONF, "%s driver not available", name);
> + safe_check_driver(name);
> }
> if (tst_test->mount_device)
More information about the ltp
mailing list