Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1618078 > unrolled thread
| Started by | Laxman Dewangan <ldewangan@nvidia.com> |
|---|---|
| First post | 2017-04-06 16:50 +0200 |
| Last post | 2017-04-06 18:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH V2 1/4] pwm: tegra: Use DIV_ROUND_CLOSEST_ULL() instead of local implementation Laxman Dewangan <ldewangan@nvidia.com> - 2017-04-06 16:50 +0200
Re: [PATCH V2 1/4] pwm: tegra: Use DIV_ROUND_CLOSEST_ULL() instead of local implementation Thierry Reding <thierry.reding@gmail.com> - 2017-04-06 18:30 +0200
| From | Laxman Dewangan <ldewangan@nvidia.com> |
|---|---|
| Date | 2017-04-06 16:50 +0200 |
| Subject | [PATCH V2 1/4] pwm: tegra: Use DIV_ROUND_CLOSEST_ULL() instead of local implementation |
| Message-ID | <ttgTv-1Cx-1@gated-at.bofh.it> |
Use macro DIV_ROUND_CLOSEST_ULL() for 64bit division to closet one instead of implementing the same locally. This increase readability. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> --- Changes from V1: None drivers/pwm/pwm-tegra.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c index e464784..0a688da 100644 --- a/drivers/pwm/pwm-tegra.c +++ b/drivers/pwm/pwm-tegra.c @@ -85,8 +85,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, * nearest integer during division. */ c *= (1 << PWM_DUTY_WIDTH); - c += period_ns / 2; - do_div(c, period_ns); + c = DIV_ROUND_CLOSEST_ULL(c, period_ns); val = (u32)c << PWM_DUTY_SHIFT; -- 2.1.4
[toc] | [next] | [standalone]
| From | Thierry Reding <thierry.reding@gmail.com> |
|---|---|
| Date | 2017-04-06 18:30 +0200 |
| Subject | Re: [PATCH V2 1/4] pwm: tegra: Use DIV_ROUND_CLOSEST_ULL() instead of local implementation |
| Message-ID | <ttisi-3fg-3@gated-at.bofh.it> |
| In reply to | #1618078 |
[Multipart message — attachments visible in raw view] — view raw
On Thu, Apr 06, 2017 at 07:50:58PM +0530, Laxman Dewangan wrote: > Use macro DIV_ROUND_CLOSEST_ULL() for 64bit division to closet one "closest" Thierry > instead of implementing the same locally. This increase readability. > > Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> > --- > Changes from V1: > None > > drivers/pwm/pwm-tegra.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/pwm/pwm-tegra.c b/drivers/pwm/pwm-tegra.c > index e464784..0a688da 100644 > --- a/drivers/pwm/pwm-tegra.c > +++ b/drivers/pwm/pwm-tegra.c > @@ -85,8 +85,7 @@ static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, > * nearest integer during division. > */ > c *= (1 << PWM_DUTY_WIDTH); > - c += period_ns / 2; > - do_div(c, period_ns); > + c = DIV_ROUND_CLOSEST_ULL(c, period_ns); > > val = (u32)c << PWM_DUTY_SHIFT; > > -- > 2.1.4 >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web