Skip to content

Commit b8bc503

Browse files
wolfgarjnettlet
authored andcommitted
MXC-CEC: Flush pending events at close
Empty internal queue when userland closes the device Signed-off-by: Rudi <[email protected]>
1 parent 031f01a commit b8bc503

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/mxc/hdmi-cec/mxc_hdmi-cec.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,18 @@ static long hdmi_cec_ioctl(struct file *filp, u_int cmd,
471471
*/
472472
static int hdmi_cec_release(struct inode *inode, struct file *filp)
473473
{
474+
struct hdmi_cec_event *event, *tmp_event;
474475
mutex_lock(&hdmi_cec_data.lock);
475476
if (open_count) {
476477
open_count = 0;
477478
hdmi_cec_data.cec_state = false;
478479
hdmi_cec_data.Logical_address = 15;
480+
481+
/* Flush eventual events which have not been read by user space */
482+
list_for_each_entry_safe(event, tmp_event, &head, list) {
483+
list_del(&event->list);
484+
vfree(event);
485+
}
479486
}
480487
mutex_unlock(&hdmi_cec_data.lock);
481488

0 commit comments

Comments
 (0)