Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756643AbdDGJw7 (ORCPT ); Fri, 7 Apr 2017 05:52:59 -0400 Received: from nat-hk.nvidia.com ([203.18.50.4]:22708 "EHLO nat-hk.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756569AbdDGJwn (ORCPT ); Fri, 7 Apr 2017 05:52:43 -0400 X-PGP-Universal: processed; by hkpgpgate101.nvidia.com on Fri, 07 Apr 2017 02:52:41 -0700 From: Laxman Dewangan To: , , CC: , , , , , Laxman Dewangan Subject: [PATCH V3 1/4] pwm: tegra: Use DIV_ROUND_CLOSEST_ULL() instead of local implementation Date: Fri, 7 Apr 2017 15:03:59 +0530 Message-ID: <1491557642-15940-2-git-send-email-ldewangan@nvidia.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1491557642-15940-1-git-send-email-ldewangan@nvidia.com> References: <1491557642-15940-1-git-send-email-ldewangan@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 812 Lines: 31 Use macro DIV_ROUND_CLOSEST_ULL() for 64bit division to closest one instead of implementing the same locally. This increase readability. Signed-off-by: Laxman Dewangan --- Changes from v1: - None Changes from V2: - Fix typo in commit message. --- 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