mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Stephen Boyd <sboyd@kernel.org>
Cc: David Laight <David.Laight@aculab.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Sebastian Reichel <sebastian.reichel@collabora.com>,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@collabora.com
Subject: Re: [PATCH v3 1/1] clk: divider: Fix divisor masking on 64 bit platforms
Date: Tue, 24 Oct 2023 13:55:44 +0300	[thread overview]
Message-ID: <ZTeisLk5zvF2Fh/B@smile.fi.intel.com> (raw)
In-Reply-To: <a9756c11ea3f111d45e85e0f3928bdd8.sboyd@kernel.org>

On Mon, Oct 23, 2023 at 08:34:12PM -0700, Stephen Boyd wrote:
> Quoting Sebastian Reichel (2023-06-30 11:38:35)

> > --- a/include/linux/math.h
> > +++ b/include/linux/math.h
> > @@ -36,6 +36,17 @@
> >  
> >  #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP
> >  
> > +/**
> > + * DIV_ROUND_UP_NO_OVERFLOW - divide two numbers and always round up
> > + * @n: numerator / dividend
> > + * @d: denominator / divisor
> > + *
> > + * This functions does the same as DIV_ROUND_UP, but internally uses a
> > + * division and a modulo operation instead of math tricks. This way it
> > + * avoids overflowing when handling big numbers.
> > + */
> > +#define DIV_ROUND_UP_NO_OVERFLOW(n, d) (((n) / (d)) + !!((n) % (d)))
> 
> Can you get someone to review/ack this macro? Maybe Andy?
> 
> > +
> >  #define DIV_ROUND_DOWN_ULL(ll, d) \
> >         ({ unsigned long long _tmp = (ll); do_div(_tmp, d); _tmp; })

First of all, it should be a separate patch and second, same issue is being
discussed here (as it needs to be fixed in UAPI header directly):

https://lore.kernel.org/all/your-ad-here.call-01697881440-ext-2458@work.hours/

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2023-10-24 10:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30 18:38 Sebastian Reichel
2023-10-24  3:34 ` Stephen Boyd
2023-10-24 10:55   ` Andy Shevchenko [this message]

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=ZTeisLk5zvF2Fh/B@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=David.Laight@aculab.com \
    --cc=kernel@collabora.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=sebastian.reichel@collabora.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

Powered by JetHome