From: Christian Marangi <ansuelsmth@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "Uwe Kleine-König" <ukleinek@kernel.org>,
"Lukas Wunner" <lukas@wunner.de>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"Herbert Xu" <herbert@gondor.apana.org.au>,
"Andy Shevchenko" <andy@kernel.org>,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org
Subject: Re: [PATCH v15 1/2] math.h: provide rounddown_ull variant for rounddown MACRO
Date: Tue, 24 Jun 2025 09:45:08 +0200 [thread overview]
Message-ID: <685a5787.050a0220.20ff0f.fd7a@mx.google.com> (raw)
In-Reply-To: <CAHp75VcWW=RaHS9Yb8BcK2Jt7qtNOQzA3eDOZQ88RQG63981cQ@mail.gmail.com>
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@gmail.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
next prev parent reply other threads:[~2025-06-24 7:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-23 21:11 Christian Marangi
2025-06-23 21:11 ` [PATCH v15 2/2] pwm: airoha: Add support for EN7581 SoC Christian Marangi
2025-06-24 6:37 ` Andy Shevchenko
2025-06-24 8:41 ` Christian Marangi
2025-06-24 13:05 ` Andy Shevchenko
2025-06-24 6:08 ` [PATCH v15 1/2] math.h: provide rounddown_ull variant for rounddown MACRO Andy Shevchenko
2025-06-24 7:45 ` Christian Marangi [this message]
2025-06-24 8:40 ` Andy Shevchenko
2025-06-24 8:44 ` Andy Shevchenko
2025-06-24 8:48 ` Christian Marangi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=685a5787.050a0220.20ff0f.fd7a@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=andy.shevchenko@gmail.com \
--cc=andy@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=ukleinek@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®