From patchwork Wed Oct 9 14:55:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhong jiang X-Patchwork-Id: 11181341 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D5A5E17D4 for ; Wed, 9 Oct 2019 14:59:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BF5BC218DE for ; Wed, 9 Oct 2019 14:59:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731433AbfJIO7P (ORCPT ); Wed, 9 Oct 2019 10:59:15 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3287 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728019AbfJIO7P (ORCPT ); Wed, 9 Oct 2019 10:59:15 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 2A3E64E2F09D693439AE; Wed, 9 Oct 2019 22:59:11 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.439.0; Wed, 9 Oct 2019 22:59:04 +0800 From: zhong jiang To: , , , CC: , , Subject: [PATCH v2 2/4] media: tuners/qm1d1c0042: Use DIV_ROUND_CLOSEST directly to make it readable Date: Wed, 9 Oct 2019 22:55:23 +0800 Message-ID: <1570632925-14926-3-git-send-email-zhongjiang@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1570632925-14926-1-git-send-email-zhongjiang@huawei.com> References: <1570632925-14926-1-git-send-email-zhongjiang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The kernel.h macro DIV_ROUND_CLOSEST performs the computation (x + d/2)/d but is perhaps more readable. Signed-off-by: zhong jiang --- drivers/media/tuners/qm1d1c0042.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/tuners/qm1d1c0042.c b/drivers/media/tuners/qm1d1c0042.c index 83ca5dc..0e26d22 100644 --- a/drivers/media/tuners/qm1d1c0042.c +++ b/drivers/media/tuners/qm1d1c0042.c @@ -206,7 +206,7 @@ static int qm1d1c0042_set_params(struct dvb_frontend *fe) if (ret < 0) return ret; - a = (freq + state->cfg.xtal_freq / 2) / state->cfg.xtal_freq; + a = DIV_ROUND_CLOSEST(freq, state->cfg.xtal_freq); state->regs[0x06] &= 0x40; state->regs[0x06] |= (a - 12) / 4;