devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan+linaro@kernel.org>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Bjorn Andersson <andersson@kernel.org>
Cc: Andy Gross <agross@kernel.org>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Maximilian Luz <luzmaximilian@gmail.com>,
	linux-arm-msm@vger.kernel.org, linux-rtc@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Johan Hovold <johan+linaro@kernel.org>
Subject: [PATCH v2 02/22] rtc: pm8xxx: drop spmi error messages
Date: Thu,  2 Feb 2023 16:54:28 +0100	[thread overview]
Message-ID: <20230202155448.6715-3-johan+linaro@kernel.org> (raw)
In-Reply-To: <20230202155448.6715-1-johan+linaro@kernel.org>

Drop the unnecessary error messages after every spmi regmap access,
which are not expected to fail.

Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/rtc/rtc-pm8xxx.c | 71 ++++++++++------------------------------
 1 file changed, 17 insertions(+), 54 deletions(-)

diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index d114f0da537d..f49bda999e02 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -105,10 +105,8 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm)
 		alarm_enabled = 1;
 		ctrl_reg &= ~regs->alarm_en;
 		rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl, ctrl_reg);
-		if (rc) {
-			dev_err(dev, "Write to RTC Alarm control register failed\n");
+		if (rc)
 			goto rtc_rw_fail;
-		}
 	}
 
 	/* Disable RTC H/w before writing on RTC register */
@@ -120,51 +118,39 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm)
 		rtc_disabled = 1;
 		rtc_ctrl_reg &= ~PM8xxx_RTC_ENABLE;
 		rc = regmap_write(rtc_dd->regmap, regs->ctrl, rtc_ctrl_reg);
-		if (rc) {
-			dev_err(dev, "Write to RTC control register failed\n");
+		if (rc)
 			goto rtc_rw_fail;
-		}
 	}
 
 	/* Write 0 to Byte[0] */
 	rc = regmap_write(rtc_dd->regmap, regs->write, 0);
-	if (rc) {
-		dev_err(dev, "Write to RTC write data register failed\n");
+	if (rc)
 		goto rtc_rw_fail;
-	}
 
 	/* Write Byte[1], Byte[2], Byte[3] */
 	rc = regmap_bulk_write(rtc_dd->regmap, regs->write + 1,
 			       &value[1], sizeof(value) - 1);
-	if (rc) {
-		dev_err(dev, "Write to RTC write data register failed\n");
+	if (rc)
 		goto rtc_rw_fail;
-	}
 
 	/* Write Byte[0] */
 	rc = regmap_write(rtc_dd->regmap, regs->write, value[0]);
-	if (rc) {
-		dev_err(dev, "Write to RTC write data register failed\n");
+	if (rc)
 		goto rtc_rw_fail;
-	}
 
 	/* Enable RTC H/w after writing on RTC register */
 	if (rtc_disabled) {
 		rtc_ctrl_reg |= PM8xxx_RTC_ENABLE;
 		rc = regmap_write(rtc_dd->regmap, regs->ctrl, rtc_ctrl_reg);
-		if (rc) {
-			dev_err(dev, "Write to RTC control register failed\n");
+		if (rc)
 			goto rtc_rw_fail;
-		}
 	}
 
 	if (alarm_enabled) {
 		ctrl_reg |= regs->alarm_en;
 		rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl, ctrl_reg);
-		if (rc) {
-			dev_err(dev, "Write to RTC Alarm control register failed\n");
+		if (rc)
 			goto rtc_rw_fail;
-		}
 	}
 
 rtc_rw_fail:
@@ -183,28 +169,22 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm)
 	const struct pm8xxx_rtc_regs *regs = rtc_dd->regs;
 
 	rc = regmap_bulk_read(rtc_dd->regmap, regs->read, value, sizeof(value));
-	if (rc) {
-		dev_err(dev, "RTC read data register failed\n");
+	if (rc)
 		return rc;
-	}
 
 	/*
 	 * Read the LSB again and check if there has been a carry over.
 	 * If there is, redo the read operation.
 	 */
 	rc = regmap_read(rtc_dd->regmap, regs->read, &reg);
-	if (rc < 0) {
-		dev_err(dev, "RTC read data register failed\n");
+	if (rc < 0)
 		return rc;
-	}
 
 	if (unlikely(reg < value[0])) {
 		rc = regmap_bulk_read(rtc_dd->regmap, regs->read,
 				      value, sizeof(value));
-		if (rc) {
-			dev_err(dev, "RTC read data register failed\n");
+		if (rc)
 			return rc;
-		}
 	}
 
 	secs = value[0] | (value[1] << 8) | (value[2] << 16) |
