[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZsbophGauSzh15lz@black.fi.intel.com>
Date: Thu, 22 Aug 2024 10:28:38 +0300
From: Raag Jadav <raag.jadav@...el.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: jani.nikula@...ux.intel.com, joonas.lahtinen@...ux.intel.com,
rodrigo.vivi@...el.com, tursulin@...ulin.net, airlied@...il.com,
daniel@...ll.ch, linux@...ck-us.net, andi.shyti@...ux.intel.com,
intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org,
anshuman.gupta@...el.com, badal.nilawar@...el.com,
riana.tauro@...el.com, ashutosh.dixit@...el.com,
karthik.poosa@...el.com
Subject: Re: [PATCH v6] drm/i915/hwmon: expose fan speed
On Tue, Aug 20, 2024 at 05:06:39PM +0300, Andy Shevchenko wrote:
> On Tue, Aug 20, 2024 at 04:12:46PM +0300, Raag Jadav wrote:
> > On Tue, Aug 20, 2024 at 01:23:35PM +0300, Andy Shevchenko wrote:
> > > On Tue, Aug 20, 2024 at 11:50:10AM +0530, Raag Jadav wrote:
> > >
> > > But it still has an issue with 64-bit division on 32-bit platforms, right?
> > >
> > > > + /*
> > > > + * Calculate fan speed in RPM by time averaging two subsequent
> > > > + * readings in minutes.
> > > > + * RPM = number of rotations * msecs per minute / time in msecs
> > > > + */
> > > > + *val = DIV_ROUND_UP(rotations * (MSEC_PER_SEC * 60), time);
> > >
> > > ...somewhere here?
> >
> > Use div64_u64() instead? Or is there a better alternative?
>
> I don't know the code well to offer anything better. Probably for a starter
> you can switch to use DIV_ROUND_UP_ULL().
This one seems to work. Does it warrant an explanation here?
Raag
Powered by blists - more mailing lists