[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75Vc896RpnrX6+yb0LfXVroLJO5XX6Gt5V4BJZjdFYOXYnQ@mail.gmail.com>
Date: Thu, 26 Mar 2020 13:38:38 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>,
Wolfram Sang <wsa@...-dreams.de>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Pierre Yves MORDRET <pierre-yves.mordret@...com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre TORGUE <alexandre.torgue@...com>,
linux-i2c <linux-i2c@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
"linux-stm32@...md-mailman.stormreply.com"
<linux-stm32@...md-mailman.stormreply.com>,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Fabrice GASNIER <fabrice.gasnier@...com>
Subject: Re: [PATCH 2/2] i2c: i2c-stm32f7: allows for any bus frequency
On Thu, Mar 26, 2020 at 12:12 PM Alain Volmat <alain.volmat@...com> wrote:
> On Wed, Mar 25, 2020 at 06:53:45PM +0000, Andy Shevchenko wrote:
> > On Wed, Mar 25, 2020 at 8:38 PM Alain Volmat <alain.volmat@...com> wrote:
...
> > > + int i;
> > > +
> > > + for (i = ARRAY_SIZE(i2c_specs) - 1; i >= 0; i--)
> >
> >
> > Perhaps
> >
> > int i = ARRAY_SIZE(i2c_specs);
> >
> > while(i--)
> >
> > ?
>
> I propose the following code to make it a bit easier to read/understand:
>
> static u32 get_lower_rate(u32 rate)
> {
> int i = ARRAY_SIZE(i2c_specs);
>
> while (i--)
> if (i2c_specs[i].rate < rate)
> break;
>
> return i2c_specs[i].rate;
> }
>
> If you agree with that I'll push a v2.
No objections.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists