All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhong jiang <zhongjiang@huawei.com>
To: Sean Young <sean@mess.org>
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
Date: Wed, 9 Oct 2019 22:24:18 +0800	[thread overview]
Message-ID: <5D9DED92.8060201@huawei.com> (raw)
In-Reply-To: <20191001111552.GA18622@gofer.mess.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 <zhongjiang@huawei.com>
>> ---
>>  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
>
> .
>



  reply	other threads:[~2019-10-09 14:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05 16:14 [PATCH 0/4] media: Use DIV_ROUND_CLOSEST directly zhong jiang
2019-09-05 16:14 ` [PATCH 1/4] media: dvb-frontends: Use DIV_ROUND_CLOSEST directly to make it readable zhong jiang
2019-10-01 11:15   ` Sean Young
2019-10-09 14:24     ` zhong jiang [this message]
2019-09-05 16:14 ` [PATCH 2/4] media: tuners/qm1d1c0042: " zhong jiang
2019-09-05 16:14 ` [PATCH 3/4] media: uvcvideo: " zhong jiang
2019-09-05 16:14 ` [PATCH 4/4] media: v4l2-dv-timings: " zhong jiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5D9DED92.8060201@huawei.com \
    --to=zhongjiang@huawei.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=hansverk@cisco.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sean@mess.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.