On Thu, Jan 21, 2010 at 03:55, Song, Barry wrote:
>From: Mike Frysinger [mailto:[email protected]]
>>On Thu, Jan 21, 2010 at 02:20,  <[email protected]> wrote:
>>> Modified: trunk/arch/blackfin/include/asm/delay.h (8206 => 8207)
>>>
>>> @@ -36,4 +36,12 @@
>>>      __delay((((usecs * HZSCALE) >> 11) * (loops_per_jiffy
>>>> 11)) >> 6);
>>>  }
>>>
>>> +static inline void ndelay(unsigned long nsecs)
>>> +{
>>> +    extern unsigned long loops_per_jiffy;
>>> +    __delay(((((1 * HZSCALE) >> 11) * (loops_per_jiffy >>
>>>       11)) >> 6) * nsecs / 1000);
>>
>>please unify udelay and ndelay instead of copying & pasting
>
> Then a macro for (((usecs * HZSCALE) >> 11) * (loops_per_jiffy >>> 11))
>>> 6 ?

static inline __to_delay(unsigned long scale)
{
    extern unsigned long loops_per_jiffy;
    return (((scale * HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6;
}
static inline void udelay(unsigned long usecs)
{
    __delay(__to_delay(usecs));
}
static inline void ndelay(unsigned long nsecs)
{
    __delay(__to_delay(1) * nsecs / 1000);
}
-mike
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to