]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: topology: Replace fake root_device with kunit_device in tests
authordavidgow@google.com <davidgow@google.com>
Fri, 15 Dec 2023 07:39:11 +0000 (15:39 +0800)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 18 Dec 2023 20:28:08 +0000 (13:28 -0700)
Using struct root_device to create fake devices for tests is something
of a hack. The new struct kunit_device is meant for this purpose, so use
it instead.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
sound/soc/soc-topology-test.c

index 2cd3540cec0447a49a221b4592b45cd0177715ea..70cbccc42a42a29500abb83cf6efdfe31b9b670a 100644 (file)
@@ -9,6 +9,7 @@
 #include <sound/core.h>
 #include <sound/soc.h>
 #include <sound/soc-topology.h>
+#include <kunit/device.h>
 #include <kunit/test.h>
 
 /* ===== HELPER FUNCTIONS =================================================== */
  */
 static struct device *test_dev;
 
-static struct device_driver test_drv = {
-       .name = "sound-soc-topology-test-driver",
-};
-
 static int snd_soc_tplg_test_init(struct kunit *test)
 {
-       test_dev = root_device_register("sound-soc-topology-test");
+       test_dev = kunit_device_register(test, "sound-soc-topology-test");
        test_dev = get_device(test_dev);
        if (!test_dev)
                return -ENODEV;
 
-       test_dev->driver = &test_drv;
-
        return 0;
 }
 
 static void snd_soc_tplg_test_exit(struct kunit *test)
 {
        put_device(test_dev);
-       root_device_unregister(test_dev);
 }
 
 /*