Lines Matching +full:platform +full:- +full:data

1 // SPDX-License-Identifier: GPL-2.0
3 * KUnit test for KUnit platform driver infrastructure.
12 * Test that kunit_platform_device_alloc() creates a platform device.
17 kunit_platform_device_alloc(test, "kunit-platform", 1)); in kunit_platform_device_alloc_test()
21 * Test that kunit_platform_device_add() registers a platform device on the
22 * platform bus with the proper name and id.
27 const char *name = "kunit-platform-add"; in kunit_platform_device_add_test()
28 const int id = -1; in kunit_platform_device_add_test()
34 KUNIT_EXPECT_TRUE(test, dev_is_platform(&pdev->dev)); in kunit_platform_device_add_test()
35 KUNIT_EXPECT_STREQ(test, pdev->name, name); in kunit_platform_device_add_test()
36 KUNIT_EXPECT_EQ(test, pdev->id, id); in kunit_platform_device_add_test()
46 const char *name = "kunit-platform-add-2"; in kunit_platform_device_add_twice_fails_test()
47 const int id = -1; in kunit_platform_device_add_twice_fails_test()
59 static int kunit_platform_device_find_by_name(struct device *dev, const void *data) in kunit_platform_device_find_by_name() argument
61 return strcmp(dev_name(dev), data) == 0; in kunit_platform_device_find_by_name()
65 * Test that kunit_platform_device_add() cleans up by removing the platform
70 const char *name = "kunit-platform-clean"; in kunit_platform_device_add_cleans_up()
71 const int id = -1; in kunit_platform_device_add_cleans_up()
91 * put_device() call on the platform device. The best we can do here is in kunit_platform_device_add_cleans_up()
122 const char *data; member
125 static const char * const test_data = "test data";
130 return container_of(to_platform_driver(pdev->dev.driver), in to_test_context()
140 ctx->data = test_data; in kunit_platform_driver_probe()
151 const char *name = "kunit-platform-register"; in kunit_platform_driver_register_test()
156 pdev = kunit_platform_device_alloc(test, name, -1); in kunit_platform_driver_register_test()
160 ctx->pdrv.probe = kunit_platform_driver_probe; in kunit_platform_driver_register_test()
161 ctx->pdrv.driver.name = name; in kunit_platform_driver_register_test()
162 ctx->pdrv.driver.owner = THIS_MODULE; in kunit_platform_driver_register_test()
166 KUNIT_EXPECT_EQ(test, 0, kunit_platform_driver_register(test, &ctx->pdrv)); in kunit_platform_driver_register_test()
168 KUNIT_EXPECT_STREQ(test, ctx->data, test_data); in kunit_platform_driver_register_test()
180 const char *name = "kunit-platform-wait"; in kunit_platform_device_prepare_wait_for_probe_completes_when_already_probed()
185 pdev = kunit_platform_device_alloc(test, name, -1); in kunit_platform_device_prepare_wait_for_probe_completes_when_already_probed()
189 ctx->pdrv.probe = kunit_platform_driver_probe; in kunit_platform_device_prepare_wait_for_probe_completes_when_already_probed()
190 ctx->pdrv.driver.name = name; in kunit_platform_device_prepare_wait_for_probe_completes_when_already_probed()
191 ctx->pdrv.driver.owner = THIS_MODULE; in kunit_platform_device_prepare_wait_for_probe_completes_when_already_probed()
195 KUNIT_ASSERT_EQ(test, 0, kunit_platform_driver_register(test, &ctx->pdrv)); in kunit_platform_device_prepare_wait_for_probe_completes_when_already_probed()
224 MODULE_DESCRIPTION("KUnit test for KUnit platform driver infrastructure");