Skip to content

Commit 5c79146

Browse files
ribaldahverkuil
authored andcommitted
media: uvcvideo: Send control events for partial succeeds
Today, when we are applying a change to entities A, B. If A succeeds and B fails the events for A are not sent. This change changes the code so the events for A are send right after they happen. Cc: [email protected] Fixes: b401200 ("[media] uvcvideo: Add support for control events") Signed-off-by: Ricardo Ribalda <[email protected]> Message-ID: <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent ba4fafb commit 5c79146

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/media/usb/uvc/uvc_ctrl.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,7 +1954,9 @@ static bool uvc_ctrl_xctrls_has_control(const struct v4l2_ext_control *xctrls,
19541954
}
19551955

19561956
static void uvc_ctrl_send_events(struct uvc_fh *handle,
1957-
const struct v4l2_ext_control *xctrls, unsigned int xctrls_count)
1957+
struct uvc_entity *entity,
1958+
const struct v4l2_ext_control *xctrls,
1959+
unsigned int xctrls_count)
19581960
{
19591961
struct uvc_control_mapping *mapping;
19601962
struct uvc_control *ctrl;
@@ -1966,6 +1968,9 @@ static void uvc_ctrl_send_events(struct uvc_fh *handle,
19661968
s32 value;
19671969

19681970
ctrl = uvc_find_control(handle->chain, xctrls[i].id, &mapping);
1971+
if (ctrl->entity != entity)
1972+
continue;
1973+
19691974
if (ctrl->info.flags & UVC_CTRL_FLAG_ASYNCHRONOUS)
19701975
/* Notification will be sent from an Interrupt event. */
19711976
continue;
@@ -2209,11 +2214,12 @@ int __uvc_ctrl_commit(struct uvc_fh *handle, int rollback,
22092214
uvc_ctrl_find_ctrl_idx(entity, ctrls,
22102215
err_ctrl);
22112216
goto done;
2217+
} else if (ret > 0 && !rollback) {
2218+
uvc_ctrl_send_events(handle, entity,
2219+
ctrls->controls, ctrls->count);
22122220
}
22132221
}
22142222

2215-
if (!rollback)
2216-
uvc_ctrl_send_events(handle, ctrls->controls, ctrls->count);
22172223
ret = 0;
22182224
done:
22192225
mutex_unlock(&chain->ctrl_mutex);

0 commit comments

Comments
 (0)