mirror of
https://github.com/torvalds/linux.git
synced 2025-08-15 14:11:42 +02:00

Implement TryFrom<&device::Device> for &Device. This allows us to get a &platform::Device from a generic &Device in a safe way; the conversion fails if the device' bus type does not match with the platform bus type. Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Benno Lossin <benno.lossin@proton.me> Link: https://lore.kernel.org/r/20250321214826.140946-4-dakr@kernel.org [ Support device context types, use dev_is_platform() helper. - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
18 lines
402 B
C
18 lines
402 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
void *rust_helper_platform_get_drvdata(const struct platform_device *pdev)
|
|
{
|
|
return platform_get_drvdata(pdev);
|
|
}
|
|
|
|
void rust_helper_platform_set_drvdata(struct platform_device *pdev, void *data)
|
|
{
|
|
platform_set_drvdata(pdev, data);
|
|
}
|
|
|
|
bool rust_helper_dev_is_platform(const struct device *dev)
|
|
{
|
|
return dev_is_platform(dev);
|
|
}
|