]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jun 2024 11:39:45 +0000 (13:39 +0200)
commit1e2dbdf6ec88366b538a08dcd2eac63f670890da
tree0dcdccdf5fbfd8cff098a08603a21dd3b7280c39
parent1d1d76a69961c6e18d60178ad441bd35ec4b1b13
media: cec-adap.c: drop activate_cnt, use state info instead

[ Upstream commit f9222f8ca18bcb1d55dd749b493b29fd8092fb82 ]

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>
Stable-dep-of: 47c82aac10a6 ("media: cec: core: avoid recursive cec_claim_log_addrs")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/cec/core/cec-adap.c
include/media/cec.h