@@ -241,10 +221,8 @@ static int pm8xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
 
 	rc = regmap_bulk_write(rtc_dd->regmap, regs->alarm_rw, value,
 			       sizeof(value));
-	if (rc) {
-		dev_err(dev, "Write to RTC ALARM register failed\n");
+	if (rc)
 		goto rtc_rw_fail;
-	}
 
 	if (alarm->enabled) {
 		rc = regmap_update_bits(rtc_dd->regmap, regs->alarm_ctrl,
@@ -271,10 +249,8 @@ static int pm8xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
 
 	rc = regmap_bulk_read(rtc_dd->regmap, regs->alarm_rw, value,
 			      sizeof(value));
-	if (rc) {
-		dev_err(dev, "RTC alarm time read failed\n");
+	if (rc)
 		return rc;
-	}
 
 	secs = value[0] | (value[1] << 8) | (value[2] << 16) |
 	       ((unsigned long)value[3] << 24);
@@ -282,10 +258,9 @@ static int pm8xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
 	rtc_time64_to_tm(secs, &alarm->time);
 
 	rc = regmap_read(rtc_dd->regmap, regs->alarm_ctrl, &ctrl_reg);
-	if (rc) {
-		dev_err(dev, "Read from RTC alarm control register failed\n");
+	if (rc)
 		return rc;
-	}
+
 	alarm->enabled = !!(ctrl_reg & PM8xxx_RTC_ALARM_ENABLE);
 
 	dev_dbg(dev, "Alarm set for - h:m:s=%ptRt, y-m-d=%ptRdr\n",
@@ -315,19 +290,15 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable)
 		ctrl_reg &= ~regs->alarm_en;
 
 	rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl, ctrl_reg);
-	if (rc) {
-		dev_err(dev, "Write to RTC control register failed\n");
+	if (rc)
 		goto rtc_rw_fail;
-	}
 
 	/* Clear Alarm register */
 	if (!enable) {
 		rc = regmap_bulk_write(rtc_dd->regmap, regs->alarm_rw, value,
 				       sizeof(value));
-		if (rc) {
-			dev_err(dev, "Clear RTC ALARM register failed\n");
+		if (rc)
 			goto rtc_rw_fail;
-		}
 	}
 
 rtc_rw_fail:
@@ -366,8 +337,6 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id)
 	rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl, ctrl_reg);
 	if (rc) {
 		spin_unlock(&rtc_dd->ctrl_reg_lock);
-		dev_err(rtc_dd->rtc_dev,
-			"Write to alarm control register failed\n");
 		goto rtc_alarm_handled;
 	}
 
@@ -375,17 +344,11 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id)
 
 	/* Clear RTC alarm register */
 	rc = regmap_read(rtc_dd->regmap, regs->alarm_ctrl2, &ctrl_reg);
-	if (rc) {
-		dev_err(rtc_dd->rtc_dev,
-			"RTC Alarm control2 register read failed\n");
+	if (rc)
 		goto rtc_alarm_handled;
-	}
 
 	ctrl_reg |= PM8xxx_RTC_ALARM_CLEAR;
 	rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl2, ctrl_reg);
-	if (rc)
-		dev_err(rtc_dd->rtc_dev,
-			"Write to RTC Alarm control2 register failed\n");
 
 rtc_alarm_handled:
 	return IRQ_HANDLED;
