Skip to content

Commit 6d2b12e

Browse files
ribaldagregkh
authored andcommitted
media: uvcvideo: Send control events for partial succeeds
commit 5c79146 upstream. 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: stable@kernel.org Fixes: b401200 ("[media] uvcvideo: Add support for control events") Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Message-ID: <20250224-uvc-data-backup-v2-2-de993ed9823b@chromium.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b52dc88 commit 6d2b12e

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
@@ -1689,7 +1689,9 @@ static bool uvc_ctrl_xctrls_has_control(const struct v4l2_ext_control *xctrls,
16891689
}
16901690

16911691
static void uvc_ctrl_send_events(struct uvc_fh *handle,
1692-
const struct v4l2_ext_control *xctrls, unsigned int xctrls_count)
1692+
struct uvc_entity *entity,
1693+
const struct v4l2_ext_control *xctrls,
1694+
unsigned int xctrls_count)
16931695
{
16941696
struct uvc_control_mapping *mapping;
16951697
struct uvc_control *ctrl;
@@ -1700,6 +1702,9 @@ static void uvc_ctrl_send_events(struct uvc_fh *handle,
17001702
u32 changes = V4L2_EVENT_CTRL_CH_VALUE;
17011703

17021704
ctrl = uvc_find_control(handle->chain, xctrls[i].id, &mapping);
1705+
if (ctrl->entity != entity)
1706+
continue;
1707+
17031708
if (ctrl->info.flags & UVC_CTRL_FLAG_ASYNCHRONOUS)
17041709
/* Notification will be sent from an Interrupt event. */
17051710
continue;
@@ -1938,11 +1943,12 @@ int __uvc_ctrl_commit(struct uvc_fh *handle, int rollback,
19381943
uvc_ctrl_find_ctrl_idx(entity, ctrls,
19391944
err_ctrl);
19401945
goto done;
1946+
} else if (ret > 0 && !rollback) {
1947+
uvc_ctrl_send_events(handle, entity,
1948+
ctrls->controls, ctrls->count);
19411949
}
19421950
}
19431951

1944-
if (!rollback)
1945-
uvc_ctrl_send_events(handle, ctrls->controls, ctrls->count);
19461952
ret = 0;
19471953
done:
19481954
mutex_unlock(&chain->ctrl_mutex);

0 commit comments

Comments
 (0)