* [PATCH] rtc: pcf2127: add error checking and message when disabling POR0
@ 2022-01-17 22:56 Hugo Villeneuve
2022-02-15 22:27 ` Alexandre Belloni
0 siblings, 1 reply; 3+ messages in thread
From: Hugo Villeneuve @ 2022-01-17 22:56 UTC (permalink / raw)
To: Alessandro Zummo, Alexandre Belloni
Cc: hugo, Hugo Villeneuve, linux-rtc, linux-kernel
From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
If PCF2127 device is absent from the I2C bus, or if there is a
communication problem, disabling POR0 may fail silently and we
still continue with probing the device. In that case, abort probe
operation and display an error message.
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
---
drivers/rtc/rtc-pcf2127.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
index 81a5b1f2e68c..e6d0838ccfe3 100644
--- a/drivers/rtc/rtc-pcf2127.c
+++ b/drivers/rtc/rtc-pcf2127.c
@@ -690,8 +690,12 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
* The "Power-On Reset Override" facility prevents the RTC to do a reset
* after power on. For normal operation the PORO must be disabled.
*/
- regmap_clear_bits(pcf2127->regmap, PCF2127_REG_CTRL1,
+ ret = regmap_clear_bits(pcf2127->regmap, PCF2127_REG_CTRL1,
PCF2127_BIT_CTRL1_POR_OVRD);
+ if (ret < 0) {
+ dev_err(dev, "PORO disabling failed\n");
+ return ret;
+ }
ret = regmap_read(pcf2127->regmap, PCF2127_REG_CLKOUT, &val);
if (ret < 0)
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rtc: pcf2127: add error checking and message when disabling POR0
2022-01-17 22:56 [PATCH] rtc: pcf2127: add error checking and message when disabling POR0 Hugo Villeneuve
@ 2022-02-15 22:27 ` Alexandre Belloni
2023-05-15 18:18 ` Hugo Villeneuve
0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2022-02-15 22:27 UTC (permalink / raw)
To: Hugo Villeneuve
Cc: Alessandro Zummo, Hugo Villeneuve, linux-rtc, linux-kernel
Hello,
On 17/01/2022 17:56:24-0500, Hugo Villeneuve wrote:
> From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
>
> If PCF2127 device is absent from the I2C bus, or if there is a
> communication problem, disabling POR0 may fail silently and we
> still continue with probing the device. In that case, abort probe
> operation and display an error message.
>
> Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> ---
> drivers/rtc/rtc-pcf2127.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
> index 81a5b1f2e68c..e6d0838ccfe3 100644
> --- a/drivers/rtc/rtc-pcf2127.c
> +++ b/drivers/rtc/rtc-pcf2127.c
> @@ -690,8 +690,12 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
> * The "Power-On Reset Override" facility prevents the RTC to do a reset
> * after power on. For normal operation the PORO must be disabled.
> */
> - regmap_clear_bits(pcf2127->regmap, PCF2127_REG_CTRL1,
> + ret = regmap_clear_bits(pcf2127->regmap, PCF2127_REG_CTRL1,
> PCF2127_BIT_CTRL1_POR_OVRD);
> + if (ret < 0) {
> + dev_err(dev, "PORO disabling failed\n");
As discussed on the other patches, please do not add a message here.
> + return ret;
> + }
>
> ret = regmap_read(pcf2127->regmap, PCF2127_REG_CLKOUT, &val);
> if (ret < 0)
> --
> 2.30.2
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rtc: pcf2127: add error checking and message when disabling POR0
2022-02-15 22:27 ` Alexandre Belloni
@ 2023-05-15 18:18 ` Hugo Villeneuve
0 siblings, 0 replies; 3+ messages in thread
From: Hugo Villeneuve @ 2023-05-15 18:18 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Alessandro Zummo, Hugo Villeneuve, linux-rtc, linux-kernel, hugo
On Tue, 15 Feb 2022 23:27:46 +0100
Alexandre Belloni <alexandre.belloni@bootlin.com> wrote:
> Hello,
>
> On 17/01/2022 17:56:24-0500, Hugo Villeneuve wrote:
> > From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> >
> > If PCF2127 device is absent from the I2C bus, or if there is a
> > communication problem, disabling POR0 may fail silently and we
> > still continue with probing the device. In that case, abort probe
> > operation and display an error message.
> >
> > Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > ---
> > drivers/rtc/rtc-pcf2127.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/rtc/rtc-pcf2127.c b/drivers/rtc/rtc-pcf2127.c
> > index 81a5b1f2e68c..e6d0838ccfe3 100644
> > --- a/drivers/rtc/rtc-pcf2127.c
> > +++ b/drivers/rtc/rtc-pcf2127.c
> > @@ -690,8 +690,12 @@ static int pcf2127_probe(struct device *dev, struct regmap *regmap,
> > * The "Power-On Reset Override" facility prevents the RTC to do a reset
> > * after power on. For normal operation the PORO must be disabled.
> > */
> > - regmap_clear_bits(pcf2127->regmap, PCF2127_REG_CTRL1,
> > + ret = regmap_clear_bits(pcf2127->regmap, PCF2127_REG_CTRL1,
> > PCF2127_BIT_CTRL1_POR_OVRD);
> > + if (ret < 0) {
> > + dev_err(dev, "PORO disabling failed\n");
>
> As discussed on the other patches, please do not add a message here.
I forgot to resend that patch without the message. I will do it soon.
Hugo.
> > + return ret;
> > + }
> >
> > ret = regmap_read(pcf2127->regmap, PCF2127_REG_CLKOUT, &val);
> > if (ret < 0)
> > --
> > 2.30.2
> >
>
> --
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
--
Hugo Villeneuve <hugo@hugovil.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-15 18:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-17 22:56 [PATCH] rtc: pcf2127: add error checking and message when disabling POR0 Hugo Villeneuve
2022-02-15 22:27 ` Alexandre Belloni
2023-05-15 18:18 ` Hugo Villeneuve
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).