Files
erofs-linux/rust/helpers/platform.c
T
Danilo Krummrich a38dfd60fe rust: platform: impl TryFrom<&Device> for &platform::Device
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 <[email protected]>
Reviewed-by: Benno Lossin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Support device context types, use dev_is_platform() helper. - Danilo ]
Signed-off-by: Danilo Krummrich <[email protected]>
2025-04-19 10:20:25 +02:00

19 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);
}