mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-30 22:03:17 +01:00
Introduce KUnit resource wrappers around platform_driver_register(), platform_device_alloc(), and platform_device_add() so that test authors can register platform drivers/devices from their tests and have the drivers/devices automatically be unregistered when the test is done. This makes test setup code simpler when a platform driver or platform device is needed. Add a few test cases at the same time to make sure the APIs work as intended. Cc: Brendan Higgins <[email protected]> Reviewed-by: David Gow <[email protected]> Cc: Rae Moar <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Link: https://lore.kernel.org/r/[email protected]
21 lines
588 B
C
21 lines
588 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _KUNIT_PLATFORM_DRIVER_H
|
|
#define _KUNIT_PLATFORM_DRIVER_H
|
|
|
|
struct kunit;
|
|
struct platform_device;
|
|
struct platform_driver;
|
|
|
|
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);
|
|
|
|
int kunit_platform_device_prepare_wait_for_probe(struct kunit *test,
|
|
struct platform_device *pdev,
|
|
struct completion *x);
|
|
|
|
int kunit_platform_driver_register(struct kunit *test,
|
|
struct platform_driver *drv);
|
|
|
|
#endif
|