Linux Test Project
 help / color / mirror / Atom feed
From: Li Wang <li.wang@linux.dev>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 2/4] tst_kconfig: load and unload kernel modules for CONFIG_*=m
Date: Wed, 14 Oct 2026 11:36:31 +0800	[thread overview]
Message-ID: <as74VdT9VULCDMWM@linux.dev> (raw)
In-Reply-To: <KAcS5WJbQyPKbiDel0IQZfd4x2rnMBTRIRb9@localhost.localdomain>

On Mon, Oct 12, 2026 at 04:09:29PM +0000, Andrea Cervesato wrote:
> Hi Li,
> 
> > +static const char *module_name_for_config(const char *cfg)
> > +{
> > +	size_t i;
> > +
> > +	for (i = 0; config_module_maps[i].config; i++) {
> > +		if (!strcmp(config_module_maps[i].config, cfg))
> > +			return config_module_maps[i].module_name;
> > +	}
> > +
> > +	return NULL;
> > +}
> 
> This is used only once, we don't need to define a new function.
> We can leave it inside kconfig_module_record().
+1

> > +
> > +static void kconfig_module_record(const char *cfg)
> > +{
> > +	unsigned int i;
> > +	const char *mod = module_name_for_config(cfg);
> > +
> > +	if (!mod)
> > +		return;
> > +
> > +	if (tst_module_is_loaded(mod))
> > +		return;
> > +
> > +	for (i = 0; i < loaded_module_count; i++) {
> > +		if (!strcmp(loaded_modules[i], mod))
> > +			return;
> > +	}
> > +
> > +	if (loaded_module_count < MAX_LOADED_MODULES)
> > +		loaded_modules[loaded_module_count++] = mod;
> > +}
> > +
> >  static inline int kconfig_parse_line(const char *line,
> >                                       struct tst_kconfig_var *vars,
> >                                       unsigned int vars_len)
> > @@ -268,6 +307,8 @@ out:
> >  				vars[i].choice = 'm';
> >  				kconfig_runtime_check(&vars[i]);
> >  				kconfig_module_check(&vars[i]);
> > +				if (vars[i].choice == 'm')
> 
> This is better to have it inside kconfig_module_record() at the
> very beginning as a gate.

Good point, thanks!

-- 
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-10-14  3:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-10  3:36 [LTP] [PATCH v3 0/4] tst_kconfig: automatic module load/unload for CONFIG_*=m Li Wang
2026-10-10  3:36 ` [LTP] [PATCH v3 1/4] lib: add module is loaded check Li Wang
2026-10-10  9:38   ` [LTP] " linuxtestproject.agent
2026-10-12 15:48   ` [LTP] [PATCH v3 1/4] " Andrea Cervesato via ltp
2026-10-14  3:18     ` Li Wang
2026-10-10  3:36 ` [LTP] [PATCH v3 2/4] tst_kconfig: load and unload kernel modules for CONFIG_*=m Li Wang
2026-10-12 16:09   ` Andrea Cervesato via ltp
2026-10-14  3:36     ` Li Wang [this message]
2026-10-10  3:36 ` [LTP] [PATCH v3 3/4] tst_kconfig: add module mappings for vsock/vsock_loopback Li Wang
2026-10-12 15:51   ` Andrea Cervesato via ltp
2026-10-14  3:43     ` Li Wang
2026-10-14  5:01     ` Li Wang
2026-10-14  7:13       ` Andrea Cervesato via ltp
2026-10-10  3:36 ` [LTP] [PATCH v3 4/4] testcases: drop manual tst_modprobe() now handled by tst_kconfig Li Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=as74VdT9VULCDMWM@linux.dev \
    --to=li.wang@linux.dev \
    --cc=andrea.cervesato@suse.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox