Commit aa8db3ad authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

media: uvcvideo: Rename uvc_format 'frame' field to 'frames'

The uvc_format 'frame' field points to an array of frames. Rename it to
'frames' to make this clearer.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarRicardo Ribalda <ribalda@chromium.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent ccfad4e8
...@@ -339,8 +339,8 @@ static int uvc_parse_format(struct uvc_device *dev, ...@@ -339,8 +339,8 @@ static int uvc_parse_format(struct uvc_device *dev,
ftype = 0; ftype = 0;
/* Create a dummy frame descriptor. */ /* Create a dummy frame descriptor. */
frame = &format->frame[0]; frame = &format->frames[0];
memset(&format->frame[0], 0, sizeof(format->frame[0])); memset(&format->frames[0], 0, sizeof(format->frames[0]));
frame->bFrameIntervalType = 1; frame->bFrameIntervalType = 1;
frame->dwDefaultFrameInterval = 1; frame->dwDefaultFrameInterval = 1;
frame->dwFrameInterval = *intervals; frame->dwFrameInterval = *intervals;
...@@ -370,7 +370,7 @@ static int uvc_parse_format(struct uvc_device *dev, ...@@ -370,7 +370,7 @@ static int uvc_parse_format(struct uvc_device *dev,
*/ */
while (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE && while (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE &&
buffer[2] == ftype) { buffer[2] == ftype) {
frame = &format->frame[format->nframes]; frame = &format->frames[format->nframes];
if (ftype != UVC_VS_FRAME_FRAME_BASED) if (ftype != UVC_VS_FRAME_FRAME_BASED)
n = buflen > 25 ? buffer[25] : 0; n = buflen > 25 ? buffer[25] : 0;
else else
...@@ -687,7 +687,7 @@ static int uvc_parse_streaming(struct uvc_device *dev, ...@@ -687,7 +687,7 @@ static int uvc_parse_streaming(struct uvc_device *dev,
case UVC_VS_FORMAT_MJPEG: case UVC_VS_FORMAT_MJPEG:
case UVC_VS_FORMAT_DV: case UVC_VS_FORMAT_DV:
case UVC_VS_FORMAT_FRAME_BASED: case UVC_VS_FORMAT_FRAME_BASED:
format->frame = frame; format->frames = frame;
ret = uvc_parse_format(dev, streaming, format, ret = uvc_parse_format(dev, streaming, format,
&interval, buffer, buflen); &interval, buffer, buflen);
if (ret < 0) if (ret < 0)
......
...@@ -255,14 +255,14 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream, ...@@ -255,14 +255,14 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
maxd = (unsigned int)-1; maxd = (unsigned int)-1;
for (i = 0; i < format->nframes; ++i) { for (i = 0; i < format->nframes; ++i) {
u16 w = format->frame[i].wWidth; u16 w = format->frames[i].wWidth;
u16 h = format->frame[i].wHeight; u16 h = format->frames[i].wHeight;
d = min(w, rw) * min(h, rh); d = min(w, rw) * min(h, rh);
d = w*h + rw*rh - 2*d; d = w*h + rw*rh - 2*d;
if (d < maxd) { if (d < maxd) {
maxd = d; maxd = d;
frame = &format->frame[i]; frame = &format->frames[i];
} }
if (maxd == 0) if (maxd == 0)
...@@ -331,8 +331,8 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream, ...@@ -331,8 +331,8 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
probe->bFormatIndex); probe->bFormatIndex);
for (i = 0; i < format->nframes; ++i) { for (i = 0; i < format->nframes; ++i) {
if (probe->bFrameIndex == format->frame[i].bFrameIndex) { if (probe->bFrameIndex == format->frames[i].bFrameIndex) {
frame = &format->frame[i]; frame = &format->frames[i];
break; break;
} }
} }
...@@ -501,19 +501,19 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream, ...@@ -501,19 +501,19 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream,
for (i = 0; i < format->nframes && maxd != 0; i++) { for (i = 0; i < format->nframes && maxd != 0; i++) {
u32 d, ival; u32 d, ival;
if (&format->frame[i] == stream->cur_frame) if (&format->frames[i] == stream->cur_frame)
continue; continue;
if (format->frame[i].wWidth != stream->cur_frame->wWidth || if (format->frames[i].wWidth != stream->cur_frame->wWidth ||
format->frame[i].wHeight != stream->cur_frame->wHeight) format->frames[i].wHeight != stream->cur_frame->wHeight)
continue; continue;
ival = uvc_try_frame_interval(&format->frame[i], interval); ival = uvc_try_frame_interval(&format->frames[i], interval);
d = abs((s32)ival - interval); d = abs((s32)ival - interval);
if (d >= maxd) if (d >= maxd)
continue; continue;
frame = &format->frame[i]; frame = &format->frames[i];
probe.bFrameIndex = frame->bFrameIndex; probe.bFrameIndex = frame->bFrameIndex;
probe.dwFrameInterval = ival; probe.dwFrameInterval = ival;
maxd = d; maxd = d;
...@@ -1266,10 +1266,10 @@ static int uvc_ioctl_enum_framesizes(struct file *file, void *fh, ...@@ -1266,10 +1266,10 @@ static int uvc_ioctl_enum_framesizes(struct file *file, void *fh,
/* Skip duplicate frame sizes */ /* Skip duplicate frame sizes */
for (i = 0, index = 0; i < format->nframes; i++) { for (i = 0, index = 0; i < format->nframes; i++) {
if (frame && frame->wWidth == format->frame[i].wWidth && if (frame && frame->wWidth == format->frames[i].wWidth &&
frame->wHeight == format->frame[i].wHeight) frame->wHeight == format->frames[i].wHeight)
continue; continue;
frame = &format->frame[i]; frame = &format->frames[i];
if (index == fsize->index) if (index == fsize->index)
break; break;
index++; index++;
...@@ -1307,9 +1307,9 @@ static int uvc_ioctl_enum_frameintervals(struct file *file, void *fh, ...@@ -1307,9 +1307,9 @@ static int uvc_ioctl_enum_frameintervals(struct file *file, void *fh,
index = fival->index; index = fival->index;
for (i = 0; i < format->nframes; i++) { for (i = 0; i < format->nframes; i++) {
if (format->frame[i].wWidth == fival->width && if (format->frames[i].wWidth == fival->width &&
format->frame[i].wHeight == fival->height) { format->frames[i].wHeight == fival->height) {
frame = &format->frame[i]; frame = &format->frames[i];
nintervals = frame->bFrameIntervalType ?: 1; nintervals = frame->bFrameIntervalType ?: 1;
if (index < nintervals) if (index < nintervals)
break; break;
......
...@@ -176,8 +176,8 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream, ...@@ -176,8 +176,8 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream,
return; return;
for (i = 0; i < format->nframes; ++i) { for (i = 0; i < format->nframes; ++i) {
if (format->frame[i].bFrameIndex == ctrl->bFrameIndex) { if (format->frames[i].bFrameIndex == ctrl->bFrameIndex) {
frame = &format->frame[i]; frame = &format->frames[i];
break; break;
} }
} }
...@@ -2179,7 +2179,7 @@ int uvc_video_init(struct uvc_streaming *stream) ...@@ -2179,7 +2179,7 @@ int uvc_video_init(struct uvc_streaming *stream)
* descriptor is not found, use the first available frame. * descriptor is not found, use the first available frame.
*/ */
for (i = format->nframes; i > 0; --i) { for (i = format->nframes; i > 0; --i) {
frame = &format->frame[i-1]; frame = &format->frames[i-1];
if (frame->bFrameIndex == probe->bFrameIndex) if (frame->bFrameIndex == probe->bFrameIndex)
break; break;
} }
......
...@@ -265,7 +265,7 @@ struct uvc_format { ...@@ -265,7 +265,7 @@ struct uvc_format {
u32 flags; u32 flags;
unsigned int nframes; unsigned int nframes;
struct uvc_frame *frame; struct uvc_frame *frames;
}; };
struct uvc_streaming_header { struct uvc_streaming_header {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment