Skip to contentSkip to conversation

regualtor: core: Make error messages more informative

PATCH Superseded Stephen Boyd 2 participants 2 messages Sep 15, 2015 – Sep 16, 2015 Voltage and current regulator framework

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regualtor: core: Make error messages more informative

The same error print exists 4 times in the regulator core

<rdev>: operation not allowed

Unfortunately, seeing this in the dmesg is not very informative. Add what type of operation is not allowed to the message so that these errors are unique, hopefully pointing developers in the right direction

<rdev>: operation (drms) not allowed
<rdev>: operation (voltage) not allowed
<rdev>: operation (current) not allowed
<rdev>: operation (mode) not allowed

---
 drivers/regulator/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/regulator/core.c +4 -4
index 9283d9f7919b..580c34bca65d 100644
@@ -180,7 +180,7 @@ static int regulator_check_voltage(struct regulator_dev *rdev,
 		return -ENODEV;
 	}
 	if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
-		rdev_err(rdev, "operation not allowed\n");
+		rdev_err(rdev, "operation (voltage) not allowed\n");
 		return -EPERM;
 	}
 
@@ -240,7 +240,7 @@ static int regulator_check_current_limit(struct regulator_dev *rdev,
 		return -ENODEV;
 	}
 	if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_CURRENT)) {
-		rdev_err(rdev, "operation not allowed\n");
+		rdev_err(rdev, "operation (current) not allowed\n");
 		return -EPERM;
 	}
 
@@ -277,7 +277,7 @@ static int regulator_mode_constrain(struct regulator_dev *rdev, int *mode)
 		return -ENODEV;
 	}
 	if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_MODE)) {
-		rdev_err(rdev, "operation not allowed\n");
+		rdev_err(rdev, "operation (mode) not allowed\n");
 		return -EPERM;
 	}
 
@@ -301,7 +301,7 @@ static int regulator_check_drms(struct regulator_dev *rdev)
 		return -ENODEV;
 	}
 	if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS)) {
-		rdev_dbg(rdev, "operation not allowed\n");
+		rdev_dbg(rdev, "operation (drms) not allowed\n");
 		return -EPERM;
 	}
 	return 0;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
maintainer
#1 lore raw
Quoted 9 lines · Stephen Boyd

Unfortunately, seeing this in the dmesg is not very informative. Add what type of operation is not allowed to the message so that these errors are unique, hopefully pointing developers in the right direction

<rdev>: operation (drms) not allowed
<rdev>: operation (voltage) not allowed
<rdev>: operation (current) not allowed
<rdev>: operation (mode) not allowed

Structure (normal) for text readable (human) message please. :)