-- 
2.39.1


  parent reply	other threads:[~2023-02-02 15:55 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 15:54 [PATCH v2 00/22] rtc: pm8xxx: add support for setting time using nvmem Johan Hovold
2023-02-02 15:54 ` [PATCH v2 01/22] rtc: pm8xxx: fix set-alarm race Johan Hovold
2023-02-07  3:12   ` David Collins
2023-02-07 15:13     ` Johan Hovold
2023-02-07 15:56       ` Johan Hovold
2023-02-02 15:54 ` Johan Hovold [this message]
2023-02-02 15:54 ` [PATCH v2 03/22] rtc: pm8xxx: use regmap_update_bits() Johan Hovold
2023-02-07  3:14   ` David Collins
2023-02-02 15:54 ` [PATCH v2 04/22] rtc: pm8xxx: drop bogus locking Johan Hovold
2023-02-07  3:14   ` David Collins
2023-02-02 15:54 ` [PATCH v2 05/22] rtc: pm8xxx: return IRQ_NONE on errors Johan Hovold
2023-02-02 15:54 ` [PATCH v2 06/22] rtc: pm8xxx: drop unused register defines Johan Hovold
2023-02-07  3:15   ` David Collins
2023-02-07 15:16     ` Johan Hovold
2023-02-02 15:54 ` [PATCH v2 07/22] rtc: pm8xxx: use unaligned le32 helpers Johan Hovold
2023-02-07  3:15   ` David Collins
2023-02-02 15:54 ` [PATCH v2 08/22] rtc: pm8xxx: clean up time and alarm debugging Johan Hovold
2023-02-07  3:15   ` David Collins
2023-02-02 15:54 ` [PATCH v2 09/22] rtc: pm8xxx: rename struct device pointer Johan Hovold
2023-02-07  3:15   ` David Collins
2023-02-02 15:54 ` [PATCH v2 10/22] rtc: pm8xxx: rename alarm irq variable Johan Hovold
2023-02-07  3:15   ` David Collins
2023-02-02 15:54 ` [PATCH v2 11/22] rtc: pm8xxx: clean up comments Johan Hovold
2023-02-07  3:15   ` David Collins
2023-02-02 15:54 ` [PATCH v2 12/22] rtc: pm8xxx: use u32 for timestamps Johan Hovold
2023-02-02 15:54 ` [PATCH v2 13/22] rtc: pm8xxx: refactor read_time() Johan Hovold
2023-02-07  3:16   ` David Collins
2023-02-07 15:20     ` Johan Hovold
2023-02-02 15:54 ` [PATCH v2 14/22] rtc: pm8xxx: clean up local declarations Johan Hovold
2023-02-07  3:16   ` David Collins
2023-02-02 15:54 ` [PATCH v2 15/22] rtc: pm8xxx: drop error messages Johan Hovold
2023-02-02 15:54 ` [PATCH v2 16/22] dt-bindings: rtc: qcom-pm8xxx: add nvmem-cell offset Johan Hovold
2023-02-07  3:16   ` David Collins
2023-02-07 15:24     ` Johan Hovold
2023-02-10 22:48   ` Alexandre Belloni
2023-02-11  8:22     ` Johan Hovold
2023-02-11 16:44       ` Alexandre Belloni
2023-02-15 16:51         ` Johan Hovold
2023-02-24  8:21           ` Johan Hovold
2023-02-24  9:18             ` Alexandre Belloni
2023-02-24  9:24               ` Johan Hovold
2023-02-02 15:54 ` [PATCH v2 17/22] rtc: pm8xxx: add support for nvmem offset Johan Hovold
2023-02-03  3:31   ` Konrad Dybcio
2023-02-03  7:22     ` Johan Hovold
2023-02-07  3:16   ` David Collins
2023-02-07 15:36     ` Johan Hovold
2023-02-02 15:54 ` [PATCH v2 18/22] arm64: defconfig: enable Qualcomm SDAM nvmem driver Johan Hovold
2023-02-03  9:31   ` Krzysztof Kozlowski
2023-02-02 15:54 ` [PATCH v2 19/22] arm64: dts: qcom: sc8280xp-pmics: add pmk8280 rtc Johan Hovold
2023-02-02 15:54 ` [PATCH v2 20/22] arm64: dts: qcom: sc8280xp-pmics: add pmk8280 sdam nvram Johan Hovold
2023-02-02 15:54 ` [PATCH v2 21/22] arm64: dts: qcom: sc8280xp-crd: enable rtc Johan Hovold
2023-02-02 15:54 ` [PATCH v2 22/22] arm64: dts: qcom: sc8280xp-x13s: " Johan Hovold
2023-02-09  4:22 ` (subset) [PATCH v2 00/22] rtc: pm8xxx: add support for setting time using nvmem Bjorn Andersson
2023-02-09 22:25 ` Alexandre Belloni
2023-02-10  7:53   ` Johan Hovold
2023-02-10  9:04     ` Alexandre Belloni
2023-02-10  9:14       ` Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230202155448.6715-3-johan+linaro@kernel.org \
    --to=johan+linaro@kernel.org \
    --cc=a.zummo@towertech.it \
    --cc=agross@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andersson@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=luzmaximilian@gmail.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).