History

reset: Add acquired flag to of_reset_control_array_get()

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().

Thierry Reding committed 7 years ago

Commit f31d5c21 parent c84b0323 files · +16 −10Browse files

Unified · Split

3 files
  1. drivers/reset/core.c +6 −3
  2. drivers/usb/dwc3/dwc3-of-simple.c +2 −1
  3. include/linux/reset.h +8 −6
drivers/reset/core.c+6−3
@@ -830,12 +830,15 @@ static int of_reset_control_get_count(struct device_node *node) · 829 unmodified lines
830830 * @np: device node for the device that requests the reset controls array
831831 * @shared: whether reset controls are shared or not
832832 * @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
833835 *
834836 * Returns pointer to allocated reset_control_array on success or
835837 * error on failure
836838 */
837839 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)
839842 {
840843 struct reset_control_array *resets;
841844 struct reset_control *rstc;
@@ -851,7 +854,7 @@ of_reset_control_array_get(struct device_node *np, bool shared, bool optional) · 9 unmodified lines
851854
852855 for (i = 0; i < num; i++) {
853856 rstc = __of_reset_control_get(np, NULL, i, shared, optional,
854− true);
857+ acquired);
855858 if (IS_ERR(rstc))
856859 goto err_rst;
857860 resets->rstc[i] = rstc;
@@ -898,7 +901,7 @@ devm_reset_control_array_get(struct device *dev, bool shared, bool optional) · 40 unmodified lines
898901 if (!devres)
899902 return ERR_PTR(-ENOMEM);
900903
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);
902905 if (IS_ERR(rstc)) {
903906 devres_free(devres);
904907 return rstc;
drivers/usb/dwc3/dwc3-of-simple.c+2−1
@@ -107,7 +107,8 @@ static int dwc3_of_simple_probe(struct platform_device *pdev) · 106 unmodified lines
107107 simple->pulse_resets = true;
108108 }
109109
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);
111112 if (IS_ERR(simple->resets)) {
112113 ret = PTR_ERR(simple->resets);
113114 dev_err(dev, "failed to get device resets, err=%d\n", ret);
include/linux/reset.h+8−6
@@ -32,7 +32,8 @@ struct reset_control *__devm_reset_control_get(struct device *dev, · 31 unmodified lines
3232 struct reset_control *devm_reset_control_array_get(struct device *dev,
3333 bool shared, bool optional);
3434 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);
3637
3738 int reset_control_get_count(struct device *dev);
3839
@@ -107,7 +108,8 @@ devm_reset_control_array_get(struct device *dev, bool shared, bool optional) · 68 unmodified lines
107108 }
108109
109110 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)
111113 {
112114 return optional ? NULL : ERR_PTR(-ENOTSUPP);
113115 }
@@ -465,24 +467,24 @@ devm_reset_control_array_get_optional_shared(struct device *dev) · 351 unmodified lines
465467 static inline struct reset_control *
466468 of_reset_control_array_get_exclusive(struct device_node *node)
467469 {
468− return of_reset_control_array_get(node, false, false);
470+ return of_reset_control_array_get(node, false, false, true);
469471 }
470472
471473 static inline struct reset_control *
472474 of_reset_control_array_get_shared(struct device_node *node)
473475 {
474− return of_reset_control_array_get(node, true, false);
476+ return of_reset_control_array_get(node, true, false, true);
475477 }
476478
477479 static inline struct reset_control *
478480 of_reset_control_array_get_optional_exclusive(struct device_node *node)
479481 {
480− return of_reset_control_array_get(node, false, true);
482+ return of_reset_control_array_get(node, false, true, true);
481483 }
482484
483485 static inline struct reset_control *
484486 of_reset_control_array_get_optional_shared(struct device_node *node)
485487 {
486− return of_reset_control_array_get(node, true, true);
488+ return of_reset_control_array_get(node, true, true, true);
487489 }
488490 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t