Add devm_reset_control_get_optional_shared_by_index() to allow the drivers to get optional shared reset by passing the index.
Signed-off-by: Tommaso Merciai <[email protected]> --- v6->v7: - New patch. include/linux/reset.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/linux/reset.h b/include/linux/reset.h index 9c391cf0c822..d49545019631 100644 --- a/include/linux/reset.h +++ b/include/linux/reset.h @@ -965,6 +965,24 @@ devm_reset_control_get_shared_by_index(struct device *dev, int index) return __devm_reset_control_get(dev, NULL, index, RESET_CONTROL_SHARED); } +/** + * devm_reset_control_get_optional_shared_by_index - resource managed + * reset_control_get_optional_shared() + * @dev: device to be reset by the controller + * @index: index of the reset controller + * + * Managed reset_control_get_optional_shared(). For reset controllers returned + * from this function, reset_control_put() is called automatically on driver + * detach. + * + * See reset_control_get_optional_shared() for more information. + */ +static inline struct reset_control * +devm_reset_control_get_optional_shared_by_index(struct device *dev, int index) +{ + return __devm_reset_control_get(dev, NULL, index, RESET_CONTROL_OPTIONAL_SHARED); +} + /* * TEMPORARY calls to use during transition: * -- 2.54.0
