Skip to content

Commit 0ca10b6

Browse files
committed
reset: fix optional reset_control_get stubs to return NULL
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 <a.hajda@samsung.com> Tested-by: Andrzej Hajda <a.hajda@samsung.com> Reviewed-by: Andrzej Hajda <a.hajda@samsung.com> Cc: Ramiro Oliveira <Ramiro.Oliveira@synopsys.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
1 parent c1ae3cf commit 0ca10b6

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

include/linux/reset.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,26 @@ static inline int device_reset_optional(struct device *dev)
3131

3232
static inline int reset_control_reset(struct reset_control *rstc)
3333
{
34-
WARN_ON(1);
3534
return 0;
3635
}
3736

3837
static inline int reset_control_assert(struct reset_control *rstc)
3938
{
40-
WARN_ON(1);
4139
return 0;
4240
}
4341

4442
static inline int reset_control_deassert(struct reset_control *rstc)
4543
{
46-
WARN_ON(1);
4744
return 0;
4845
}
4946

5047
static inline int reset_control_status(struct reset_control *rstc)
5148
{
52-
WARN_ON(1);
5349
return 0;
5450
}
5551

5652
static inline void reset_control_put(struct reset_control *rstc)
5753
{
58-
WARN_ON(1);
5954
}
6055

6156
static inline int __must_check device_reset(struct device *dev)
@@ -74,14 +69,14 @@ static inline struct reset_control *__of_reset_control_get(
7469
const char *id, int index, bool shared,
7570
bool optional)
7671
{
77-
return ERR_PTR(-ENOTSUPP);
72+
return optional ? NULL : ERR_PTR(-ENOTSUPP);
7873
}
7974

8075
static inline struct reset_control *__devm_reset_control_get(
8176
struct device *dev, const char *id,
8277
int index, bool shared, bool optional)
8378
{
84-
return ERR_PTR(-ENOTSUPP);
79+
return optional ? NULL : ERR_PTR(-ENOTSUPP);
8580
}
8681

8782
#endif /* CONFIG_RESET_CONTROLLER */

0 commit comments

Comments
 (0)