mirror of
https://github.com/torvalds/linux
synced 2026-07-22 18:20:51 +09:00
Export `acpi_of_match_device` function and use it to match the of device
table against ACPI PRP0001 in Rust.
This fixes id_info being None on ACPI PRP0001 devices.
Using `device_get_match_data` is not possible, because Rust stores an
index in the of device id instead of a data pointer. This was done this
way to provide a convenient and obvious API for drivers, which can be
evaluated in const context without the use of any unstable language
features.
Fixes: 7a718a1f26 ("rust: driver: implement `Adapter`")
Signed-off-by: Markus Probst <markus.probst@posteo.de>
Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org> # ACPI
Link: https://patch.msgid.link/20260427-rust_acpi_prp0001-v6-1-6119b2a66183@posteo.de
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
17 lines
472 B
C
17 lines
472 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <linux/acpi.h>
|
|
#include <acpi/acpi_bus.h>
|
|
|
|
__rust_helper bool rust_helper_acpi_of_match_device(const struct acpi_device *adev,
|
|
const struct of_device_id *of_match_table,
|
|
const struct of_device_id **of_id)
|
|
{
|
|
return acpi_of_match_device(adev, of_match_table, of_id);
|
|
}
|
|
|
|
__rust_helper struct acpi_device *rust_helper_to_acpi_device_node(struct fwnode_handle *fwnode)
|
|
{
|
|
return to_acpi_device_node(fwnode);
|
|
}
|