Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1216842ybe; Thu, 5 Sep 2019 12:06:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzP7Mk/F8wsVNDdodxX22X+GsE++8RjU6vpZPfHctCRlYD+b72B3PmGbc0rfkGg8btfJbWa X-Received: by 2002:a63:7e17:: with SMTP id z23mr4617518pgc.14.1567710361444; Thu, 05 Sep 2019 12:06:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567710361; cv=none; d=google.com; s=arc-20160816; b=YZXI5dE1w4xJLzSy2foGrvFLAHUoknAVb45YQdvGBBxXi87U6Kr31hzf1VB4PcfxnW tQf+XqFWHarjPsUUraWT9UAwzX4BblPcK50FseeMSuSScSBcjP5f3HJVcKzQGGNMsASr TUV5YEAX3gpPh7b/4IH59qToBOkO4fj1UwkIu9LO6gkfeHamwKvlotB+fifnYz3F7VeE aqSfyxpo31KiOPgiltmHDJ0c5SS2LCeEiArri/5HkcBcAQqEW1rgp5hN6+wcsVo8S7dV WAUu+eVJT/KOK6NccZKfz0PkE8KUjbATWsxEPxC3mbTwbW5ySZf3CP0/uvnBto5MtL7g Lotw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=/dy/fqvnRpgywU64l3okQXh1IXVC49DnK3xttc0k9iY=; b=GMhb4tdgMT/ONluOQ8OEgVkptZPmBUAiV6fVkbqpG1f17zMXV+w8ZK77bgoV0922hS shf+XdrljpbYIN9ouHl950NuASu40LfwFT953jfQxOt0viRe4K5G8Z6PA8g03EVvyY2W h8Pm5igUUWjNIfp2D18LY1tA9cD1i4fKU/97t31adVwgWm3tKBscNhi3hvf1EJnaDy7O i36r4hGH1FBpVex7fpy2wSfJmIy6B45nwU668MubdI4Lvjx1jx64d4NylyY5f8gx0D5x IATPVUpwNH9hu2oJbCQ9TmDzINT7pgmGDXwc0xfA5xDzhtbD73DpoHmjKYJ8nYYOjU78 hZ2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v23si2497153pgn.557.2019.09.05.12.05.45; Thu, 05 Sep 2019 12:06:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387597AbfIEQSG (ORCPT + 99 others); Thu, 5 Sep 2019 12:18:06 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:34954 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731806AbfIEQSD (ORCPT ); Thu, 5 Sep 2019 12:18:03 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 12BB16B0AF36F1F33C01; Fri, 6 Sep 2019 00:18:01 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Fri, 6 Sep 2019 00:18:39 +0800 From: zhong jiang To: CC: , , , , Subject: [PATCH 4/4] media: v4l2-dv-timings: Use DIV_ROUND_CLOSEST directly to make it readable Date: Fri, 6 Sep 2019 00:14:52 +0800 Message-ID: <1567700092-27769-5-git-send-email-zhongjiang@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1567700092-27769-1-git-send-email-zhongjiang@huawei.com> References: <1567700092-27769-1-git-send-email-zhongjiang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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/v4l2-core/v4l2-dv-timings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c index 4f23e93..2b399c0 100644 --- a/drivers/media/v4l2-core/v4l2-dv-timings.c +++ b/drivers/media/v4l2-core/v4l2-dv-timings.c @@ -757,7 +757,7 @@ bool v4l2_detect_gtf(unsigned frame_height, pix_clk = pix_clk / GTF_PXL_CLK_GRAN * GTF_PXL_CLK_GRAN; hsync = (frame_width * 8 + 50) / 100; - hsync = ((hsync + GTF_CELL_GRAN / 2) / GTF_CELL_GRAN) * GTF_CELL_GRAN; + hsync = DIV_ROUND_CLOSEST(hsync, GTF_CELL_GRAN) * GTF_CELL_GRAN; h_fp = h_blank / 2 - hsync; -- 1.7.12.4