In order to be able to request an array of reset controls in acquired or released mode, add the acquired flag to of_reset_control_array_get() and pass the flag to subsequent calls of __of_reset_control_get().
Unified · Split
| @@ -830,12 +830,15 @@ static int of_reset_control_get_count(struct device_node *node) · 829 unmodified lines | |||
| 830 | * @np: device node for the device that requests the reset controls array | 830 | * @np: device node for the device that requests the reset controls array |
| 831 | * @shared: whether reset controls are shared or not | 831 | * @shared: whether reset controls are shared or not |
| 832 | * @optional: whether it is optional to get the reset controls | 832 | * @optional: whether it is optional to get the reset controls |
| 833 | * @acquired: only one reset control may be acquired for a given controller | ||
| 834 | * and ID | ||
| 833 | * | 835 | * |
| 834 | * Returns pointer to allocated reset_control_array on success or | 836 | * Returns pointer to allocated reset_control_array on success or |
| 835 | * error on failure | 837 | * error on failure |
| 836 | */ | 838 | */ |
| 837 | struct reset_control * | 839 | struct reset_control * |
| 838 | of_reset_control_array_get(struct device_node *np, bool shared, bool optional) | 840 | of_reset_control_array_get(struct device_node *np, bool shared, bool optional, |
| 841 | bool acquired) | ||
| 839 | { | 842 | { |
| 840 | struct reset_control_array *resets; | 843 | struct reset_control_array *resets; |
| 841 | struct reset_control *rstc; | 844 | struct reset_control *rstc; |
| @@ -851,7 +854,7 @@ of_reset_control_array_get(struct device_node *np, bool shared, bool optional) · 9 unmodified lines | |||
| 851 | 854 | ||
| 852 | for (i = 0; i < num; i++) { | 855 | for (i = 0; i < num; i++) { |
| 853 | rstc = __of_reset_control_get(np, NULL, i, shared, optional, | 856 | rstc = __of_reset_control_get(np, NULL, i, shared, optional, |
| 854 | true); | 857 | acquired); |
| 855 | if (IS_ERR(rstc)) | 858 | if (IS_ERR(rstc)) |
| 856 | goto err_rst; | 859 | goto err_rst; |
| 857 | resets->rstc[i] = rstc; | 860 | resets->rstc[i] = rstc; |
| @@ -898,7 +901,7 @@ devm_reset_control_array_get(struct device *dev, bool shared, bool optional) · 40 unmodified lines | |||
| 898 | if (!devres) | 901 | if (!devres) |
| 899 | return ERR_PTR(-ENOMEM); | 902 | return ERR_PTR(-ENOMEM); |
| 900 | 903 | ||
| 901 | rstc = of_reset_control_array_get(dev->of_node, shared, optional); | 904 | rstc = of_reset_control_array_get(dev->of_node, shared, optional, true); |
| 902 | if (IS_ERR(rstc)) { | 905 | if (IS_ERR(rstc)) { |
| 903 | devres_free(devres); | 906 | devres_free(devres); |
| 904 | return rstc; | 907 | return rstc; |
| @@ -107,7 +107,8 @@ static int dwc3_of_simple_probe(struct platform_device *pdev) · 106 unmodified lines | |||
| 107 | simple->pulse_resets = true; | 107 | simple->pulse_resets = true; |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | simple->resets = of_reset_control_array_get(np, shared_resets, true); | 110 | simple->resets = of_reset_control_array_get(np, shared_resets, true, |
| 111 | true); | ||
| 111 | if (IS_ERR(simple->resets)) { | 112 | if (IS_ERR(simple->resets)) { |
| 112 | ret = PTR_ERR(simple->resets); | 113 | ret = PTR_ERR(simple->resets); |
| 113 | dev_err(dev, "failed to get device resets, err=%d\n", ret); | 114 | dev_err(dev, "failed to get device resets, err=%d\n", ret); |
| @@ -32,7 +32,8 @@ struct reset_control *__devm_reset_control_get(struct device *dev, · 31 unmodified lines | |||
| 32 | struct reset_control *devm_reset_control_array_get(struct device *dev, | 32 | struct reset_control *devm_reset_control_array_get(struct device *dev, |
| 33 | bool shared, bool optional); | 33 | bool shared, bool optional); |
| 34 | struct reset_control *of_reset_control_array_get(struct device_node *np, | 34 | struct reset_control *of_reset_control_array_get(struct device_node *np, |
| 35 | bool shared, bool optional); | 35 | bool shared, bool optional, |
| 36 | bool acquired); | ||
| 36 | 37 | ||
| 37 | int reset_control_get_count(struct device *dev); | 38 | int reset_control_get_count(struct device *dev); |
| 38 | 39 | ||
| @@ -107,7 +108,8 @@ devm_reset_control_array_get(struct device *dev, bool shared, bool optional) · 68 unmodified lines | |||
| 107 | } | 108 | } |
| 108 | 109 | ||
| 109 | static inline struct reset_control * | 110 | static inline struct reset_control * |
| 110 | of_reset_control_array_get(struct device_node *np, bool shared, bool optional) | 111 | of_reset_control_array_get(struct device_node *np, bool shared, bool optional, |
| 112 | bool acquired) | ||
| 111 | { | 113 | { |
| 112 | return optional ? NULL : ERR_PTR(-ENOTSUPP); | 114 | return optional ? NULL : ERR_PTR(-ENOTSUPP); |
| 113 | } | 115 | } |
| @@ -465,24 +467,24 @@ devm_reset_control_array_get_optional_shared(struct device *dev) · 351 unmodified lines | |||
| 465 | static inline struct reset_control * | 467 | static inline struct reset_control * |
| 466 | of_reset_control_array_get_exclusive(struct device_node *node) | 468 | of_reset_control_array_get_exclusive(struct device_node *node) |
| 467 | { | 469 | { |
| 468 | return of_reset_control_array_get(node, false, false); | 470 | return of_reset_control_array_get(node, false, false, true); |
| 469 | } | 471 | } |
| 470 | 472 | ||
| 471 | static inline struct reset_control * | 473 | static inline struct reset_control * |
| 472 | of_reset_control_array_get_shared(struct device_node *node) | 474 | of_reset_control_array_get_shared(struct device_node *node) |
| 473 | { | 475 | { |
| 474 | return of_reset_control_array_get(node, true, false); | 476 | return of_reset_control_array_get(node, true, false, true); |
| 475 | } | 477 | } |
| 476 | 478 | ||
| 477 | static inline struct reset_control * | 479 | static inline struct reset_control * |
| 478 | of_reset_control_array_get_optional_exclusive(struct device_node *node) | 480 | of_reset_control_array_get_optional_exclusive(struct device_node *node) |
| 479 | { | 481 | { |
| 480 | return of_reset_control_array_get(node, false, true); | 482 | return of_reset_control_array_get(node, false, true, true); |
| 481 | } | 483 | } |
| 482 | 484 | ||
| 483 | static inline struct reset_control * | 485 | static inline struct reset_control * |
| 484 | of_reset_control_array_get_optional_shared(struct device_node *node) | 486 | of_reset_control_array_get_optional_shared(struct device_node *node) |
| 485 | { | 487 | { |
| 486 | return of_reset_control_array_get(node, true, true); | 488 | return of_reset_control_array_get(node, true, true, true); |
| 487 | } | 489 | } |
| 488 | #endif | 490 | #endif |