linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	Karol Gugala <kgugala@antmicro.com>,
	Mateusz Holenko <mholenko@antmicro.com>,
	Kamil Rakoczy <krakoczy@antmicro.com>,
	mdudek@internships.antmicro.com,
	Paul Mackerras <paulus@ozlabs.org>, Joel Stanley <joel@jms.id.au>,
	Stafford Horne <shorne@gmail.com>,
	david.abdurachmanov@sifive.com,
	Florent Kermarrec <florent@enjoy-digital.fr>,
	Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH v9 3/3] mmc: Add driver for LiteX's LiteSDCard interface
Date: Mon, 10 Jan 2022 09:25:58 +0100	[thread overview]
Message-ID: <CAMuHMdWzMaKyG84CBt4S1xy4Jd+y85LG+KhbR4QvJ09PcU-f3A@mail.gmail.com> (raw)
In-Reply-To: <Ydorm5HirY2i/RCg@errol.ini.cmu.edu>

Hi Gabriel,

On Sun, Jan 9, 2022 at 1:26 AM Gabriel L. Somlo <gsomlo@gmail.com> wrote:
> On Sat, Jan 08, 2022 at 07:43:19PM +0200, Andy Shevchenko wrote:
> > On Sat, Jan 8, 2022 at 6:11 PM Gabriel Somlo <gsomlo@gmail.com> wrote:
> > > +       u32 div;
> > > +
> > > +       div = freq ? host->ref_clk / freq : 256U;
> >
> > > +       div = roundup_pow_of_two(div);
> > > +       div = clamp(div, 2U, 256U);
> >
> > Not sure why it becomes two lines again.
>
> Per my previous email, I have:
>
>         div = clamp((u32)roundup_pow_of_two(div), 2U, 256U);
>
> ... lined up for v10 (pending also Geert's OK on the (u32) cast
> to shut up compiler warnings) :)

JFY (as you decided to keep the two separate lines), this is
exactly why clamp_t()exists: to avoid the explicit cast.

i.e.

    div = clamp_t(u32, roundup_pow_of_two(div), 2U, 256U);

or

    div = clamp_t(u32, roundup_pow_of_two(div), 2, 256);

(the implicit cast is applied to all parameters).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  parent reply	other threads:[~2022-01-10  8:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-08 16:11 [PATCH v9 0/3] mmc: Add LiteSDCard mmc driver Gabriel Somlo
2022-01-08 16:11 ` [PATCH v9 1/3] MAINTAINERS: co-maintain LiteX platform Gabriel Somlo
2022-01-08 16:11 ` [PATCH v9 2/3] dt-bindings: mmc: Add bindings for LiteSDCard Gabriel Somlo
2022-01-08 16:11 ` [PATCH v9 3/3] mmc: Add driver for LiteX's LiteSDCard interface Gabriel Somlo
2022-01-08 17:43   ` Andy Shevchenko
2022-01-09  0:26     ` Gabriel L. Somlo
2022-01-09 11:43       ` Andy Shevchenko
2022-01-10  8:25       ` Geert Uytterhoeven [this message]
     [not found] ` <20220109025042.1537-1-hdanton@sina.com>
2022-01-09  4:19   ` Gabriel L. Somlo

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=CAMuHMdWzMaKyG84CBt4S1xy4Jd+y85LG+KhbR4QvJ09PcU-f3A@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=david.abdurachmanov@sifive.com \
    --cc=devicetree@vger.kernel.org \
    --cc=florent@enjoy-digital.fr \
    --cc=gsomlo@gmail.com \
    --cc=joel@jms.id.au \
    --cc=kgugala@antmicro.com \
    --cc=krakoczy@antmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mdudek@internships.antmicro.com \
    --cc=mholenko@antmicro.com \
    --cc=paulus@ozlabs.org \
    --cc=rdunlap@infradead.org \
    --cc=robh+dt@kernel.org \
    --cc=shorne@gmail.com \
    --cc=ulf.hansson@linaro.org \
    /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).