From: David Gow <david@davidgow.net>
To: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
Brendan Higgins <brendan.higgins@linux.dev>,
Rae Moar <raemoar63@gmail.com>, Linus Walleij <linusw@kernel.org>,
Bartosz Golaszewski <brgl@kernel.org>
Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: Re: [PATCH v3 1/3] kunit: provide kunit_platform_device_register_full()
Date: Tue, 26 May 2026 16:58:05 +0800 [thread overview]
Message-ID: <5ea00943-4979-48d5-9b7b-351a5e87f011@davidgow.net> (raw)
In-Reply-To: <20260522-gpiolib-kunit-v3-1-b15fe6987430@oss.qualcomm.com>
Le 22/05/2026 à 9:42 PM, Bartosz Golaszewski a écrit :
> Provide a kunit-managed variant of platform_device_register_full().
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
Thanks! This looks good to me.
Reviewed-by: David Gow <david@davidgow.net>
Cheers,
-- David
> include/kunit/platform_device.h | 4 ++++
> lib/kunit/platform.c | 31 +++++++++++++++++++++++++++++++
> 2 files changed, 35 insertions(+)
>
> diff --git a/include/kunit/platform_device.h b/include/kunit/platform_device.h
> index f8236a8536f7ebcee6b0e00a7bd799a14b345c1b..8cad6e1c3e7efba862862b579089f2f317784a73 100644
> --- a/include/kunit/platform_device.h
> +++ b/include/kunit/platform_device.h
> @@ -6,10 +6,14 @@ struct completion;
> struct kunit;
> struct platform_device;
> struct platform_driver;
> +struct platform_device_info;
>
> struct platform_device *
> kunit_platform_device_alloc(struct kunit *test, const char *name, int id);
> int kunit_platform_device_add(struct kunit *test, struct platform_device *pdev);
> +struct platform_device *
> +kunit_platform_device_register_full(struct kunit *test,
> + const struct platform_device_info *pdevinfo);
>
> int kunit_platform_device_prepare_wait_for_probe(struct kunit *test,
> struct platform_device *pdev,
> diff --git a/lib/kunit/platform.c b/lib/kunit/platform.c
> index 0b518de26065d65dac3bd49dd94a4b3e7ea0634b..583b50b538c79599ebbf33e261fe2e9ced35efa9 100644
> --- a/lib/kunit/platform.c
> +++ b/lib/kunit/platform.c
> @@ -6,6 +6,7 @@
> #include <linux/completion.h>
> #include <linux/device/bus.h>
> #include <linux/device/driver.h>
> +#include <linux/err.h>
> #include <linux/platform_device.h>
>
> #include <kunit/platform_device.h>
> @@ -130,6 +131,36 @@ int kunit_platform_device_add(struct kunit *test, struct platform_device *pdev)
> }
> EXPORT_SYMBOL_GPL(kunit_platform_device_add);
>
> +/**
> + * kunit_platform_device_register_full() - Register a KUnit test-managed platform
> + * device described by platform device info
> + * @test: test context
> + * @pdevinfo: platform device information describing the new device
> + *
> + * Register a test-managed platform device. The device is unregistered when the
> + * test completes.
> + *
> + * Return: New platform device on success, IS_ERR() on error.
> + */
> +struct platform_device *
> +kunit_platform_device_register_full(struct kunit *test,
> + const struct platform_device_info *pdevinfo)
> +{
> + struct platform_device *pdev;
> + int ret;
> +
> + pdev = platform_device_register_full(pdevinfo);
> + if (IS_ERR(pdev))
> + return pdev;
> +
> + ret = kunit_add_action_or_reset(test, platform_device_unregister_wrapper, pdev);
> + if (ret)
> + return ERR_PTR(ret);
> +
> + return pdev;
> +}
> +EXPORT_SYMBOL_GPL(kunit_platform_device_register_full);
> +
> struct kunit_platform_device_probe_nb {
> struct completion *x;
> struct device *dev;
>
next prev parent reply other threads:[~2026-05-26 9:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 13:42 [PATCH v3 0/3] gpio: add kunit tests for GPIO core Bartosz Golaszewski
2026-05-22 13:42 ` [PATCH v3 1/3] kunit: provide kunit_platform_device_register_full() Bartosz Golaszewski
2026-05-26 8:58 ` David Gow [this message]
2026-05-22 13:42 ` [PATCH v3 2/3] kunit: provide kunit_platform_device_unregister() Bartosz Golaszewski
2026-05-26 8:58 ` David Gow
2026-05-22 13:42 ` [PATCH v3 3/3] gpio: add kunit test cases for the GPIO subsystem Bartosz Golaszewski
2026-05-26 8:58 ` David Gow
2026-05-26 9:19 ` Bartosz Golaszewski
2026-05-25 13:33 ` [PATCH v3 0/3] gpio: add kunit tests for GPIO core Linus Walleij
2026-05-26 9:20 ` Bartosz Golaszewski
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=5ea00943-4979-48d5-9b7b-351a5e87f011@davidgow.net \
--to=david@davidgow.net \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brendan.higgins@linux.dev \
--cc=brgl@kernel.org \
--cc=kunit-dev@googlegroups.com \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=raemoar63@gmail.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
all inboxes | Powered by JetHome®