Skip to content

Commit

Permalink
reset: fix optional reset_control_get stubs to return NULL
Browse files Browse the repository at this point in the history
When RESET_CONTROLLER is not enabled, the optional reset_control_get
stubs should now also return NULL.

Since it is now valid for reset_control_assert/deassert/reset/status/put
to be called unconditionally, with NULL as an argument for optional
resets, the stubs are not allowed to warn anymore.

Fixes: bb47523 ("reset: make optional functions really optional")
Reported-by: Andrzej Hajda <[email protected]>
Tested-by: Andrzej Hajda <[email protected]>
Reviewed-by: Andrzej Hajda <[email protected]>
Cc: Ramiro Oliveira <[email protected]>
Signed-off-by: Philipp Zabel <[email protected]>
  • Loading branch information
pH5 committed Mar 21, 2017
1 parent c1ae3cf commit 0ca10b6
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions include/linux/reset.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,26 @@ static inline int device_reset_optional(struct device *dev)

static inline int reset_control_reset(struct reset_control *rstc)
{
WARN_ON(1);
return 0;
}

static inline int reset_control_assert(struct reset_control *rstc)
{
WARN_ON(1);
return 0;
}

static inline int reset_control_deassert(struct reset_control *rstc)
{
WARN_ON(1);
return 0;
}

static inline int reset_control_status(struct reset_control *rstc)
{
WARN_ON(1);
return 0;
}

static inline void reset_control_put(struct reset_control *rstc)
{
WARN_ON(1);
}

static inline int __must_check device_reset(struct device *dev)
Expand All @@ -74,14 +69,14 @@ static inline struct reset_control *__of_reset_control_get(
const char *id, int index, bool shared,
bool optional)
{
return ERR_PTR(-ENOTSUPP);
return optional ? NULL : ERR_PTR(-ENOTSUPP);
}

static inline struct reset_control *__devm_reset_control_get(
struct device *dev, const char *id,
int index, bool shared, bool optional)
{
return ERR_PTR(-ENOTSUPP);
return optional ? NULL : ERR_PTR(-ENOTSUPP);
}

#endif /* CONFIG_RESET_CONTROLLER */
Expand Down

0 comments on commit 0ca10b6

Please sign in to comment.