From: Trent Piepho <tpiepho@impinj.com>
To: "andy.shevchenko@gmail.com" <andy.shevchenko@gmail.com>,
"hayashibara.keiji@socionext.com"
<hayashibara.keiji@socionext.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"robh+dt@kernel.org" <robh+dt@kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"masami.hiramatsu@linaro.org" <masami.hiramatsu@linaro.org>,
"hayashi.kunihiko@socionext.com" <hayashi.kunihiko@socionext.com>,
"broonie@kernel.org" <broonie@kernel.org>,
"mark.rutland@arm.com" <mark.rutland@arm.com>,
"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
"yamada.masahiro@socionext.com" <yamada.masahiro@socionext.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"jaswinder.singh@linaro.org" <jaswinder.singh@linaro.org>
Subject: Re: [PATCH v2 2/2] spi: add SPI controller driver for UniPhier SoC
Date: Thu, 26 Jul 2018 17:01:36 +0000 [thread overview]
Message-ID: <1532624495.2283.197.camel@impinj.com> (raw)
In-Reply-To: <CAHp75VcEdxDEo0T5_9BzOPaeaqjbmbrWmaE9+ZuUDYhjh6jpVw@mail.gmail.com>
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.
next prev parent reply other threads:[~2018-07-26 17:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-26 7:09 [PATCH v2 0/2] add SPI controller driver for UniPhier SoCs Keiji Hayashibara
2018-07-26 7:09 ` [PATCH v2 1/2] dt-bindings: spi: add DT bindings for UniPhier SPI controller Keiji Hayashibara
2018-07-30 21:47 ` Rob Herring
2018-07-30 23:44 ` Keiji Hayashibara
2018-07-26 7:09 ` [PATCH v2 2/2] spi: add SPI controller driver for UniPhier SoC Keiji Hayashibara
2018-07-26 8:46 ` Andy Shevchenko
2018-07-26 9:38 ` Keiji Hayashibara
2018-07-26 10:57 ` Radu Pirea
2018-07-30 1:15 ` Keiji Hayashibara
2018-07-26 13:44 ` Andy Shevchenko
2018-07-30 1:46 ` Keiji Hayashibara
2018-07-26 17:01 ` Trent Piepho [this message]
2018-07-30 5:30 ` Keiji Hayashibara
2018-07-30 8:39 ` Andy Shevchenko
2018-07-26 9:12 ` Masahiro Yamada
2018-07-26 9:49 ` Keiji Hayashibara
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=1532624495.2283.197.camel@impinj.com \
--to=tpiepho@impinj.com \
--cc=andy.shevchenko@gmail.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hayashi.kunihiko@socionext.com \
--cc=hayashibara.keiji@socionext.com \
--cc=jaswinder.singh@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=masami.hiramatsu@linaro.org \
--cc=robh+dt@kernel.org \
--cc=yamada.masahiro@socionext.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;
as well as URLs for NNTP newsgroup(s).