[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LRH.2.20.1911201144520.19458@dhcp-10-175-162-125.vpn.oracle.com>
Date: Wed, 20 Nov 2019 13:46:00 +0000 (GMT)
From: Alan Maguire <alan.maguire@...cle.com>
To: Stephen Boyd <sboyd@...nel.org>
cc: Alan Maguire <alan.maguire@...cle.com>, brendanhiggins@...gle.com,
linux-kselftest@...r.kernel.org, skhan@...uxfoundation.org,
linux-kernel@...r.kernel.org, kunit-dev@...glegroups.com,
keescook@...omium.org, yzaikin@...gle.com,
akpm@...ux-foundation.org, yamada.masahiro@...ionext.com,
catalin.marinas@....com, joe.lawrence@...hat.com,
penguin-kernel@...ove.sakura.ne.jp, urezki@...il.com,
andriy.shevchenko@...ux.intel.com, corbet@....net, tytso@....edu,
adilger.kernel@...ger.ca, mcgrof@...nel.org,
linux-ext4@...r.kernel.org, linux-doc@...r.kernel.org,
Knut Omang <knut.omang@...cle.com>
Subject: Re: [PATCH v4 linux-kselftest-test 5/6] kunit: allow kunit to be
loaded as a module
On Tue, 19 Nov 2019, Stephen Boyd wrote:
> Quoting Alan Maguire (2019-11-15 02:16:11)
> > diff --git a/lib/kunit/test.c b/lib/kunit/test.c
> > index 87b5cf1..41ef71a 100644
> > --- a/lib/kunit/test.c
> > +++ b/lib/kunit/test.c
> > @@ -486,3 +486,16 @@ void kunit_cleanup(struct kunit *test)
> > }
> > }
> > EXPORT_SYMBOL_GPL(kunit_cleanup);
> > +
> > +static int kunit_init(void)
>
> Missing __init?
>
Oops, will fix.
> > +{
> > + return 0;
> > +}
> > +late_initcall(kunit_init);
>
> It looks pretty weird that this doesn't do anything in the module init
> or exit path. How does it work? And why does it need to be late init if
> nothing is called from here?
>
I used a late_initcall() here because if there is initialization code in
the future (say setting up debugfs, sysctl tables etc), it will get run
irrespective of whether kunit is built as a module or not. For the module
case, we need init/exit to ensure the module can be unloaded
successfully.
> > +
> > +static void __exit kunit_exit(void)
> > +{
> > +}
> > +module_exit(kunit_exit);
> > +
> > +MODULE_LICENSE("GPL");
>
> I guess should be "GPL v2"?
>
Good catch, will fix here and elsewhere, thanks!
BTW in replying to your review of patch 1 I made a mistake; we do in fact
need to add the "#include <linux/kernel.h>" in assert.h as we are removing
the "#include <kunit/string-stream.h>". The latter indirectly includes
linux/kernel.h which allows us to find definition for "struct va_format"
used in the struct kunit_assert definition. Apologies about this.
I'll have a go at generating v5 using -C as requested. Thanks again for
the careful review!
Alan
Powered by blists - more mailing lists