]> git.baikalelectronics.ru Git - kernel.git/commit
media: cec-adap.c: drop activate_cnt, use state info instead
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Tue, 10 May 2022 08:53:05 +0000 (10:53 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 13 May 2022 09:29:39 +0000 (11:29 +0200)
commitb17a78dba7a37c2211eaae99b886eb421fa67441
tree5daa3437ae5b8a76fe4a678d8c0fd8a1ae59466a
parente4879ae38e0ac51775a04541c915088a0073a0b0
media: cec-adap.c: drop activate_cnt, use state info instead

Using an activation counter to decide when the enable or disable the
cec adapter is not the best approach and can lead to race conditions.

Change this to determining the current status of the adapter, and
enable or disable the adapter accordingly.

It now only needs to be called whenever there is a chance that the
state changes, and it can handle enabling/disabling monitoring as
well if needed.

This simplifies the code and it should be a more robust approach as well.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/cec/core/cec-adap.c
include/media/cec.h