linux/drivers/of/of_kunit_helpers.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Test managed DeviceTree APIs
 */

#include <linux/of.h>
#include <linux/of_fdt.h>

#include <kunit/of.h>
#include <kunit/test.h>
#include <kunit/resource.h>

#include "of_private.h"

/**
 * of_root_kunit_skip() - Skip test if the root node isn't populated
 * @test: test to skip if the root node isn't populated
 */
void of_root_kunit_skip(struct kunit *test)
{}
EXPORT_SYMBOL_GPL();

#if defined(CONFIG_OF_OVERLAY) && defined(CONFIG_OF_EARLY_FLATTREE)

static void of_overlay_fdt_apply_kunit_exit(void *ovcs_id)
{}

/**
 * of_overlay_fdt_apply_kunit() - Test managed of_overlay_fdt_apply()
 * @test: test context
 * @overlay_fdt: device tree overlay to apply
 * @overlay_fdt_size: size in bytes of @overlay_fdt
 * @ovcs_id: identifier of overlay, used to remove the overlay
 *
 * Just like of_overlay_fdt_apply(), except the overlay is managed by the test
 * case and is automatically removed with of_overlay_remove() after the test
 * case concludes.
 *
 * Return: 0 on success, negative errno on failure
 */
int of_overlay_fdt_apply_kunit(struct kunit *test, void *overlay_fdt,
			       u32 overlay_fdt_size, int *ovcs_id)
{}
EXPORT_SYMBOL_GPL();

#endif

KUNIT_DEFINE_ACTION_WRAPPER(of_node_put_wrapper, of_node_put, struct device_node *);

/**
 * of_node_put_kunit() - Test managed of_node_put()
 * @test: test context
 * @node: node to pass to `of_node_put()`
 *
 * Just like of_node_put(), except the node is managed by the test case and is
 * automatically put with of_node_put() after the test case concludes.
 */
void of_node_put_kunit(struct kunit *test, struct device_node *node)
{}
EXPORT_SYMBOL_GPL();

MODULE_LICENSE();
MODULE_DESCRIPTION();