[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6868e83a.050a0220.2d26f8.0920@mx.google.com>
Date: Sat, 5 Jul 2025 10:54:14 +0200
From: Christian Marangi <ansuelsmth@...il.com>
To: Uwe Kleine-König <ukleinek@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-pwm@...r.kernel.org,
Benjamin Larsson <benjamin.larsson@...exis.eu>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH v21] pwm: airoha: Add support for EN7581 SoC
On Sat, Jul 05, 2025 at 10:47:37AM +0200, Uwe Kleine-König wrote:
> Hello Christian,
>
> On Sat, Jul 05, 2025 at 09:28:20AM +0200, Christian Marangi wrote:
> > Changes v21:
> > - Revert offset to u64 in airoha_pwm_apply_bucket_config
> > (do_div require u64)
>
> I didn't look in detail, but I wonder if you considered using a
> different division function to keep offset not bigger than needed?
>
Hi Uwe,
I used do_div since it can calculate both division and remainder in one
go.
The kernel warning were present only on 32 bit and are caused because
do_div implementation is different on 32 or 64 bit.
On 64 bit it's simply
rem = n % base
div = n / base
but on 32 bit it's much more complex and adds the check n to be an u64.
Also on 64bit n is expected to be u64 but given the simplicity the type
is not checked.
I checked if there is some kind of do_div32 but it doesn't exist and
also using cast doesn't work give the complexity of the macro define (I
tried with (u64)offset.
What do you think should be the best solution here?
--
Ansuel
Powered by blists - more mailing lists