lkml.org 
[lkml]   [2021]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [v5 2/2] pwm: Add Aspeed ast2600 PWM support
Date
Hello,

On 2021/5/15, 11:57 PM,Uwe Kleine-Königwrote:

> > + div_h = DIV_ROUND_DOWN_ULL(div_h,
> > + (FIELD_MAX(PWM_ASPEED_CTRL_CLK_DIV_L) + 1));
> > + div_h = DIV_ROUND_DOWN_ULL(div_h, NSEC_PER_SEC);

> As a division is an expensive operation you can better first multiply
> NSEC_PER_SEC and FIELD_MAX(PWM_ASPEED_CTRL_CLK_DIV_L) + 1 and divide by
> the result.

When I multiply NSEC_PER_SEC and FIELD_MAX(PWM_ASPEED_CTRL_CLK_DIV_L) + 1 the result will overflow
for 32-bits and the divisor type of do_div is 32-bits so I need to do div twice to avoid the issue.
Can you give me some suggests?

Thanks

\
 
 \ /
  Last update: 2021-05-17 04:54    [W:0.125 / U:1.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site