|
@@ -131,6 +131,45 @@ static bool have_full_constraints(void)
|
|
|
return has_full_constraints || of_have_populated_dt();
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * regulator_lock_supply - lock a regulator and its supplies
|
|
|
+ * @rdev: regulator source
|
|
|
+ */
|
|
|
+static void regulator_lock_supply(struct regulator_dev *rdev)
|
|
|
+{
|
|
|
+ struct regulator *supply;
|
|
|
+ int i = 0;
|
|
|
+
|
|
|
+ while (1) {
|
|
|
+ mutex_lock_nested(&rdev->mutex, i++);
|
|
|
+ supply = rdev->supply;
|
|
|
+
|
|
|
+ if (!rdev->supply)
|
|
|
+ return;
|
|
|
+
|
|
|
+ rdev = supply->rdev;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * regulator_unlock_supply - unlock a regulator and its supplies
|
|
|
+ * @rdev: regulator source
|
|
|
+ */
|
|
|
+static void regulator_unlock_supply(struct regulator_dev *rdev)
|
|
|
+{
|
|
|
+ struct regulator *supply;
|
|
|
+
|
|
|
+ while (1) {
|
|
|
+ mutex_unlock(&rdev->mutex);
|
|
|
+ supply = rdev->supply;
|
|
|
+
|
|
|
+ if (!rdev->supply)
|
|
|
+ return;
|
|
|
+
|
|
|
+ rdev = supply->rdev;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* of_get_regulator - get a regulator device node based on supply name
|
|
|
* @dev: Device pointer for the consumer (of regulator) device
|