From patchwork Sun Oct 2 11:04:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moshe Green X-Patchwork-Id: 9359577 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EE9506075E for ; Sun, 2 Oct 2016 11:04:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB90228871 for ; Sun, 2 Oct 2016 11:04:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDF4C28B5A; Sun, 2 Oct 2016 11:04:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71A4328871 for ; Sun, 2 Oct 2016 11:04:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751521AbcJBLEx (ORCPT ); Sun, 2 Oct 2016 07:04:53 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36035 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751404AbcJBLEv (ORCPT ); Sun, 2 Oct 2016 07:04:51 -0400 Received: by mail-wm0-f66.google.com with SMTP id b184so10179381wma.3; Sun, 02 Oct 2016 04:04:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=tHUbfLlFn7Zb406zeGUiJBNauytAhVTq9KVa/tWfS2s=; b=ZTkefCadp6RUhj1/spwCx1X8KvjXw0N9RYHl6Hh74V3l5Huc0fJ/WAtiKC6C20ooOb LuGYz3JL7YjOstpo6zt30FNHTKcLT3gf/YzC+uEqR57axfxYN1s5ffkXvRMRZ1Ch4zXP eSWZVRUsYj0fdubt7bV0mEX0wawD+QIugujwYF2i7Ml/z6YM9LJx6s91supOCotQ1NOb 0vt5T69hpNZkTXcJEkpY+lXSZ9+RJxE6L6YiGtFm87pQ1Av4bPjygZaBgJaHo10dpvRd VdKxd1QgciSUpnDTQ1OGI7896dsVkKN22Q2GYY1pB82K0cs5IZQYJ7es0UFmFtGNVEJl Ux4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=tHUbfLlFn7Zb406zeGUiJBNauytAhVTq9KVa/tWfS2s=; b=UKbHxwoSqYkWfttMYgvzpLrWgoALivZde54J6KEAm47DI78bJXWIBeg0wKnmb8y2TU yeZL5t8zQJm/Jm/EtNF65ZYUpvPJnMa8R49f/C/giPbTGX+1QUkoMVJu6vjZfx1FpsFY 6Qp2SiJXtUgse4KWf85Y9zpw1g7zV1aRfLMKdbwT4BxKS6KZtoKZMlUyybK05y+1QFOt DnRW4BjgsvQk1BkZBTN6QOVSf5UkP+8yxa4yksaHfHC+vj1miCurHrNEPJvwjhCuYMU/ cLuMCfPjhlZyV2Jd1WHSasN6PWp1bt0cHnO4WDIEdLw0+eaAgniix4WqKnDqn1zCpIRN W8dg== X-Gm-Message-State: AA6/9Rlwl/Jd8agN/HNjWK30XRRdqK11Z9o5WsRzkKDphbErhiwQWLHwAXmmaIVIxPDQtg== X-Received: by 10.28.99.70 with SMTP id x67mr623848wmb.72.1475406290304; Sun, 02 Oct 2016 04:04:50 -0700 (PDT) Received: from gmail.com ([5.102.207.83]) by smtp.gmail.com with ESMTPSA id vx7sm24617579wjc.1.2016.10.02.04.04.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Oct 2016 04:04:49 -0700 (PDT) Date: Sun, 2 Oct 2016 14:04:46 +0300 From: Moshe Green To: sudipm.mukherjee@gmail.com, teddy.wang@siliconmotion.com, gregkh@linuxfoundation.org Cc: linux-fbdev@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: sm750fb: replace roundedDiv with DIV_ROUND_CLOSEST Message-ID: <40d305d6c803600d5b78b792423f4618587229ec.1475406094.git.mgmoshes@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Replace local implementation of rounded division (roundedDiv macro) with the in-kernel implementation (DIV_ROUND_CLOSEST macro) in ddk750_chip.c Signed-off-by: Moshe Green --- drivers/staging/sm750fb/ddk750_chip.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/sm750fb/ddk750_chip.c b/drivers/staging/sm750fb/ddk750_chip.c index 3a0afe1..839d673 100644 --- a/drivers/staging/sm750fb/ddk750_chip.c +++ b/drivers/staging/sm750fb/ddk750_chip.c @@ -6,8 +6,6 @@ #include "ddk750_chip.h" #include "ddk750_power.h" -/* n / d + 1 / 2 = (2n + d) / 2d */ -#define roundedDiv(num, denom) ((2 * (num) + (denom)) / (2 * (denom))) #define MHz(x) ((x) * 1000000) logical_chip_type_t sm750_get_chip_type(void) @@ -102,7 +100,7 @@ static void setMemoryClock(unsigned int frequency) frequency = MHz(336); /* Calculate the divisor */ - divisor = roundedDiv(get_mxclk_freq(), frequency); + divisor = DIV_ROUND_CLOSEST(get_mxclk_freq(), frequency); /* Set the corresponding divisor in the register. */ reg = PEEK32(CURRENT_GATE) & ~CURRENT_GATE_M2XCLK_MASK; @@ -152,7 +150,7 @@ static void setMasterClock(unsigned int frequency) frequency = MHz(190); /* Calculate the divisor */ - divisor = roundedDiv(get_mxclk_freq(), frequency); + divisor = DIV_ROUND_CLOSEST(get_mxclk_freq(), frequency); /* Set the corresponding divisor in the register. */ reg = PEEK32(CURRENT_GATE) & ~CURRENT_GATE_MCLK_MASK;