[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1532624495.2283.197.camel@impinj.com>
Date: Thu, 26 Jul 2018 17:01:36 +0000
From: Trent Piepho <tpiepho@...inj.com>
To: "andy.shevchenko@...il.com" <andy.shevchenko@...il.com>,
"hayashibara.keiji@...ionext.com" <hayashibara.keiji@...ionext.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"masami.hiramatsu@...aro.org" <masami.hiramatsu@...aro.org>,
"hayashi.kunihiko@...ionext.com" <hayashi.kunihiko@...ionext.com>,
"broonie@...nel.org" <broonie@...nel.org>,
"mark.rutland@....com" <mark.rutland@....com>,
"linux-spi@...r.kernel.org" <linux-spi@...r.kernel.org>,
"yamada.masahiro@...ionext.com" <yamada.masahiro@...ionext.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"jaswinder.singh@...aro.org" <jaswinder.singh@...aro.org>
Subject: Re: [PATCH v2 2/2] spi: add SPI controller driver for UniPhier SoC
On Thu, 2018-07-26 at 11:46 +0300, Andy Shevchenko wrote:
> > +
> > + /*
> > + * the supported rates are even numbers from 4 to 254. (4,6,8...254)
> > + * round up as we look for equal or less speed
> > + */
> > + ckrat = DIV_ROUND_UP(clk_get_rate(priv->clk), speed);
> > + ckrat = roundup(ckrat, 2);
>
> ckrat += ckrat & 1;
Either way, the compiler produces the same code:
add r0, r0, #1
bic r0, r0, #1
I.e., ckrat = (ckrat + 1) & ~1, one "add" and one "and".
Might as well use the macro so it's clear. There is also round_up(x,y),
which I believe is intended to be used only with power of 2 values of
y.
Powered by blists - more mailing lists