diff options
| -rw-r--r-- | drivers/reset/core.c | 139 | ||||
| -rw-r--r-- | include/linux/reset.h | 93 |
2 files changed, 200 insertions, 32 deletions
diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 9582efb70025..1e8a42b16f23 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c | |||
| @@ -34,6 +34,7 @@ static LIST_HEAD(reset_lookup_list); | |||
| 34 | * @id: ID of the reset controller in the reset | 34 | * @id: ID of the reset controller in the reset |
| 35 | * controller device | 35 | * controller device |
| 36 | * @refcnt: Number of gets of this reset_control | 36 | * @refcnt: Number of gets of this reset_control |
| 37 | * @acquired: Only one reset_control may be acquired for a given rcdev and id. | ||
| 37 | * @shared: Is this a shared (1), or an exclusive (0) reset_control? | 38 | * @shared: Is this a shared (1), or an exclusive (0) reset_control? |
| 38 | * @deassert_cnt: Number of times this reset line has been deasserted | 39 | * @deassert_cnt: Number of times this reset line has been deasserted |
| 39 | * @triggered_count: Number of times this reset line has been reset. Currently | 40 | * @triggered_count: Number of times this reset line has been reset. Currently |
| @@ -45,6 +46,7 @@ struct reset_control { | |||
| 45 | struct list_head list; | 46 | struct list_head list; |
| 46 | unsigned int id; | 47 | unsigned int id; |
| 47 | struct kref refcnt; | 48 | struct kref refcnt; |
| 49 | bool acquired; | ||
| 48 | bool shared; | 50 | bool shared; |
| 49 | bool array; | 51 | bool array; |
| 50 | atomic_t deassert_count; | 52 | atomic_t deassert_count; |
| @@ -63,6 +65,17 @@ struct reset_control_array { | |||
| 63 | struct reset_control *rstc[]; | 65 | struct reset_control *rstc[]; |
| 64 | }; | 66 | }; |
| 65 | 67 | ||
| 68 | static const char *rcdev_name(struct reset_controller_dev *rcdev) | ||
| 69 | { | ||
| 70 | if (rcdev->dev) | ||
| 71 | return dev_name(rcdev->dev); | ||
| 72 | |||
| 73 | if (rcdev->of_node) | ||
| 74 | return rcdev->of_node->full_name; | ||
| 75 | |||
| 76 | return NULL; | ||
| 77 | } | ||
| 78 | |||
| 66 | /** | 79 | /** |
| 67 | * of_reset_simple_xlate - translate reset_spec to the reset line number | 80 | * of_reset_simple_xlate - translate reset_spec to the reset line number |
| 68 | * @rcdev: a pointer to the reset controller device | 81 | * @rcdev: a pointer to the reset controller device |
| @@ -272,6 +285,9 @@ int reset_control_reset(struct reset_control *rstc) | |||
| 272 | 285 | ||
| 273 | if (atomic_inc_return(&rstc->triggered_count) != 1) | 286 | if (atomic_inc_return(&rstc->triggered_count) != 1) |
| 274 | return 0; | 287 | return 0; |
| 288 | } else { | ||
| 289 | if (!rstc->acquired) | ||
| 290 | return -EPERM; | ||
| 275 | } | 291 | } |
| 276 | 292 | ||
| 277 | ret = rstc->rcdev->ops->reset(rstc->rcdev, rstc->id); | 293 | ret = rstc->rcdev->ops->reset(rstc->rcdev, rstc->id); |
| @@ -334,6 +350,12 @@ int reset_control_assert(struct reset_control *rstc) | |||
| 334 | */ | 350 | */ |
| 335 | if (!rstc->rcdev->ops->assert) | 351 | if (!rstc->rcdev->ops->assert) |
| 336 | return -ENOTSUPP; | 352 | return -ENOTSUPP; |
| 353 | |||
| 354 | if (!rstc->acquired) { | ||
| 355 | WARN(1, "reset %s (ID: %u) is not acquired\n", | ||
| 356 | rcdev_name(rstc->rcdev), rstc->id); | ||
| 357 | return -EPERM; | ||
| 358 | } | ||
| 337 | } | 359 | } |
| 338 | 360 | ||
| 339 | return rstc->rcdev->ops->assert(rstc->rcdev, rstc->id); | 361 | return rstc->rcdev->ops->assert(rstc->rcdev, rstc->id); |
| @@ -369,6 +391,12 @@ int reset_control_deassert(struct reset_control *rstc) | |||
| 369 | 391 | ||
| 370 | if (atomic_inc_return(&rstc->deassert_count) != 1) | 392 | if (atomic_inc_return(&rstc->deassert_count) != 1) |
| 371 | return 0; | 393 | return 0; |
| 394 | } else { | ||
| 395 | if (!rstc->acquired) { | ||
| 396 | WARN(1, "reset %s (ID: %u) is not acquired\n", | ||
| 397 | rcdev_name(rstc->rcdev), rstc->id); | ||
| 398 | return -EPERM; | ||
| 399 | } | ||
| 372 | } | 400 | } |
| 373 | 401 | ||
| 374 | /* | 402 | /* |
| @@ -406,9 +434,81 @@ int reset_control_status(struct reset_control *rstc) | |||
| 406 | } | 434 | } |
| 407 | EXPORT_SYMBOL_GPL(reset_control_status); | 435 | EXPORT_SYMBOL_GPL(reset_control_status); |
| 408 | 436 | ||
| 437 | /** | ||
| 438 | * reset_control_acquire() - acquires a reset control for exclusive use | ||
| 439 | * @rstc: reset control | ||
| 440 | * | ||
| 441 | * This is used to explicitly acquire a reset control for exclusive use. Note | ||
| 442 | * that exclusive resets are requested as acquired by default. In order for a | ||
| 443 | * second consumer to be able to control the reset, the first consumer has to | ||
| 444 | * release it first. Typically the easiest way to achieve this is to call the | ||
| 445 | * reset_control_get_exclusive_released() to obtain an instance of the reset | ||
| 446 | * control. Such reset controls are not acquired by default. | ||
| 447 | * | ||
| 448 | * Consumers implementing shared access to an exclusive reset need to follow | ||
| 449 | * a specific protocol in order to work together. Before consumers can change | ||
| 450 | * a reset they must acquire exclusive access using reset_control_acquire(). | ||
| 451 | * After they are done operating the reset, they must release exclusive access | ||
| 452 | * with a call to reset_control_release(). Consumers are not granted exclusive | ||
| 453 | * access to the reset as long as another consumer hasn't released a reset. | ||
| 454 | * | ||
| 455 | * See also: reset_control_release() | ||
| 456 | */ | ||
| 457 | int reset_control_acquire(struct reset_control *rstc) | ||
| 458 | { | ||
| 459 | struct reset_control *rc; | ||
| 460 | |||
| 461 | if (!rstc) | ||
| 462 | return 0; | ||
| 463 | |||
| 464 | if (WARN_ON(IS_ERR(rstc))) | ||
| 465 | return -EINVAL; | ||
| 466 | |||
| 467 | mutex_lock(&reset_list_mutex); | ||
| 468 | |||
| 469 | if (rstc->acquired) { | ||
| 470 | mutex_unlock(&reset_list_mutex); | ||
| 471 | return 0; | ||
| 472 | } | ||
| 473 | |||
| 474 | list_for_each_entry(rc, &rstc->rcdev->reset_control_head, list) { | ||
| 475 | if (rstc != rc && rstc->id == rc->id) { | ||
| 476 | if (rc->acquired) { | ||
| 477 | mutex_unlock(&reset_list_mutex); | ||
| 478 | return -EBUSY; | ||
| 479 | } | ||
| 480 | } | ||
| 481 | } | ||
| 482 | |||
| 483 | rstc->acquired = true; | ||
| 484 | |||
| 485 | mutex_unlock(&reset_list_mutex); | ||
| 486 | return 0; | ||
| 487 | } | ||
| 488 | EXPORT_SYMBOL_GPL(reset_control_acquire); | ||
| 489 | |||
| 490 | /** | ||
| 491 | * reset_control_release() - releases exclusive access to a reset control | ||
| 492 | * @rstc: reset control | ||
| 493 | * | ||
| 494 | * Releases exclusive access right to a reset control previously obtained by a | ||
| 495 | * call to reset_control_acquire(). Until a consumer calls this function, no | ||
| 496 | * other consumers will be granted exclusive access. | ||
| 497 | * | ||
| 498 | * See also: reset_control_acquire() | ||
| 499 | */ | ||
| 500 | void reset_control_release(struct reset_control *rstc) | ||
| 501 | { | ||
| 502 | if (!rstc || WARN_ON(IS_ERR(rstc))) | ||
| 503 | return; | ||
| 504 | |||
| 505 | rstc->acquired = false; | ||
| 506 | } | ||
| 507 | EXPORT_SYMBOL_GPL(reset_control_release); | ||
| 508 | |||
| 409 | static struct reset_control *__reset_control_get_internal( | 509 | static struct reset_control *__reset_control_get_internal( |
| 410 | struct reset_controller_dev *rcdev, | 510 | struct reset_controller_dev *rcdev, |
| 411 | unsigned int index, bool shared) | 511 | unsigned int index, bool shared, bool acquired) |
| 412 | { | 512 | { |
| 413 | struct reset_control *rstc; | 513 | struct reset_control *rstc; |
| 414 | 514 | ||
| @@ -416,6 +516,14 @@ static struct reset_control *__reset_control_get_internal( | |||
| 416 | 516 | ||
| 417 | list_for_each_entry(rstc, &rcdev->reset_control_head, list) { | 517 | list_for_each_entry(rstc, &rcdev->reset_control_head, list) { |
| 418 | if (rstc->id == index) { | 518 | if (rstc->id == index) { |
| 519 | /* | ||
| 520 | * Allow creating a secondary exclusive reset_control | ||
| 521 | * that is initially not acquired for an already | ||
| 522 | * controlled reset line. | ||
| 523 | */ | ||
| 524 | if (!rstc->shared && !shared && !acquired) | ||
| 525 | break; | ||
| 526 | |||
| 419 | if (WARN_ON(!rstc->shared || !shared)) | 527 | if (WARN_ON(!rstc->shared || !shared)) |
| 420 | return ERR_PTR(-EBUSY); | 528 | return ERR_PTR(-EBUSY); |
| 421 | 529 | ||
| @@ -434,6 +542,7 @@ static struct reset_control *__reset_control_get_internal( | |||
| 434 | list_add(&rstc->list, &rcdev->reset_control_head); | 542 | list_add(&rstc->list, &rcdev->reset_control_head); |
| 435 | rstc->id = index; | 543 | rstc->id = index; |
| 436 | kref_init(&rstc->refcnt); | 544 | kref_init(&rstc->refcnt); |
| 545 | rstc->acquired = acquired; | ||
| 437 | rstc->shared = shared; | 546 | rstc->shared = shared; |
| 438 | 547 | ||
| 439 | return rstc; | 548 | return rstc; |
| @@ -461,7 +570,7 @@ static void __reset_control_put_internal(struct reset_control *rstc) | |||
| 461 | 570 | ||
| 462 | struct reset_control *__of_reset_control_get(struct device_node *node, | 571 | struct reset_control *__of_reset_control_get(struct device_node *node, |
| 463 | const char *id, int index, bool shared, | 572 | const char *id, int index, bool shared, |
| 464 | bool optional) | 573 | bool optional, bool acquired) |
| 465 | { | 574 | { |
| 466 | struct reset_control *rstc; | 575 | struct reset_control *rstc; |
| 467 | struct reset_controller_dev *r, *rcdev; | 576 | struct reset_controller_dev *r, *rcdev; |
| @@ -514,7 +623,7 @@ struct reset_control *__of_reset_control_get(struct device_node *node, | |||
| 514 | } | 623 | } |
| 515 | 624 | ||
| 516 | /* reset_list_mutex also protects the rcdev's reset_control list */ | 625 | /* reset_list_mutex also protects the rcdev's reset_control list */ |
| 517 | rstc = __reset_control_get_internal(rcdev, rstc_id, shared); | 626 | rstc = __reset_control_get_internal(rcdev, rstc_id, shared, acquired); |
| 518 | 627 | ||
| 519 | out: | 628 | out: |
| 520 | mutex_unlock(&reset_list_mutex); | 629 | mutex_unlock(&reset_list_mutex); |
| @@ -544,7 +653,7 @@ __reset_controller_by_name(const char *name) | |||
| 544 | 653 | ||
| 545 | static struct reset_control * | 654 | static struct reset_control * |
| 546 | __reset_control_get_from_lookup(struct device *dev, const char *con_id, | 655 | __reset_control_get_from_lookup(struct device *dev, const char *con_id, |
| 547 | bool shared, bool optional) | 656 | bool shared, bool optional, bool acquired) |
| 548 | { | 657 | { |
| 549 | const struct reset_control_lookup *lookup; | 658 | const struct reset_control_lookup *lookup; |
| 550 | struct reset_controller_dev *rcdev; | 659 | struct reset_controller_dev *rcdev; |
| @@ -574,7 +683,7 @@ __reset_control_get_from_lookup(struct device *dev, const char *con_id, | |||
| 574 | 683 | ||
| 575 | rstc = __reset_control_get_internal(rcdev, | 684 | rstc = __reset_control_get_internal(rcdev, |
| 576 | lookup->index, | 685 | lookup->index, |
| 577 | shared); | 686 | shared, acquired); |
| 578 | mutex_unlock(&reset_list_mutex); | 687 | mutex_unlock(&reset_list_mutex); |
| 579 | break; | 688 | break; |
| 580 | } | 689 | } |
| @@ -589,13 +698,18 @@ __reset_control_get_from_lookup(struct device *dev, const char *con_id, | |||
| 589 | } | 698 | } |
| 590 | 699 | ||
| 591 | struct reset_control *__reset_control_get(struct device *dev, const char *id, | 700 | struct reset_control *__reset_control_get(struct device *dev, const char *id, |
| 592 | int index, bool shared, bool optional) | 701 | int index, bool shared, bool optional, |
| 702 | bool acquired) | ||
| 593 | { | 703 | { |
| 704 | if (WARN_ON(shared && acquired)) | ||
| 705 | return ERR_PTR(-EINVAL); | ||
| 706 | |||
| 594 | if (dev->of_node) | 707 | if (dev->of_node) |
| 595 | return __of_reset_control_get(dev->of_node, id, index, shared, | 708 | return __of_reset_control_get(dev->of_node, id, index, shared, |
| 596 | optional); | 709 | optional, acquired); |
| 597 | 710 | ||
| 598 | return __reset_control_get_from_lookup(dev, id, shared, optional); | 711 | return __reset_control_get_from_lookup(dev, id, shared, optional, |
| 712 | acquired); | ||
| 599 | } | 713 | } |
| 600 | EXPORT_SYMBOL_GPL(__reset_control_get); | 714 | EXPORT_SYMBOL_GPL(__reset_control_get); |
| 601 | 715 | ||
| @@ -636,7 +750,7 @@ static void devm_reset_control_release(struct device *dev, void *res) | |||
| 636 | 750 | ||
| 637 | struct reset_control *__devm_reset_control_get(struct device *dev, | 751 | struct reset_control *__devm_reset_control_get(struct device *dev, |
| 638 | const char *id, int index, bool shared, | 752 | const char *id, int index, bool shared, |
| 639 | bool optional) | 753 | bool optional, bool acquired) |
| 640 | { | 754 | { |
| 641 | struct reset_control **ptr, *rstc; | 755 | struct reset_control **ptr, *rstc; |
| 642 | 756 | ||
| @@ -645,7 +759,7 @@ struct reset_control *__devm_reset_control_get(struct device *dev, | |||
| 645 | if (!ptr) | 759 | if (!ptr) |
| 646 | return ERR_PTR(-ENOMEM); | 760 | return ERR_PTR(-ENOMEM); |
| 647 | 761 | ||
| 648 | rstc = __reset_control_get(dev, id, index, shared, optional); | 762 | rstc = __reset_control_get(dev, id, index, shared, optional, acquired); |
| 649 | if (!IS_ERR(rstc)) { | 763 | if (!IS_ERR(rstc)) { |
| 650 | *ptr = rstc; | 764 | *ptr = rstc; |
| 651 | devres_add(dev, ptr); | 765 | devres_add(dev, ptr); |
| @@ -672,7 +786,7 @@ int __device_reset(struct device *dev, bool optional) | |||
| 672 | struct reset_control *rstc; | 786 | struct reset_control *rstc; |
| 673 | int ret; | 787 | int ret; |
| 674 | 788 | ||
| 675 | rstc = __reset_control_get(dev, NULL, 0, 0, optional); | 789 | rstc = __reset_control_get(dev, NULL, 0, 0, optional, true); |
| 676 | if (IS_ERR(rstc)) | 790 | if (IS_ERR(rstc)) |
| 677 | return PTR_ERR(rstc); | 791 | return PTR_ERR(rstc); |
| 678 | 792 | ||
| @@ -736,7 +850,8 @@ of_reset_control_array_get(struct device_node *np, bool shared, bool optional) | |||
| 736 | return ERR_PTR(-ENOMEM); | 850 | return ERR_PTR(-ENOMEM); |
| 737 | 851 | ||
| 738 | for (i = 0; i < num; i++) { | 852 | for (i = 0; i < num; i++) { |
| 739 | rstc = __of_reset_control_get(np, NULL, i, shared, optional); | 853 | rstc = __of_reset_control_get(np, NULL, i, shared, optional, |
| 854 | true); | ||
| 740 | if (IS_ERR(rstc)) | 855 | if (IS_ERR(rstc)) |
| 741 | goto err_rst; | 856 | goto err_rst; |
| 742 | resets->rstc[i] = rstc; | 857 | resets->rstc[i] = rstc; |
diff --git a/include/linux/reset.h b/include/linux/reset.h index c1901b61ca30..ea9a8a1ce4b1 100644 --- a/include/linux/reset.h +++ b/include/linux/reset.h | |||
| @@ -14,18 +14,20 @@ int reset_control_reset(struct reset_control *rstc); | |||
| 14 | int reset_control_assert(struct reset_control *rstc); | 14 | int reset_control_assert(struct reset_control *rstc); |
| 15 | int reset_control_deassert(struct reset_control *rstc); | 15 | int reset_control_deassert(struct reset_control *rstc); |
| 16 | int reset_control_status(struct reset_control *rstc); | 16 | int reset_control_status(struct reset_control *rstc); |
| 17 | int reset_control_acquire(struct reset_control *rstc); | ||
| 18 | void reset_control_release(struct reset_control *rstc); | ||
| 17 | 19 | ||
| 18 | struct reset_control *__of_reset_control_get(struct device_node *node, | 20 | struct reset_control *__of_reset_control_get(struct device_node *node, |
| 19 | const char *id, int index, bool shared, | 21 | const char *id, int index, bool shared, |
| 20 | bool optional); | 22 | bool optional, bool acquired); |
| 21 | struct reset_control *__reset_control_get(struct device *dev, const char *id, | 23 | struct reset_control *__reset_control_get(struct device *dev, const char *id, |
| 22 | int index, bool shared, | 24 | int index, bool shared, |
| 23 | bool optional); | 25 | bool optional, bool acquired); |
| 24 | void reset_control_put(struct reset_control *rstc); | 26 | void reset_control_put(struct reset_control *rstc); |
| 25 | int __device_reset(struct device *dev, bool optional); | 27 | int __device_reset(struct device *dev, bool optional); |
| 26 | struct reset_control *__devm_reset_control_get(struct device *dev, | 28 | struct reset_control *__devm_reset_control_get(struct device *dev, |
| 27 | const char *id, int index, bool shared, | 29 | const char *id, int index, bool shared, |
| 28 | bool optional); | 30 | bool optional, bool acquired); |
| 29 | 31 | ||
| 30 | struct reset_control *devm_reset_control_array_get(struct device *dev, | 32 | struct reset_control *devm_reset_control_array_get(struct device *dev, |
| 31 | bool shared, bool optional); | 33 | bool shared, bool optional); |
| @@ -56,6 +58,15 @@ static inline int reset_control_status(struct reset_control *rstc) | |||
| 56 | return 0; | 58 | return 0; |
| 57 | } | 59 | } |
| 58 | 60 | ||
| 61 | static inline int reset_control_acquire(struct reset_control *rstc) | ||
| 62 | { | ||
| 63 | return 0; | ||
| 64 | } | ||
| 65 | |||
| 66 | static inline void reset_control_release(struct reset_control *rstc) | ||
| 67 | { | ||
| 68 | } | ||
| 69 | |||
| 59 | static inline void reset_control_put(struct reset_control *rstc) | 70 | static inline void reset_control_put(struct reset_control *rstc) |
| 60 | { | 71 | { |
| 61 | } | 72 | } |
| @@ -68,21 +79,23 @@ static inline int __device_reset(struct device *dev, bool optional) | |||
| 68 | static inline struct reset_control *__of_reset_control_get( | 79 | static inline struct reset_control *__of_reset_control_get( |
| 69 | struct device_node *node, | 80 | struct device_node *node, |
| 70 | const char *id, int index, bool shared, | 81 | const char *id, int index, bool shared, |
| 71 | bool optional) | 82 | bool optional, bool acquired) |
| 72 | { | 83 | { |
| 73 | return optional ? NULL : ERR_PTR(-ENOTSUPP); | 84 | return optional ? NULL : ERR_PTR(-ENOTSUPP); |
| 74 | } | 85 | } |
| 75 | 86 | ||
| 76 | static inline struct reset_control *__reset_control_get( | 87 | static inline struct reset_control *__reset_control_get( |
| 77 | struct device *dev, const char *id, | 88 | struct device *dev, const char *id, |
| 78 | int index, bool shared, bool optional) | 89 | int index, bool shared, bool optional, |
| 90 | bool acquired) | ||
| 79 | { | 91 | { |
| 80 | return optional ? NULL : ERR_PTR(-ENOTSUPP); | 92 | return optional ? NULL : ERR_PTR(-ENOTSUPP); |
| 81 | } | 93 | } |
| 82 | 94 | ||
| 83 | static inline struct reset_control *__devm_reset_control_get( | 95 | static inline struct reset_control *__devm_reset_control_get( |
| 84 | struct device *dev, const char *id, | 96 | struct device *dev, const char *id, |
| 85 | int index, bool shared, bool optional) | 97 | int index, bool shared, bool optional, |
| 98 | bool acquired) | ||
| 86 | { | 99 | { |
| 87 | return optional ? NULL : ERR_PTR(-ENOTSUPP); | 100 | return optional ? NULL : ERR_PTR(-ENOTSUPP); |
| 88 | } | 101 | } |
| @@ -134,7 +147,28 @@ static inline int device_reset_optional(struct device *dev) | |||
| 134 | static inline struct reset_control * | 147 | static inline struct reset_control * |
| 135 | __must_check reset_control_get_exclusive(struct device *dev, const char *id) | 148 | __must_check reset_control_get_exclusive(struct device *dev, const char *id) |
| 136 | { | 149 | { |
| 137 | return __reset_control_get(dev, id, 0, false, false); | 150 | return __reset_control_get(dev, id, 0, false, false, true); |
| 151 | } | ||
| 152 | |||
| 153 | /** | ||
| 154 | * reset_control_get_exclusive_released - Lookup and obtain a temoprarily | ||
| 155 | * exclusive reference to a reset | ||
| 156 | * controller. | ||
| 157 | * @dev: device to be reset by the controller | ||
| 158 | * @id: reset line name | ||
| 159 | * | ||
| 160 | * Returns a struct reset_control or IS_ERR() condition containing errno. | ||
| 161 | * reset-controls returned by this function must be acquired via | ||
| 162 | * reset_control_acquire() before they can be used and should be released | ||
| 163 | * via reset_control_release() afterwards. | ||
| 164 | * | ||
| 165 | * Use of id names is optional. | ||
| 166 | */ | ||
| 167 | static inline struct reset_control * | ||
| 168 | __must_check reset_control_get_exclusive_released(struct device *dev, | ||
| 169 | const char *id) | ||
| 170 | { | ||
| 171 | return __reset_control_get(dev, id, 0, false, false, false); | ||
| 138 | } | 172 | } |
| 139 | 173 | ||
| 140 | /** | 174 | /** |
| @@ -162,19 +196,19 @@ __must_check reset_control_get_exclusive(struct device *dev, const char *id) | |||
| 162 | static inline struct reset_control *reset_control_get_shared( | 196 | static inline struct reset_control *reset_control_get_shared( |
| 163 | struct device *dev, const char *id) | 197 | struct device *dev, const char *id) |
| 164 | { | 198 | { |
| 165 | return __reset_control_get(dev, id, 0, true, false); | 199 | return __reset_control_get(dev, id, 0, true, false, false); |
| 166 | } | 200 | } |
| 167 | 201 | ||
| 168 | static inline struct reset_control *reset_control_get_optional_exclusive( | 202 | static inline struct reset_control *reset_control_get_optional_exclusive( |
| 169 | struct device *dev, const char *id) | 203 | struct device *dev, const char *id) |
| 170 | { | 204 | { |
| 171 | return __reset_control_get(dev, id, 0, false, true); | 205 | return __reset_control_get(dev, id, 0, false, true, true); |
| 172 | } | 206 | } |
| 173 | 207 | ||
| 174 | static inline struct reset_control *reset_control_get_optional_shared( | 208 | static inline struct reset_control *reset_control_get_optional_shared( |
| 175 | struct device *dev, const char *id) | 209 | struct device *dev, const char *id) |
| 176 | { | 210 | { |
| 177 | return __reset_control_get(dev, id, 0, true, true); | 211 | return __reset_control_get(dev, id, 0, true, true, false); |
| 178 | } | 212 | } |
| 179 | 213 | ||
| 180 | /** | 214 | /** |
| @@ -190,7 +224,7 @@ static inline struct reset_control *reset_control_get_optional_shared( | |||
| 190 | static inline struct reset_control *of_reset_control_get_exclusive( | 224 | static inline struct reset_control *of_reset_control_get_exclusive( |
| 191 | struct device_node *node, const char *id) | 225 | struct device_node *node, const char *id) |
| 192 | { | 226 | { |
| 193 | return __of_reset_control_get(node, id, 0, false, false); | 227 | return __of_reset_control_get(node, id, 0, false, false, true); |
| 194 | } | 228 | } |
| 195 | 229 | ||
| 196 | /** | 230 | /** |
| @@ -215,7 +249,7 @@ static inline struct reset_control *of_reset_control_get_exclusive( | |||
| 215 | static inline struct reset_control *of_reset_control_get_shared( | 249 | static inline struct reset_control *of_reset_control_get_shared( |
| 216 | struct device_node *node, const char *id) | 250 | struct device_node *node, const char *id) |
| 217 | { | 251 | { |
| 218 | return __of_reset_control_get(node, id, 0, true, false); | 252 | return __of_reset_control_get(node, id, 0, true, false, false); |
| 219 | } | 253 | } |
| 220 | 254 | ||
| 221 | /** | 255 | /** |
| @@ -232,7 +266,7 @@ static inline struct reset_control *of_reset_control_get_shared( | |||
| 232 | static inline struct reset_control *of_reset_control_get_exclusive_by_index( | 266 | static inline struct reset_control *of_reset_control_get_exclusive_by_index( |
| 233 | struct device_node *node, int index) | 267 | struct device_node *node, int index) |
| 234 | { | 268 | { |
| 235 | return __of_reset_control_get(node, NULL, index, false, false); | 269 | return __of_reset_control_get(node, NULL, index, false, false, true); |
| 236 | } | 270 | } |
| 237 | 271 | ||
| 238 | /** | 272 | /** |
| @@ -260,7 +294,7 @@ static inline struct reset_control *of_reset_control_get_exclusive_by_index( | |||
| 260 | static inline struct reset_control *of_reset_control_get_shared_by_index( | 294 | static inline struct reset_control *of_reset_control_get_shared_by_index( |
| 261 | struct device_node *node, int index) | 295 | struct device_node *node, int index) |
| 262 | { | 296 | { |
| 263 | return __of_reset_control_get(node, NULL, index, true, false); | 297 | return __of_reset_control_get(node, NULL, index, true, false, false); |
| 264 | } | 298 | } |
| 265 | 299 | ||
| 266 | /** | 300 | /** |
| @@ -279,7 +313,26 @@ static inline struct reset_control * | |||
| 279 | __must_check devm_reset_control_get_exclusive(struct device *dev, | 313 | __must_check devm_reset_control_get_exclusive(struct device *dev, |
| 280 | const char *id) | 314 | const char *id) |
| 281 | { | 315 | { |
| 282 | return __devm_reset_control_get(dev, id, 0, false, false); | 316 | return __devm_reset_control_get(dev, id, 0, false, false, true); |
| 317 | } | ||
| 318 | |||
| 319 | /** | ||
| 320 | * devm_reset_control_get_exclusive_released - resource managed | ||
| 321 | * reset_control_get_exclusive_released() | ||
| 322 | * @dev: device to be reset by the controller | ||
| 323 | * @id: reset line name | ||
| 324 | * | ||
| 325 | * Managed reset_control_get_exclusive_released(). For reset controllers | ||
| 326 | * returned from this function, reset_control_put() is called automatically on | ||
| 327 | * driver detach. | ||
| 328 | * | ||
| 329 | * See reset_control_get_exclusive_released() for more information. | ||
| 330 | */ | ||
| 331 | static inline struct reset_control * | ||
| 332 | __must_check devm_reset_control_get_exclusive_released(struct device *dev, | ||
| 333 | const char *id) | ||
| 334 | { | ||
| 335 | return __devm_reset_control_get(dev, id, 0, false, false, false); | ||
| 283 | } | 336 | } |
| 284 | 337 | ||
| 285 | /** | 338 | /** |
| @@ -294,19 +347,19 @@ __must_check devm_reset_control_get_exclusive(struct device *dev, | |||
| 294 | static inline struct reset_control *devm_reset_control_get_shared( | 347 | static inline struct reset_control *devm_reset_control_get_shared( |
| 295 | struct device *dev, const char *id) | 348 | struct device *dev, const char *id) |
| 296 | { | 349 | { |
| 297 | return __devm_reset_control_get(dev, id, 0, true, false); | 350 | return __devm_reset_control_get(dev, id, 0, true, false, false); |
| 298 | } | 351 | } |
| 299 | 352 | ||
| 300 | static inline struct reset_control *devm_reset_control_get_optional_exclusive( | 353 | static inline struct reset_control *devm_reset_control_get_optional_exclusive( |
| 301 | struct device *dev, const char *id) | 354 | struct device *dev, const char *id) |
| 302 | { | 355 | { |
| 303 | return __devm_reset_control_get(dev, id, 0, false, true); | 356 | return __devm_reset_control_get(dev, id, 0, false, true, true); |
| 304 | } | 357 | } |
| 305 | 358 | ||
| 306 | static inline struct reset_control *devm_reset_control_get_optional_shared( | 359 | static inline struct reset_control *devm_reset_control_get_optional_shared( |
| 307 | struct device *dev, const char *id) | 360 | struct device *dev, const char *id) |
| 308 | { | 361 | { |
| 309 | return __devm_reset_control_get(dev, id, 0, true, true); | 362 | return __devm_reset_control_get(dev, id, 0, true, true, false); |
| 310 | } | 363 | } |
| 311 | 364 | ||
| 312 | /** | 365 | /** |
| @@ -324,7 +377,7 @@ static inline struct reset_control *devm_reset_control_get_optional_shared( | |||
| 324 | static inline struct reset_control * | 377 | static inline struct reset_control * |
| 325 | devm_reset_control_get_exclusive_by_index(struct device *dev, int index) | 378 | devm_reset_control_get_exclusive_by_index(struct device *dev, int index) |
| 326 | { | 379 | { |
| 327 | return __devm_reset_control_get(dev, NULL, index, false, false); | 380 | return __devm_reset_control_get(dev, NULL, index, false, false, true); |
| 328 | } | 381 | } |
| 329 | 382 | ||
| 330 | /** | 383 | /** |
| @@ -340,7 +393,7 @@ devm_reset_control_get_exclusive_by_index(struct device *dev, int index) | |||
| 340 | static inline struct reset_control * | 393 | static inline struct reset_control * |
| 341 | devm_reset_control_get_shared_by_index(struct device *dev, int index) | 394 | devm_reset_control_get_shared_by_index(struct device *dev, int index) |
| 342 | { | 395 | { |
| 343 | return __devm_reset_control_get(dev, NULL, index, true, false); | 396 | return __devm_reset_control_get(dev, NULL, index, true, false, false); |
| 344 | } | 397 | } |
| 345 | 398 | ||
| 346 | /* | 399 | /* |
