[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202512171917155dba6723@mail.local>
Date: Wed, 17 Dec 2025 20:17:15 +0100
From: Alexandre Belloni <alexandre.belloni@...tlin.com>
To: "T, Harini" <Harini.T@....com>
Cc: Tomas Melin <tomas.melin@...sala.com>,
"Simek, Michal" <michal.simek@....com>,
"linux-rtc@...r.kernel.org" <linux-rtc@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/4] rtc: zynqmp: rework read_offset
On 17/12/2025 18:14:30+0000, T, Harini wrote:
> [Public]
>
> Hi,
>
> > -----Original Message-----
> > From: Tomas Melin <tomas.melin@...sala.com>
> > Sent: Wednesday, December 10, 2025 5:35 PM
> > To: T, Harini <Harini.T@....com>; Alexandre Belloni
> > <alexandre.belloni@...tlin.com>; Simek, Michal <michal.simek@....com>
> > Cc: linux-rtc@...r.kernel.org; linux-arm-kernel@...ts.infradead.org; linux-
> > kernel@...r.kernel.org
> > Subject: Re: [PATCH 2/4] rtc: zynqmp: rework read_offset
> >
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > Hi,
> >
> > On 09/12/2025 19:28, T, Harini wrote:
> > > [Public]
> > >
> > > Hi,
> > >
> > >> -----Original Message-----
> > >> From: Tomas Melin <tomas.melin@...sala.com>
> > >> Sent: Monday, December 1, 2025 6:20 PM
> > >> To: Alexandre Belloni <alexandre.belloni@...tlin.com>; Simek, Michal
> > >> <michal.simek@....com>
> > >> Cc: linux-rtc@...r.kernel.org; linux-arm-kernel@...ts.infradead.org;
> > >> linux- kernel@...r.kernel.org; Tomas Melin <tomas.melin@...sala.com>
> > >> Subject: [PATCH 2/4] rtc: zynqmp: rework read_offset
> > >>
> > >> Caution: This message originated from an External Source. Use proper
> > >> caution when opening attachments, clicking links, or responding.
> > >>
> > >>
> > >> read_offset() was using static frequency for determining the tick
> > >> offset. It was also using remainder from do_div() operation as
> > >> tick_mult value which caused the offset to be incorrect.
> > >>
> > >> At the same time, rework function to improve readability.
> > >>
> > >> Signed-off-by: Tomas Melin <tomas.melin@...sala.com>
> > >> ---
> > >> drivers/rtc/rtc-zynqmp.c | 25 ++++++++++++++++---------
> > >> 1 file changed, 16 insertions(+), 9 deletions(-)
> > >>
> > >> diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c
> > >> index
> > >>
> > 856bc1678e7d31144f320ae9f75fc58c742a2a64..7af5f6f99538f961a53ff56
> > bfc6
> > >> 56c907611b900 100644
> > >> --- a/drivers/rtc/rtc-zynqmp.c
> > >> +++ b/drivers/rtc/rtc-zynqmp.c
> > >> @@ -178,21 +178,28 @@ static void xlnx_init_rtc(struct xlnx_rtc_dev
> > >> *xrtcdev) static int xlnx_rtc_read_offset(struct device *dev, long *offset) {
> > >> struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);
> > >> - unsigned long long rtc_ppb = RTC_PPB;
> > >> - unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->freq);
> > >> - unsigned int calibval;
> > >> + unsigned int calibval, fract_data, fract_part;
> > > Prefer one variable assignment per line for readability.
> > This is after all quite common practice, and in a function like this where several
> > variables are needed, I would argue that this is more readable than the
> > alternative. Is there some convention I'm not aware of?
> There is no such mandatory convention. It's up to the RTC maintainer.
I don't mind having multiple variable declarations on a single line.
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists