Commit e383bb8f authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Bartosz Golaszewski
Browse files

devres: Add devm_is_action_added() helper



In some code we would like to know if the action in device managed resources
was added by devm_add_action() family of calls. Introduce a helper for that.

Reviewed-by: default avatarRaag Jadav <raag.jadav@intel.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarZijun Hu <quic_zijuhu@quicinc.com>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20250220162238.2738038-3-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent f5e5631d
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -759,6 +759,17 @@ int __devm_add_action(struct device *dev, void (*action)(void *), void *data, co
}
EXPORT_SYMBOL_GPL(__devm_add_action);

bool devm_is_action_added(struct device *dev, void (*action)(void *), void *data)
{
	struct action_devres devres = {
		.data = data,
		.action = action,
	};

	return devres_find(dev, devm_action_release, devm_action_match, &devres);
}
EXPORT_SYMBOL_GPL(devm_is_action_added);

/**
 * devm_remove_action_nowarn() - removes previously added custom action
 * @dev: Device that owns the action
+2 −0
Original line number Diff line number Diff line
@@ -165,4 +165,6 @@ static inline int __devm_add_action_or_reset(struct device *dev, void (*action)(
#define devm_add_action_or_reset(dev, action, data) \
	__devm_add_action_or_reset(dev, action, data, #action)

bool devm_is_action_added(struct device *dev, void (*action)(void *), void *data);

#endif /* _DEVICE_DEVRES_H_ */