Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8162480ybn; Tue, 1 Oct 2019 04:16:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVQ0fVO1t+cdljkWom+lI8CeKDfR2o58M70ytcyOC0ynmf+0OfcW5DEaq8MMPeE3BRggi9 X-Received: by 2002:a05:6402:1202:: with SMTP id c2mr23996876edw.190.1569928582821; Tue, 01 Oct 2019 04:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569928582; cv=none; d=google.com; s=arc-20160816; b=gUjuM7IINlZ8vIrJhh2wbik2P3PtcMrMNDaVj+WHKm7lIdwF9d6XDg08JH4m5THfAg i2DMIjuBb3TNjHB9jxdyCNnqrl9aTIwUQvvKnNQHJ7++0Xq1b6udIuqskISGoE08RNf7 pcTpk+sgzlZH5elII0Yc8gj/vaPuHD3YVZ1s0NvA9XFxyUrkrIa0Urr0EsuTeH3O1aBI mIBnQWbc72apCZfRthbppPmuhUBPUDZi+OJZY902vAt6b8pP8+/lkeYvPA+jNdPFmO37 JCX0GNvwN7sG5lMPZ5lws1Q/RFBsTGXZJPryBwQ6Cw3GK5pMRI7CYQqL8o+KVOz2ZUQn sTgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=bL7k0tRbT3ChrczTJGmIL0pOpGEv4qdh5TSUZ8SSTSw=; b=kEe160TId4a43sBTWQNUoaxJSeww7X8Xkt4uGVNwakDMJZ+OrWaAa6WY4GAmaGLVu2 2AIJ6FzrHmyu2bIH8Tn/UcpGgbw6Kt8VCXEEJAw3cAcgEx8TKJAYk9K1oA/BznLxBX2l CBh9itVQtNm5Drw9OrEOWHasW8qKZgXrPY3Xx5IA2C54iBPEaSnZB0cMBnfN6Q00Ozdw VJpAp91sID7siVcf8Dn3OhFm6C6tPN1c+aAa5jLyGLcRfffRHFvJlwrnGJqPiF3+W5Ju qRwwYA6QXsmrolGri72x+icZamEBj6td7m3KEgg0BV3mnWa0Xr1V1E02+PAiq0Ja3Veh RN8w== 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 y3si9488784ede.38.2019.10.01.04.15.58; Tue, 01 Oct 2019 04:16:22 -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 S1731112AbfJALPz (ORCPT + 99 others); Tue, 1 Oct 2019 07:15:55 -0400 Received: from gofer.mess.org ([88.97.38.141]:57041 "EHLO gofer.mess.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725839AbfJALPz (ORCPT ); Tue, 1 Oct 2019 07:15:55 -0400 Received: by gofer.mess.org (Postfix, from userid 1000) id 2A59BC646D; Tue, 1 Oct 2019 12:15:53 +0100 (BST) Date: Tue, 1 Oct 2019 12:15:53 +0100 From: Sean Young To: zhong jiang Cc: mchehab@kernel.org, hansverk@cisco.com, daniel.vetter@ffwll.ch, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4] media: dvb-frontends: Use DIV_ROUND_CLOSEST directly to make it readable Message-ID: <20191001111552.GA18622@gofer.mess.org> References: <1567700092-27769-1-git-send-email-zhongjiang@huawei.com> <1567700092-27769-2-git-send-email-zhongjiang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1567700092-27769-2-git-send-email-zhongjiang@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, Sean