[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aHdwzFk-688ASRx2@smile.fi.intel.com>
Date: Wed, 16 Jul 2025 12:28:44 +0300
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Sean Anderson <sean.anderson@...ux.dev>
Cc: Jonathan Cameron <jic23@...nel.org>, Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>, linux-iio@...r.kernel.org,
linux-hwmon@...r.kernel.org, Andy Shevchenko <andy@...nel.org>,
Nuno Sá <nuno.sa@...log.com>,
linux-kernel@...r.kernel.org, David Lechner <dlechner@...libre.com>
Subject: Re: [PATCH 2/7] iio: inkern: Add API for reading/writing events
On Tue, Jul 15, 2025 at 11:42:05AM -0400, Sean Anderson wrote:
> On 7/15/25 04:18, Andy Shevchenko wrote:
> > On Mon, Jul 14, 2025 at 09:20:18PM -0400, Sean Anderson wrote:
...
> >> +EXPORT_SYMBOL_GPL(iio_event_mode);
> >
> > Can we move this to namespace? Otherwise it will be never ending story...
> > Ditto for other new APIs.
>
> Never ending story of what?
Of converting IIO core to use exported namespaces.
...
> >> + if (scale64 <= INT_MAX && scale64 >= INT_MIN)
> >> + raw64 = processed / (int)scale64;
> >
> > Do you need the casting? (I mean if the compiler is dumb enough to not see this)
>
> AIUI 64-bit division is not available on 32-bit platforms. The cast
> ensures we get 32-bit division.
I put specifically a remark in the parentheses. So, the Q is if the compiler
doesn't recognize that. Can you confirm that 32-bit compilation without cast
is broken?
...
> >> + *raw = clamp(raw64, (s64)INT_MIN, (s64)INT_MAX);
> >
> > You already have similar approach here...
>
> Well, I can spell it 0x7fffffffLL if you'd like...
Nope, I like to have named constants instead of magics, but actually are those
castings needed for the clamp()?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists