]> 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)
commit7bbaa7e02c9626b4cb795cb14a8cab1ddc7755b6
tree5daa3437ae5b8a76fe4a678d8c0fd8a1ae59466a
parent2b74286623c81b05e766a3b9e21c6dc56add7460
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