summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-05-05 13:45:24 +0200
committerMauro Carvalho Chehab <mchehab@kernel.org>2023-06-09 15:11:51 +0200
commit7c5dfb2d912c005285682508447585c15aa7b765 (patch)
treefdace4f563515442647a96858513600a80061d4f /drivers/media
parentmedia: uvcvideo: Rename uvc_format 'frame' field to 'frames' (diff)
downloadlinux-7c5dfb2d912c005285682508447585c15aa7b765.tar.xz
linux-7c5dfb2d912c005285682508447585c15aa7b765.zip
media: uvcvideo: Use clamp() to replace manual implementation
The kernel has a nice clamp() macro, use it to replace a manual implementation based on min() and max(). No functional change is intended. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Ricardo Ribalda <ribalda@chromium.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/usb/uvc/uvc_driver.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 445a7ae69b9b..9f89c781e885 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -437,9 +437,9 @@ static int uvc_parse_format(struct uvc_device *dev,
*/
n -= frame->bFrameIntervalType ? 1 : 2;
frame->dwDefaultFrameInterval =
- min(frame->dwFrameInterval[n],
- max(frame->dwFrameInterval[0],
- frame->dwDefaultFrameInterval));
+ clamp(frame->dwDefaultFrameInterval,
+ frame->dwFrameInterval[0],
+ frame->dwFrameInterval[n]);
if (dev->quirks & UVC_QUIRK_RESTRICT_FRAME_RATE) {
frame->bFrameIntervalType = 1;