[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <685a5787.050a0220.20ff0f.fd7a@mx.google.com>
Date: Tue, 24 Jun 2025 09:45:08 +0200
From: Christian Marangi <ansuelsmth@...il.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Uwe Kleine-König <ukleinek@...nel.org>,
Lukas Wunner <lukas@...ner.de>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Andy Shevchenko <andy@...nel.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
linux-kernel@...r.kernel.org, linux-pwm@...r.kernel.org
Subject: Re: [PATCH v15 1/2] math.h: provide rounddown_ull variant for
rounddown MACRO
On Tue, Jun 24, 2025 at 09:08:32AM +0300, Andy Shevchenko wrote:
> On Tue, Jun 24, 2025 at 12:11 AM Christian Marangi <ansuelsmth@...il.com> wrote:
> >
> > There is currently a problem with the usage of rounddown MACRO with
>
> rounddown() with
>
> > u64 dividends. This cause compilation error on specific arch where
>
> causes
>
> > 64bit division is done on 32bit system.
>
> on the 32-bit
>
>
> > To be more specific GCC try optimize the function and replace it with
>
> to optimize
>
> > __umoddi3 but this is actually not compiled in the kernel.
>
> __umoddi3()
>
> > Example:
> > pwm-airoha.c:(.text+0x8f8): undefined reference to `__umoddi3'
> >
> > To better handle this, introduce a variant of rounddown MACRO,
>
> rounddown(),
For this and the other... Is it correct to use () for MACRO?
I assume () should be used only for functions.
>
> > rounddown_ull that can be used exactly for this scenario.
>
> rounddown_ull()
>
> > rounddown_ull new MACRO use the do_div MACRO that do the heavy work of
>
> The rounddown_ull() is a new macro that uses do_div() to do the heavy work of
>
> > handling internally all the magic for 64bit division on 32bit (and
>
> for the 64-bit divisions on the 32-bit platforms (and
>
> > indirectly fix the compilation error).
>
> ...
>
> > - Add this patch
>
> Why are math64 APIs not usable here?
>
There isn't a rounddown API for math64.
--
Ansuel
Powered by blists - more mailing lists