Skip to content

Commit c4f5b30

Browse files
bijudaspH5
authored andcommitted
reset: Add of_reset_control_get_optional_exclusive()
Add optional variant of of_reset_control_get_exclusive(). If the requested reset is not specified in the device tree, this function returns NULL instead of an error. Suggested-by: Philipp Zabel <[email protected]> Signed-off-by: Biju Das <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Philipp Zabel <[email protected]>
1 parent fa55b7d commit c4f5b30

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

include/linux/reset.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,26 @@ static inline struct reset_control *of_reset_control_get_exclusive(
454454
return __of_reset_control_get(node, id, 0, false, false, true);
455455
}
456456

457+
/**
458+
* of_reset_control_get_optional_exclusive - Lookup and obtain an optional exclusive
459+
* reference to a reset controller.
460+
* @node: device to be reset by the controller
461+
* @id: reset line name
462+
*
463+
* Optional variant of of_reset_control_get_exclusive(). If the requested reset
464+
* is not specified in the device tree, this function returns NULL instead of
465+
* an error.
466+
*
467+
* Returns a struct reset_control or IS_ERR() condition containing errno.
468+
*
469+
* Use of id names is optional.
470+
*/
471+
static inline struct reset_control *of_reset_control_get_optional_exclusive(
472+
struct device_node *node, const char *id)
473+
{
474+
return __of_reset_control_get(node, id, 0, false, true, true);
475+
}
476+
457477
/**
458478
* of_reset_control_get_shared - Lookup and obtain a shared reference
459479
* to a reset controller.

0 commit comments

Comments
 (0)