Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp996294ybp; Wed, 9 Oct 2019 07:25:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxaorAwPVXFPe2TUxW65dPZpJ8ocwwqm6XtFnWD8UEWKB9GUJmwz0ZQ+RK2NGJ0GQz4lN+p X-Received: by 2002:a17:906:6d87:: with SMTP id h7mr3150574ejt.4.1570631114397; Wed, 09 Oct 2019 07:25:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570631114; cv=none; d=google.com; s=arc-20160816; b=jQgipexuBskCxAAwluktS7cOW5W3AJhxQd6GYOvtwvYbjfeX/kT4Yvu4s6PYXM8fBM UOd5nvwZ4KpgLOCB2BQ/2gUMr4h4LR96Vx0zhbowWbjZYxfBSoklDoK4OJhMOZzUN57j CAkvVxuPi5wk092671kYj3dYWMaP6RPjfiirZ4nva25HcdFYxONosffoRrWd87SV/8eZ q+qPg34JhApu/ouF3ZNQSFJFlN5sUdj3Yi8+gZqMTPHg8AdbA16lPdO1C5HI9G3p7mON SOhp2KPWLTnTOWBZpV3KQ9T4V87EHcOVbFcjbmgmlBKWVsHjFWMlBYCDIvD8x/6xyttJ alEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id; bh=nw21JZSDn8Ggq5ot7+og7rrdeFvnwVcUk23OHfaCpxQ=; b=dV4QggH2Rq3pDQSTAOrtRQF0Vd7y3WGDI289ZINvJvXbKB083Uy4gHe1TTZ67ubC2k DM+LaM3AxFoML+uJ/WR0XN+inFipe0Bimi6JzO0KrQN6u1PeSLhmP+uUMRgl1hVJPTcb Z6chO2BPYP9MSvS94ZsUTIPXSLh2tZfd61w3O37fLjtS3avjevaYUKynFJbfbNSMGeJE HDbCb4fUs7HzPH3VGCILNi+byBwGEvUhapHkTLKpdv8igBmyNlGtLBX6MQfGG02BJGkE MOZo2HZ8fRMyh5Gga6Y58AmW6M5szboYebw+w6ruHTXMEwTEfL2yZMvJMrG06NI9BNep sB4A== 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 m1si1216544eji.86.2019.10.09.07.24.48; Wed, 09 Oct 2019 07:25:14 -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 S1731255AbfJIOYY (ORCPT + 99 others); Wed, 9 Oct 2019 10:24:24 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:60996 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729491AbfJIOYY (ORCPT ); Wed, 9 Oct 2019 10:24:24 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id D5B68D1D3597239601EF; Wed, 9 Oct 2019 22:24:21 +0800 (CST) Received: from [127.0.0.1] (10.177.29.68) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.439.0; Wed, 9 Oct 2019 22:24:19 +0800 Message-ID: <5D9DED92.8060201@huawei.com> Date: Wed, 9 Oct 2019 22:24:18 +0800 From: zhong jiang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Sean Young CC: , , , , Subject: Re: [PATCH 1/4] media: dvb-frontends: Use DIV_ROUND_CLOSEST directly to make it readable References: <1567700092-27769-1-git-send-email-zhongjiang@huawei.com> <1567700092-27769-2-git-send-email-zhongjiang@huawei.com> <20191001111552.GA18622@gofer.mess.org> In-Reply-To: <20191001111552.GA18622@gofer.mess.org> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.68] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/10/1 19:15, Sean Young wrote: > Hi, > > On Fri, Sep 06, 2019 at 12:14:49AM +0800, zhong jiang wrote: >> 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/dvb-frontends/mt312.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/media/dvb-frontends/mt312.c b/drivers/media/dvb-frontends/mt312.c >> index 7cae7d6..251ff41 100644 >> --- a/drivers/media/dvb-frontends/mt312.c >> +++ b/drivers/media/dvb-frontends/mt312.c >> @@ -137,7 +137,7 @@ static inline int mt312_writereg(struct mt312_state *state, >> >> static inline u32 mt312_div(u32 a, u32 b) >> { >> - return (a + (b / 2)) / b; >> + return DIV_ROUND_CLOSEST(a, b); > Well spotted, that is absolutely correct. However now mt312_div() is just > a wrapper for DIV_ROUND_CLOSEST() -- and even marked inline. Really all > the callers to mt312_div() should be replaced with DIV_ROUND_CLOSEST(). Thanks for your suggestion. I will use DIV_ROUND_CLOSEST directly in v2. Sincerely, zhong jiang > Thanks, > > Sean > > . >