From: davidgow@google.com Date: Fri, 15 Dec 2023 07:39:11 +0000 (+0800) Subject: ASoC: topology: Replace fake root_device with kunit_device in tests X-Git-Tag: v6.8-rc1~160^2~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e57cdff0ddc493f23d510b0848a17d81028e329b;p=thirdparty%2Flinux.git ASoC: topology: Replace fake root_device with kunit_device in tests 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 Signed-off-by: David Gow Signed-off-by: Shuah Khan --- diff --git a/sound/soc/soc-topology-test.c b/sound/soc/soc-topology-test.c index 2cd3540cec044..70cbccc42a42a 100644 --- a/sound/soc/soc-topology-test.c +++ b/sound/soc/soc-topology-test.c @@ -9,6 +9,7 @@ #include #include #include +#include #include /* ===== HELPER FUNCTIONS =================================================== */ @@ -21,26 +22,19 @@ */ 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); } /*