drivers/platform/wmi/tests/marshalling_kunit.c

Source file repositories/reference/linux-study-clean/drivers/platform/wmi/tests/marshalling_kunit.c

File Facts

System
Linux kernel
Corpus path
drivers/platform/wmi/tests/marshalling_kunit.c
Extension
.c
Size
10169 bytes
Lines
473
Domain
Driver Families
Bucket
drivers/platform
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct wmi_acpi_param {
	const char *name;
	const union acpi_object obj;
	const struct wmi_buffer buffer;
};

struct wmi_string_param {
	const char *name;
	const char *string;
	const struct wmi_buffer buffer;
};

struct wmi_invalid_acpi_param {
	const char *name;
	const union acpi_object obj;
};

struct wmi_invalid_string_param {
	const char *name;
	const struct wmi_buffer buffer;
};

/* 0xdeadbeef */
static u8 expected_single_integer[] = {
	0xef, 0xbe, 0xad, 0xde,
};

/* "TEST" */
static u8 expected_single_string[] = {
	0x0a, 0x00, 0x54, 0x00, 0x45, 0x00, 0x53, 0x00, 0x54, 0x00, 0x00, 0x00,
};

static u8 test_buffer[] = {
	0xab, 0xcd,
};

static u8 expected_single_buffer[] = {
	0xab, 0xcd,
};

static union acpi_object simple_package_elements[] = {
	{
		.buffer = {
			.type = ACPI_TYPE_BUFFER,
			.length = sizeof(test_buffer),
			.pointer = test_buffer,
		},
	},
	{
		.integer = {
			.type = ACPI_TYPE_INTEGER,
			.value = 0x01020304,
		},
	},
};

static u8 expected_simple_package[] = {
	0xab, 0xcd,
	0x00, 0x00,
	0x04, 0x03, 0x02, 0x01,
};

static u8 test_small_buffer[] = {
	0xde,
};

static union acpi_object complex_package_elements[] = {
	{
		.integer = {
			.type = ACPI_TYPE_INTEGER,
			.value = 0xdeadbeef,
		},
	},
	{
		.buffer = {
			.type = ACPI_TYPE_BUFFER,
			.length = sizeof(test_small_buffer),
			.pointer = test_small_buffer,
		},
	},
	{
		.string = {
			.type = ACPI_TYPE_STRING,
			.length = sizeof("TEST") - 1,
			.pointer = "TEST",
		},
	},
	{
		.buffer = {
			.type = ACPI_TYPE_BUFFER,

Annotation

Implementation Notes