On Wed, Oct 11, 2017 at 04:14:37AM +0000, Zhi, Yong wrote: > Hi, Andy, > > > -----Original Message----- > > From: linux-media-owner@xxxxxxxxxxxxxxx [mailto:linux-media- > > owner@xxxxxxxxxxxxxxx] On Behalf Of Andy Shevchenko > > Sent: Friday, June 16, 2017 3:53 PM > > To: Zhi, Yong <yong.zhi@xxxxxxxxx> > > Cc: Linux Media Mailing List <linux-media@xxxxxxxxxxxxxxx>; > > sakari.ailus@xxxxxxxxxxxxxxx; Zheng, Jian Xu <jian.xu.zheng@xxxxxxxxx>; > > tfiga@xxxxxxxxxxxx; Mani, Rajmohan <rajmohan.mani@xxxxxxxxx>; > > Toivonen, Tuukka <tuukka.toivonen@xxxxxxxxx> > > Subject: Re: [PATCH v2 08/12] intel-ipu3: params: compute and program ccs > > > > On Thu, Jun 15, 2017 at 1:19 AM, Yong Zhi <yong.zhi@xxxxxxxxx> wrote: > > > A collection of routines that are mainly responsible to calculate the > > > acc parameters. > > > > > +static unsigned int ipu3_css_scaler_get_exp(unsigned int counter, > > > + unsigned int divider) { > > > + unsigned int i = 0; > > > + > > > + while (counter <= divider / 2) { > > > + divider /= 2; > > > + i++; > > > + } > > > + > > > + return i; > > > > We have a lot of different helpers including one you may use instead of this > > function. > > > > It's *highly* recommended you learn what we have under lib/ (and not only > > there) in kernel bewfore submitting a new version. > > > > Tried to identify more places that could be re-implemented with lib > helpers or more generic method, but we failed to spot any obvious > candidate thus far. How about: return (!counter || divider < counter) ? 0 : fls(divider / counter) - 1; -- Sakari Ailus sakari.ailus@xxxxxxxxxxxxxxx