OSDN Git Service

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)
commitf9222f8ca18bcb1d55dd749b493b29fd8092fb82
tree5daa3437ae5b8a76fe4a678d8c0fd8a1ae59466a
parente3891b36364e85914fcb7a535656695a67e876a7
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