From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: davidgow@google.com
Cc: Rae Moar <rmoar@google.com>,
Brendan Higgins <brendan.higgins@linux.dev>,
Matti Vaittinen <mazziesaccount@gmail.com>,
Stephen Boyd <sboyd@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>,
Jonathan Corbet <corbet@lwn.net>,
Kees Cook <keescook@chromium.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>, Maxime Ripard <mripard@kernel.org>,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org, linux-sound@vger.kernel.org
Subject: Re: [PATCH v4 1/5] kunit: Add APIs for managing devices
Date: Fri, 15 Dec 2023 17:24:22 +0100 [thread overview]
Message-ID: <2023121512-handcuff-unstable-63ed@gregkh> (raw)
In-Reply-To: <20231215-kunit_bus-v4-1-4f5160e2f95e@google.com>
On Fri, Dec 15, 2023 at 03:39:08PM +0800, davidgow@google.com wrote:
> Tests for drivers often require a struct device to pass to other
> functions. While it's possible to create these with
> root_device_register(), or to use something like a platform device, this
> is both a misuse of those APIs, and can be difficult to clean up after,
> for example, a failed assertion.
>
> Add some KUnit-specific functions for registering and unregistering a
> struct device:
> - kunit_device_register()
> - kunit_device_register_with_driver()
> - kunit_device_unregister()
>
> These helpers allocate a on a 'kunit' bus which will either probe the
> driver passed in (kunit_device_register_with_driver), or will create a
> stub driver (kunit_device_register) which is cleaned up on test shutdown.
>
> Devices are automatically unregistered on test shutdown, but can be
> manually unregistered earlier with kunit_device_unregister() in order
> to, for example, test device release code.
>
> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Reviewed-by: Maxime Ripard <mripard@kernel.org>
> Signed-off-by: David Gow <davidgow@google.com>
Nice work!
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
next prev parent reply other threads:[~2023-12-15 16:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-15 7:39 [PATCH v4 0/5] kunit: Add helpers for creating test-managed devices davidgow
2023-12-15 7:39 ` [PATCH v4 1/5] kunit: Add APIs for managing devices davidgow
2023-12-15 16:24 ` Greg Kroah-Hartman [this message]
2023-12-15 7:39 ` [PATCH v4 2/5] fortify: test: Use kunit_device davidgow
2023-12-15 7:39 ` [PATCH v4 3/5] overflow: Replace fake root_device with kunit_device davidgow
2023-12-15 7:39 ` [PATCH v4 4/5] ASoC: topology: Replace fake root_device with kunit_device in tests davidgow
2023-12-15 7:39 ` [PATCH v4 5/5] drm/tests: Switch to kunit devices davidgow
2023-12-15 22:48 ` Rae Moar
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=2023121512-handcuff-unstable-63ed@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=brendan.higgins@linux.dev \
--cc=broonie@kernel.org \
--cc=corbet@lwn.net \
--cc=davidgow@google.com \
--cc=keescook@chromium.org \
--cc=kunit-dev@googlegroups.com \
--cc=lgirdwood@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=mazziesaccount@gmail.com \
--cc=mripard@kernel.org \
--cc=perex@perex.cz \
--cc=rmoar@google.com \
--cc=sboyd@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=tiwai@suse.com \
/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