lkml.org 
[lkml]   [2020]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/2] i2c: i2c-stm32f7: allows for any bus frequency
On Thu, Mar 26, 2020 at 12:12 PM Alain Volmat <alain.volmat@st.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@st.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

\
 
 \ /
  Last update: 2020-03-26 12:39    [W:0.024 / U:7.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site