From: David Laight <David.Laight@ACULAB.COM>
To: "'Uwe Kleine-König'" <u.kleine-koenig@pengutronix.de>,
"Qing Wang" <wangqing@vivo.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
Lee Jones <lee.jones@linaro.org>,
"linux-pwm@vger.kernel.org" <linux-pwm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] pwm: use div64_u64() instead of do_div()
Date: Thu, 10 Feb 2022 09:48:44 +0000 [thread overview]
Message-ID: <9273cd6497354dd882faf55b194ff590@AcuMS.aculab.com> (raw)
In-Reply-To: <20220209152609.gqeivcehkuzgz3sk@pengutronix.de>
From: Uwe Kleine-König
> Sent: 09 February 2022 15:26
...
> > - do_div(cycles, period_ns);
> > + div64_u64(cycles, period_ns);
>
> This is wrong, div64_u64() has a different calling convention than do_div().
>
> The issue however is real. Please add
Not really although I can't see a check I'd assume that period_ns
is expected to be much less than a second - so well under 32 bits
There is certainly a general expectation that multiplying by
other 'largish' values won't exceed 64 bits.
Plausible the pwm 'period' should actually be a u32.
But then care would be needed to ensure the multiplies have
64bit results.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2022-02-10 9:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 8:39 Qing Wang
2022-02-09 15:26 ` Uwe Kleine-König
2022-02-10 9:48 ` David Laight [this message]
2022-02-10 10:09 ` Uwe Kleine-König
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=9273cd6497354dd882faf55b194ff590@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=wangqing@vivo.com \
/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®