From 819032fadd70cfbf1b67a48276524c80bcb8b81c Mon Sep 17 00:00:00 2001 From: Abhijeet Dharmapurikar Date: Fri, 9 Sep 2016 11:27:46 -0700 Subject: [PATCH 1/2] iio: rradc: Add a format string in log prints Currently it is hard to decipher the logs coming from the RRADC driver. Add a pr_fmt define to help with this Change-Id: Ifd70ca3071a7305ba064de7409090ce487c56968 Signed-off-by: Abhijeet Dharmapurikar --- drivers/iio/adc/qcom-rradc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iio/adc/qcom-rradc.c b/drivers/iio/adc/qcom-rradc.c index ae2df4f7ff0d..a0fcad198f62 100644 --- a/drivers/iio/adc/qcom-rradc.c +++ b/drivers/iio/adc/qcom-rradc.c @@ -11,6 +11,8 @@ * GNU General Public License for more details. */ +#define pr_fmt(fmt) "RRADC: %s: " fmt, __func__ + #include #include #include From 3850d272a614189f0c5a68e89fc7ae825aedc6be Mon Sep 17 00:00:00 2001 From: Abhijeet Dharmapurikar Date: Fri, 9 Sep 2016 12:00:19 -0700 Subject: [PATCH 2/2] qcom-charger: handle get prop errors graciously Currently the code passes on the error value it receives from the individual property getters. This causes the read of uevent to fail. Instead convert those errors to -ENODATA which the power supply framework handles graciously and keeps the read of uevent entry from failing. It simply skips reporting that property in uevent. Change-Id: I997197c7c7315769e49342da7973a9f79ab54c80 Signed-off-by: Abhijeet Dharmapurikar --- drivers/power/qcom-charger/qpnp-smb2.c | 20 ++++++++++++---- drivers/power/qcom-charger/smb138x-charger.c | 24 +++++++++++++------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/drivers/power/qcom-charger/qpnp-smb2.c b/drivers/power/qcom-charger/qpnp-smb2.c index f83b641bcc4f..993856032711 100644 --- a/drivers/power/qcom-charger/qpnp-smb2.c +++ b/drivers/power/qcom-charger/qpnp-smb2.c @@ -392,7 +392,11 @@ static int smb2_usb_get_prop(struct power_supply *psy, rc = -EINVAL; break; } - return rc; + if (rc < 0) { + pr_debug("Couldn't get prop %d rc = %d\n", psp, rc); + return -ENODATA; + } + return 0; } static int smb2_usb_set_prop(struct power_supply *psy, @@ -506,8 +510,11 @@ static int smb2_dc_get_prop(struct power_supply *psy, default: return -EINVAL; } - - return rc; + if (rc < 0) { + pr_debug("Couldn't get prop %d rc = %d\n", psp, rc); + return -ENODATA; + } + return 0; } static int smb2_dc_set_prop(struct power_supply *psy, @@ -633,8 +640,11 @@ static int smb2_batt_get_prop(struct power_supply *psy, pr_err("batt power supply prop %d not supported\n", psp); return -EINVAL; } - - return rc; + if (rc < 0) { + pr_debug("Couldn't get prop %d rc = %d\n", psp, rc); + return -ENODATA; + } + return 0; } static int smb2_batt_set_prop(struct power_supply *psy, diff --git a/drivers/power/qcom-charger/smb138x-charger.c b/drivers/power/qcom-charger/smb138x-charger.c index cc72772dba88..c41ce8c09f86 100644 --- a/drivers/power/qcom-charger/smb138x-charger.c +++ b/drivers/power/qcom-charger/smb138x-charger.c @@ -184,8 +184,11 @@ static int smb138x_usb_get_prop(struct power_supply *psy, pr_err("get prop %d is not supported\n", prop); return -EINVAL; } - - return rc; + if (rc < 0) { + pr_debug("Couldn't get prop %d rc = %d\n", prop, rc); + return -ENODATA; + } + return 0; } static int smb138x_usb_set_prop(struct power_supply *psy, @@ -297,12 +300,14 @@ static int smb138x_batt_get_prop(struct power_supply *psy, rc = smblib_get_prop_batt_capacity(chg, val); break; default: - pr_err("batt power supply get prop %d not supported\n", - prop); + pr_err("batt power supply get prop %d not supported\n", prop); return -EINVAL; } - - return rc; + if (rc < 0) { + pr_debug("Couldn't get prop %d rc = %d\n", prop, rc); + return -ENODATA; + } + return 0; } static int smb138x_batt_set_prop(struct power_supply *psy, @@ -420,8 +425,11 @@ static int smb138x_parallel_get_prop(struct power_supply *psy, prop); return -EINVAL; } - - return rc; + if (rc < 0) { + pr_debug("Couldn't get prop %d rc = %d\n", prop, rc); + return -ENODATA; + } + return 0; } static int smb138x_parallel_set_prop(struct power_supply *psy,