mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
media: uvcvideo: Use DIV_ROUND_CLOSEST directly to make it readable
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> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
eeb76afbe8
commit
7ae5308190
1 changed files with 2 additions and 2 deletions
|
@ -1608,8 +1608,8 @@ int uvc_ctrl_set(struct uvc_fh *handle,
|
|||
if (step == 0)
|
||||
step = 1;
|
||||
|
||||
xctrl->value = min + ((u32)(xctrl->value - min) + step / 2)
|
||||
/ step * step;
|
||||
xctrl->value = min + DIV_ROUND_CLOSEST((u32)(xctrl->value - min),
|
||||
step) * step;
|
||||
if (mapping->data_type == UVC_CTRL_DATA_TYPE_SIGNED)
|
||||
xctrl->value = clamp(xctrl->value, min, max);
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue