[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <PH7PR11MB59589EE1C7787496316C04339BDA9@PH7PR11MB5958.namprd11.prod.outlook.com>
Date: Mon, 6 Feb 2023 17:03:57 +0000
From: <Tharunkumar.Pasumarthi@...rochip.com>
To: <gregkh@...uxfoundation.org>
CC: <Kumaravel.Thiagarajan@...rochip.com>, <arnd@...db.de>,
<linux-kernel@...r.kernel.org>, <linux-gpio@...r.kernel.org>,
<UNGLinuxDriver@...rochip.com>, <lkp@...el.com>
Subject: RE: [PATCH v3 char-misc-next] misc: microchip: pci1xxxx: Add
OTP/EEPROM driver for the pci1xxxx switch
> From: Greg KH <gregkh@...uxfoundation.org>
> Sent: Monday, February 6, 2023 3:12 PM
> To: Tharunkumar Pasumarthi - I67821
> <Tharunkumar.Pasumarthi@...rochip.com>
> > > > + delay = msecs_to_jiffies(OTP_RW_TIMEOUT_MILLISECONDS);
> > > > + j0 = jiffies;
> > > > + j1 = j0 + delay;
> > >
> > > Are you sure this math works out? Please use the jiffies math
> > > functions instead so you can handle wrapping properly.
> >
> > You suggest using any existing APIs to add jiffies to handle wrapping?
> > I am not able to find any such API. Can you please point out API name.
>
> I have no context here for what you are doing with the math in jiffies, but
> that is usually a very odd thing. If you use the normal timer functions, you
> will not have to worry about the wrapping as it is handled for you, right?
Hi Greg,
Our objective with that part of code is to wait for OTP_STATUS_BUSY_BIT
to be cleared in the hardware, but make sure that we wait for a maximum
of OTP_RW_TIMEOUT_MILLISECONDS ms in the driver and not beyond that.
This logic is not possible with normal timer functions. Timer wrapping logic is
handled by time_before API internally. So, there does not seem to be issue with
existing code.
Thanks,
Tharun Kumar P
Powered by blists - more mailing lists