From: "Keiji Hayashibara" <hayashibara.keiji@socionext.com>
To: "'Trent Piepho'" <tpiepho@impinj.com>, <andy.shevchenko@gmail.com>
Cc: linux-kernel@vger.kernel.org, robh+dt@kernel.org,
devicetree@vger.kernel.org, masami.hiramatsu@linaro.org,
"Hayashi, Kunihiko/林 邦彦" <hayashi.kunihiko@socionext.com>,
broonie@kernel.org, mark.rutland@arm.com,
linux-spi@vger.kernel.org, "Yamada,
Masahiro/山田 真弘" <yamada.masahiro@socionext.com>,
linux-arm-kernel@lists.infradead.org, jaswinder.singh@linaro.org
Subject: RE: [PATCH v2 2/2] spi: add SPI controller driver for UniPhier SoC
Date: Mon, 30 Jul 2018 14:30:25 +0900 [thread overview]
Message-ID: <002901d427c6$6b9a4ff0$42ceefd0$@socionext.com> (raw)
In-Reply-To: <1532624495.2283.197.camel@impinj.com>
Hello Trent and Andy,
> From: Trent Piepho [mailto:tpiepho@impinj.com]
> Sent: Friday, July 27, 2018 2:02 AM
> To: andy.shevchenko@gmail.com; Hayashibara, Keiji/林原 啓二 <hayashibara.keiji@socionext.com>
> 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.
I confirmed round_up() macro.
This macro is optimized to power of 2 argument,
and it matches to this case and clear.
I will replace to round_up() macro.
Thank you.
-----------------
Best Regards,
Keiji Hayashibara
next prev parent reply other threads:[~2018-07-30 5:30 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
2018-07-30 5:30 ` Keiji Hayashibara [this message]
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='002901d427c6$6b9a4ff0$42ceefd0$@socionext.com' \
--to=hayashibara.keiji@socionext.com \
--cc=andy.shevchenko@gmail.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hayashi.kunihiko@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=tpiepho@impinj.com \
--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).