diff options
Diffstat (limited to 'drivers/reset/core.c')
-rw-r--r-- | drivers/reset/core.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/reset/core.c b/drivers/reset/core.c index f1e5e65388bb..cd739d2fa160 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c | |||
@@ -275,7 +275,7 @@ int reset_control_status(struct reset_control *rstc) | |||
275 | } | 275 | } |
276 | EXPORT_SYMBOL_GPL(reset_control_status); | 276 | EXPORT_SYMBOL_GPL(reset_control_status); |
277 | 277 | ||
278 | static struct reset_control *__reset_control_get( | 278 | static struct reset_control *__reset_control_get_internal( |
279 | struct reset_controller_dev *rcdev, | 279 | struct reset_controller_dev *rcdev, |
280 | unsigned int index, bool shared) | 280 | unsigned int index, bool shared) |
281 | { | 281 | { |
@@ -308,7 +308,7 @@ static struct reset_control *__reset_control_get( | |||
308 | return rstc; | 308 | return rstc; |
309 | } | 309 | } |
310 | 310 | ||
311 | static void __reset_control_put(struct reset_control *rstc) | 311 | static void __reset_control_put_internal(struct reset_control *rstc) |
312 | { | 312 | { |
313 | lockdep_assert_held(&reset_list_mutex); | 313 | lockdep_assert_held(&reset_list_mutex); |
314 | 314 | ||
@@ -377,7 +377,7 @@ struct reset_control *__of_reset_control_get(struct device_node *node, | |||
377 | } | 377 | } |
378 | 378 | ||
379 | /* reset_list_mutex also protects the rcdev's reset_control list */ | 379 | /* reset_list_mutex also protects the rcdev's reset_control list */ |
380 | rstc = __reset_control_get(rcdev, rstc_id, shared); | 380 | rstc = __reset_control_get_internal(rcdev, rstc_id, shared); |
381 | 381 | ||
382 | mutex_unlock(&reset_list_mutex); | 382 | mutex_unlock(&reset_list_mutex); |
383 | 383 | ||
@@ -385,6 +385,17 @@ struct reset_control *__of_reset_control_get(struct device_node *node, | |||
385 | } | 385 | } |
386 | EXPORT_SYMBOL_GPL(__of_reset_control_get); | 386 | EXPORT_SYMBOL_GPL(__of_reset_control_get); |
387 | 387 | ||
388 | struct reset_control *__reset_control_get(struct device *dev, const char *id, | ||
389 | int index, bool shared, bool optional) | ||
390 | { | ||
391 | if (dev->of_node) | ||
392 | return __of_reset_control_get(dev->of_node, id, index, shared, | ||
393 | optional); | ||
394 | |||
395 | return optional ? NULL : ERR_PTR(-EINVAL); | ||
396 | } | ||
397 | EXPORT_SYMBOL_GPL(__reset_control_get); | ||
398 | |||
388 | /** | 399 | /** |
389 | * reset_control_put - free the reset controller | 400 | * reset_control_put - free the reset controller |
390 | * @rstc: reset controller | 401 | * @rstc: reset controller |
@@ -396,7 +407,7 @@ void reset_control_put(struct reset_control *rstc) | |||
396 | return; | 407 | return; |
397 | 408 | ||
398 | mutex_lock(&reset_list_mutex); | 409 | mutex_lock(&reset_list_mutex); |
399 | __reset_control_put(rstc); | 410 | __reset_control_put_internal(rstc); |
400 | mutex_unlock(&reset_list_mutex); | 411 | mutex_unlock(&reset_list_mutex); |
401 | } | 412 | } |
402 | EXPORT_SYMBOL_GPL(reset_control_put); | 413 | EXPORT_SYMBOL_GPL(reset_control_put); |
@@ -417,8 +428,7 @@ struct reset_control *__devm_reset_control_get(struct device *dev, | |||
417 | if (!ptr) | 428 | if (!ptr) |
418 | return ERR_PTR(-ENOMEM); | 429 | return ERR_PTR(-ENOMEM); |
419 | 430 | ||
420 | rstc = __of_reset_control_get(dev ? dev->of_node : NULL, | 431 | rstc = __reset_control_get(dev, id, index, shared, optional); |
421 | id, index, shared, optional); | ||
422 | if (!IS_ERR(rstc)) { | 432 | if (!IS_ERR(rstc)) { |
423 | *ptr = rstc; | 433 | *ptr = rstc; |
424 | devres_add(dev, ptr); | 434 | devres_add(dev, ptr); |