From patchwork Fri Nov 14 23:07:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Ebalard X-Patchwork-Id: 5310141 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 894A6C11AC for ; Fri, 14 Nov 2014 23:08:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A83B920125 for ; Fri, 14 Nov 2014 23:08:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C3A042012D for ; Fri, 14 Nov 2014 23:08:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XpPxF-0006Xy-EX; Fri, 14 Nov 2014 23:07:01 +0000 Received: from 36.223.133.77.rev.sfr.net ([77.133.223.36] helo=smtp.natisbad.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XpPx9-0006IF-3x for linux-arm-kernel@lists.infradead.org; Fri, 14 Nov 2014 23:06:55 +0000 Received: by smtp.natisbad.org (Postfix, from userid 109) id DDF621700699; Sat, 15 Nov 2014 00:06:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=natisbad.org; s=mail; t=1416006370; bh=iVFzLNxWtrpiR8p/2s9JOmJmcaYumMjJDrlzcTILrrA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ZJPoKczvdW1R3K6gTojAZpNhxfhwznPwh+OtT97FGynpWacpUxqpLQti/RdGcGlu/ DkkZheLGtjexH7FeQo9Gbo8A0sGpEJJev7Be6hjuo3D3qZyPaL80bmVebjt/7K6I9O y8fEuX1R3Q3m6H2aGzoOrjdvYebLX+zULc0TeaHA= X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from small (localhost [IPv6:::1]) by smtp.natisbad.org (Postfix) with ESMTP id E4BC417003F0; Sat, 15 Nov 2014 00:03:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=natisbad.org; s=mail; t=1416006239; bh=iVFzLNxWtrpiR8p/2s9JOmJmcaYumMjJDrlzcTILrrA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=uYEc/EQJxK4ArkByhnU4USyejPFkC+KvZ2fZBKeh/Y+tCxiqDqOtR9iZFXPGZTHeA kFL/uZlOQC8B2tfR0+fqidB0f3oCkROLS72N/zH1nYlyIu+6Vm2lP0+hj1LNBJZaT8 lSMuXKjQPU1BJ1LhEuqtSJBizOrTMw6DGxUUC9iY= X-Hashcash: 1:20:141114:mark.rutland@arm.com::HCISlkB27a4EFrmy:000000000000000000000000000000000000000001mts X-Hashcash: 1:20:141114:a.zummo@towertech.it::hzBATTgWlt1TZGBf:000000000000000000000000000000000000000000PaW X-Hashcash: 1:20:141114:peter.huewe@infineon.com::9PQaePF4Sn6f+mH9:000000000000000000000000000000000000016eJ X-Hashcash: 1:20:141114:linus.walleij@linaro.org::yzAXwPNbHM+VER3z:00000000000000000000000000000000000009V1a X-Hashcash: 1:20:141114:treding@nvidia.com::3IVFTIM8DufR/PMY:00000000000000000000000000000000000000000006Iw+ X-Hashcash: 1:20:141114:broonie@kernel.org::eaEmLwCBJPCXdaGc:00000000000000000000000000000000000000000006uKZ X-Hashcash: 1:20:141114:rob.herring@calxeda.com::OArK/5UlIWZR+e7s:000000000000000000000000000000000000004hCn X-Hashcash: 1:20:141114:pawel.moll@arm.com::ldBfzWaXR0qJ01qM:00000000000000000000000000000000000000000003z+M X-Hashcash: 1:20:141114:swarren@wwwdotorg.org::VdNDmyjyUxrx7vvv:00000000000000000000000000000000000000001tVV X-Hashcash: 1:20:141114:ijc+devicetree@hellion.org.uk::A95NWf3pZWjWxSbx:0000000000000000000000000000000060Wh X-Hashcash: 1:20:141114:grant.likely@linaro.org::PLJIe2ci3aV2xtVn:00000000000000000000000000000000000000BNWw X-Hashcash: 1:20:141114:devicetree@vger.kernel.org::mUUGvHNfwysRZIKl:000000000000000000000000000000000002FYY X-Hashcash: 1:20:141114:linux-doc@vger.kernel.org::dyEyNMdXjwnqDFEb:0000000000000000000000000000000000001M7z X-Hashcash: 1:20:141114:rob@landley.net::xdnolBl3b4sk6sPN:00HRR9 X-Hashcash: 1:20:141114:rtc-linux@googlegroups.com::sYR4+R0JeF3oQBNC:000000000000000000000000000000000000FSE X-Hashcash: 1:20:141114:jason@lakedaemon.net::SsHqRwYlNhPbmPse:000000000000000000000000000000000000000001qPU X-Hashcash: 1:20:141114:linux@roeck-us.net::0z3gjoRHBaP/2ft5:00000000000000000000000000000000000000000001WNN X-Hashcash: 1:20:141114:jgunthorpe@obsidianresearch.com::/IhmqHv11J7NsMPQ:0000000000000000000000000000002Qs7 X-Hashcash: 1:20:141114:galak@codeaurora.org::Flh2KeA8+CJnsfQR:000000000000000000000000000000000000000000f74 X-Hashcash: 1:20:141114:linux-arm-kernel@lists.infradead.org::crYi7CP2FF239yCE:00000000000000000000000003gIt X-Hashcash: 1:20:141114:uwe@kleine-koenig.org::+mOVKzn7184jROF8:00000000000000000000000000000000000000000RvY From: Arnaud Ebalard To: Mark Rutland , Alessandro Zummo , Peter Huewe , Linus Walleij , Thierry Reding , Mark Brown Subject: [PATCHv1 5/6] rtc: rtc-isl12057: report error code upon failure in dev_err() calls In-Reply-To: References: Message-Id: <7ff908c71200e28b65afbcca1a183233246803cf.1416006090.git.arno@natisbad.org> Date: Sat, 15 Nov 2014 00:07:17 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141114_150655_311074_08C7DD45 X-CRM114-Status: GOOD ( 13.43 ) X-Spam-Score: 0.3 (/) Cc: devicetree@vger.kernel.org, rtc-linux@googlegroups.com, Pawel Moll , Ian Campbell , Stephen Warren , linux-doc@vger.kernel.org, Rob Herring , Jason Gunthorpe , Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= , linux-arm-kernel@lists.infradead.org, Rob Landley , Kumar Gala , Grant Likely , Guenter Roeck , Jason Cooper X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP As pointed 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. Suggested-by: Mark Brown Signed-off-by: Arnaud Ebalard --- drivers/rtc/rtc-isl12057.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/rtc/rtc-isl12057.c b/drivers/rtc/rtc-isl12057.c index 31eaa6a9c2b2..a783e16cfd2f 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) mutex_lock(&data->lock); ret = regmap_read(data->regmap, ISL12057_REG_SR, &sr); if (ret) { - dev_err(dev, "%s: unable to read oscillator status flag\n", - __func__); + dev_err(dev, "%s: unable to read oscillator status flag (%d)\n", + __func__, ret); goto out; } else { if (sr & ISL12057_REG_SR_OSF) { @@ -183,7 +183,8 @@ static int isl12057_rtc_read_time(struct device *dev, struct rtc_time *tm) ret = regmap_bulk_read(data->regmap, ISL12057_REG_RTC_SC, regs, ISL12057_RTC_SEC_LEN); if (ret) - dev_err(dev, "%s: unable to read RTC time\n", __func__); + dev_err(dev, "%s: unable to read RTC time section (%d)\n", + __func__, ret); out: mutex_unlock(&data->lock); @@ -210,7 +211,8 @@ static int isl12057_rtc_set_time(struct device *dev, struct rtc_time *tm) ret = regmap_bulk_write(data->regmap, ISL12057_REG_RTC_SC, regs, ISL12057_RTC_SEC_LEN); if (ret) { - dev_err(dev, "%s: writing RTC time failed\n", __func__); + dev_err(dev, "%s: unable to write RTC time section (%d)\n", + __func__, ret); goto out; } @@ -221,7 +223,8 @@ static int isl12057_rtc_set_time(struct device *dev, struct rtc_time *tm) ret = regmap_update_bits(data->regmap, ISL12057_REG_SR, ISL12057_REG_SR_OSF, 0); if (ret < 0) - dev_err(dev, "Unable to clear oscillator failure bit\n"); + dev_err(dev, "%s: unable to clear osc. failure bit (%d)\n", + __func__, ret); out: mutex_unlock(&data->lock); @@ -242,7 +245,8 @@ static int isl12057_check_rtc_status(struct device *dev, struct regmap *regmap) ret = regmap_update_bits(regmap, ISL12057_REG_INT, ISL12057_REG_INT_EOSC, 0); if (ret < 0) { - dev_err(dev, "Unable to enable oscillator\n"); + dev_err(dev, "%s: unable to enable oscillator (%d)\n", + __func__, ret); return ret; } @@ -250,7 +254,8 @@ static int isl12057_check_rtc_status(struct device *dev, struct regmap *regmap) ret = regmap_update_bits(regmap, ISL12057_REG_SR, ISL12057_REG_SR_A1F, 0); if (ret < 0) { - dev_err(dev, "Unable to clear alarm bit\n"); + dev_err(dev, "%s: unable to clear alarm bit (%d)\n", + __func__, ret); return ret; } @@ -284,7 +289,8 @@ static int isl12057_probe(struct i2c_client *client, regmap = devm_regmap_init_i2c(client, &isl12057_rtc_regmap_config); if (IS_ERR(regmap)) { ret = PTR_ERR(regmap); - dev_err(dev, "regmap allocation failed: %d\n", ret); + dev_err(dev, "%s: regmap allocation failed (%d)\n", + __func__, ret); return ret; }