mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-08-26 21:52:20 +00:00

Implement generic accessors for the private data of a driver bound to a device. Those accessors should be used by bus abstractions from their corresponding core callbacks, such as probe(), remove(), etc. Implementing them for device::CoreInternal guarantees that driver's can't interfere with the logic implemented by the bus abstraction. Acked-by: Benno Lossin <lossin@kernel.org> Link: https://lore.kernel.org/r/20250621195118.124245-3-dakr@kernel.org [ Improve safety comment as proposed by Benno. - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
28 lines
569 B
C
28 lines
569 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <linux/device.h>
|
|
|
|
int rust_helper_devm_add_action(struct device *dev,
|
|
void (*action)(void *),
|
|
void *data)
|
|
{
|
|
return devm_add_action(dev, action, data);
|
|
}
|
|
|
|
int rust_helper_devm_add_action_or_reset(struct device *dev,
|
|
void (*action)(void *),
|
|
void *data)
|
|
{
|
|
return devm_add_action_or_reset(dev, action, data);
|
|
}
|
|
|
|
void *rust_helper_dev_get_drvdata(const struct device *dev)
|
|
{
|
|
return dev_get_drvdata(dev);
|
|
}
|
|
|
|
void rust_helper_dev_set_drvdata(struct device *dev, void *data)
|
|
{
|
|
dev_set_drvdata(dev, data);
|
|
}
|