RE: [PATCH] i2c: riic: remove clock and frequency restrictions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Geert,

Thank you for your review.

On Wednesday, October 18, 2017 1, Geert Uytterhoeven wrote:
> > +       /*
> > +        * Remove clock ticks for rise and fall times. Convert ns to
> clock
> > +        * ticks.
> > +        */
> > +       brl -= t->scl_fall_ns / (1000000000/rate);
> > +       brh -= t->scl_rise_ns / (1000000000/rate);
> 
> To avoid losing too much precision by the division, you can rewrite this
> as
> e.g.
> 
>     brl -= t->scl_fall_ns * rate / 1000000000;
> 
> ("scl_fall_ns * rate" should not overflow).
> Perhaps DIV_ROUND_UP(), too?

Unfortunately, I do not get the correct number every time.

Sometimes I get the correct number, but most of the time I get 0.

Note, if rate=33,330,000 and t->scl_fall_ns=300, then 

t->scl_fall_ns * rate  = 9,999,000,000 (0x253FCA1C0) a 34-bit number.

So, I'd rather just stick with the less precision because it's not that 
much of a bit deal.


Chris




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux