diff options
author | Arnaud Ebalard <arno@natisbad.org> | 2014-12-10 18:54:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 20:41:16 -0500 |
commit | cf67d0b6410182eefd4db665279fce76c9a19cf9 (patch) | |
tree | 72d295432c25074385f236b116efac7ea491f24a /drivers/rtc | |
parent | 10df1e6787647f381a90689a5285555275f1a3a3 (diff) |
drivers/rtc/rtc-isl12057.c: report error code upon failure in dev_err() calls
As pointed out by Mark, it is generally useful to log the error code when
reporting a failure. This patch improves existing calls to dev_err() in
ISL12057 driver to also report error code.
Signed-off-by: Arnaud Ebalard <arno@natisbad.org>
Suggested-by: Mark Brown <broonie@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Peter Huewe <peter.huewe@infineon.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Thierry Reding <treding@nvidia.com>
Cc: Grant Likely <grant.likely@linaro.org>
Acked-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-isl12057.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-isl12057.c b/drivers/rtc/rtc-isl12057.c index fe562820a54a..6e1fcfb5d7e6 100644 --- a/drivers/rtc/rtc-isl12057.c +++ b/drivers/rtc/rtc-isl12057.c | |||
@@ -170,8 +170,8 @@ static int isl12057_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
170 | mutex_lock(&data->lock); | 170 | mutex_lock(&data->lock); |
171 | ret = regmap_read(data->regmap, ISL12057_REG_SR, &sr); | 171 | ret = regmap_read(data->regmap, ISL12057_REG_SR, &sr); |
172 | if (ret) { | 172 | if (ret) { |
173 | dev_err(dev, "%s: unable to read oscillator status flag\n", | 173 | dev_err(dev, "%s: unable to read oscillator status flag (%d)\n", |
174 | __func__); | 174 | __func__, ret); |
175 | goto out; | 175 | goto out; |
176 | } else { | 176 | } else { |
177 | if (sr & ISL12057_REG_SR_OSF) { | 177 | if (sr & ISL12057_REG_SR_OSF) { |
@@ -183,7 +183,8 @@ static int isl12057_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
183 | ret = regmap_bulk_read(data->regmap, ISL12057_REG_RTC_SC, regs, | 183 | ret = regmap_bulk_read(data->regmap, ISL12057_REG_RTC_SC, regs, |
184 | ISL12057_RTC_SEC_LEN); | 184 | ISL12057_RTC_SEC_LEN); |
185 | if (ret) | 185 | if (ret) |
186 | dev_err(dev, "%s: unable to read RTC time\n", __func__); | 186 | dev_err(dev, "%s: unable to read RTC time section (%d)\n", |
187 | __func__, ret); | ||
187 | 188 | ||
188 | out: | 189 | out: |
189 | mutex_unlock(&data->lock); | 190 | mutex_unlock(&data->lock); |
@@ -210,7 +211,8 @@ static int isl12057_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
210 | ret = regmap_bulk_write(data->regmap, ISL12057_REG_RTC_SC, regs, | 211 | ret = regmap_bulk_write(data->regmap, ISL12057_REG_RTC_SC, regs, |
211 | ISL12057_RTC_SEC_LEN); | 212 | ISL12057_RTC_SEC_LEN); |
212 | if (ret) { | 213 | if (ret) { |
213 | dev_err(dev, "%s: writing RTC time failed\n", __func__); | 214 | dev_err(dev, "%s: unable to write RTC time section (%d)\n", |
215 | __func__, ret); | ||
214 | goto out; | 216 | goto out; |
215 | } | 217 | } |
216 | 218 | ||
@@ -221,7 +223,8 @@ static int isl12057_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
221 | ret = regmap_update_bits(data->regmap, ISL12057_REG_SR, | 223 | ret = regmap_update_bits(data->regmap, ISL12057_REG_SR, |
222 | ISL12057_REG_SR_OSF, 0); | 224 | ISL12057_REG_SR_OSF, 0); |
223 | if (ret < 0) | 225 | if (ret < 0) |
224 | dev_err(dev, "Unable to clear oscillator failure bit\n"); | 226 | dev_err(dev, "%s: unable to clear osc. failure bit (%d)\n", |
227 | __func__, ret); | ||
225 | 228 | ||
226 | out: | 229 | out: |
227 | mutex_unlock(&data->lock); | 230 | mutex_unlock(&data->lock); |
@@ -242,7 +245,8 @@ static int isl12057_check_rtc_status(struct device *dev, struct regmap *regmap) | |||
242 | ret = regmap_update_bits(regmap, ISL12057_REG_INT, | 245 | ret = regmap_update_bits(regmap, ISL12057_REG_INT, |
243 | ISL12057_REG_INT_EOSC, 0); | 246 | ISL12057_REG_INT_EOSC, 0); |
244 | if (ret < 0) { | 247 | if (ret < 0) { |
245 | dev_err(dev, "Unable to enable oscillator\n"); | 248 | dev_err(dev, "%s: unable to enable oscillator (%d)\n", |
249 | __func__, ret); | ||
246 | return ret; | 250 | return ret; |
247 | } | 251 | } |
248 | 252 | ||
@@ -250,7 +254,8 @@ static int isl12057_check_rtc_status(struct device *dev, struct regmap *regmap) | |||
250 | ret = regmap_update_bits(regmap, ISL12057_REG_SR, | 254 | ret = regmap_update_bits(regmap, ISL12057_REG_SR, |
251 | ISL12057_REG_SR_A1F, 0); | 255 | ISL12057_REG_SR_A1F, 0); |
252 | if (ret < 0) { | 256 | if (ret < 0) { |
253 | dev_err(dev, "Unable to clear alarm bit\n"); | 257 | dev_err(dev, "%s: unable to clear alarm bit (%d)\n", |
258 | __func__, ret); | ||
254 | return ret; | 259 | return ret; |
255 | } | 260 | } |
256 | 261 | ||
@@ -284,7 +289,8 @@ static int isl12057_probe(struct i2c_client *client, | |||
284 | regmap = devm_regmap_init_i2c(client, &isl12057_rtc_regmap_config); | 289 | regmap = devm_regmap_init_i2c(client, &isl12057_rtc_regmap_config); |
285 | if (IS_ERR(regmap)) { | 290 | if (IS_ERR(regmap)) { |
286 | ret = PTR_ERR(regmap); | 291 | ret = PTR_ERR(regmap); |
287 | dev_err(dev, "regmap allocation failed: %d\n", ret); | 292 | dev_err(dev, "%s: regmap allocation failed (%d)\n", |
293 | __func__, ret); | ||
288 | return ret; | 294 | return ret; |
289 | } | 295 | } |
290 | 296 | ||