Re: [PATCH 2/2] rtc: Introduce ti-k3-rtc

From: Alexandre Belloni
Date: Fri Apr 15 2022 - 04:14:45 EST


On 15/04/2022 13:33:14+0530, Vignesh Raghavendra wrote:
> Hi,
>
> On 12/04/22 1:01 pm, Nishanth Menon wrote:
> > +/**
> > + * k3rtc_fence - Ensure a register sync took place between the two domains
> > + * @priv: pointer to priv data
> > + *
> > + * Return: 0 if the sync took place, else returns -ETIMEDOUT
> > + */
> > +static int k3rtc_fence(struct ti_k3_rtc *priv)
> > +{
> > + u32 timeout = priv->sync_timeout_us;
> > + u32 mask = K3RTC_RD_PEND_BIT | K3RTC_WR_PEND_BIT;
> > + u32 val = 0;
> > +
> > + while (timeout--) {
> > + val = k3rtc_readl(priv, REG_K3RTC_SYNCPEND);
> > + if (!(val & mask))
> > + return 0;
> > + usleep_range(1, 2);
> > + }
>
> readl_poll_timeout() ?
>
> > +
> > + pr_err("RTC Fence timeout: 0x%08x\n", val);
>
> Can we use dev_err()? Provides better indication of the driver throwing
> error.
>

What would the user do with this information in the kernel logs? Please
do not add error strings that will never be used. Returning -ETIMEDOUT
is probably enough.

> > + return -ETIMEDOUT;
> > +}
> > +

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com