diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2022-05-10 11:53:05 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-05-13 12:29:39 +0300 |
commit | f9222f8ca18bcb1d55dd749b493b29fd8092fb82 (patch) | |
tree | 5daa3437ae5b8a76fe4a678d8c0fd8a1ae59466a /include/media | |
parent | e3891b36364e85914fcb7a535656695a67e876a7 (diff) | |
download | linux-f9222f8ca18bcb1d55dd749b493b29fd8092fb82.tar.xz |
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>
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/cec.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/media/cec.h b/include/media/cec.h index 6c9b41fe9802..abee41ae02d0 100644 --- a/include/media/cec.h +++ b/include/media/cec.h @@ -183,6 +183,7 @@ struct cec_adap_ops { * @needs_hpd: if true, then the HDMI HotPlug Detect pin must be high * in order to transmit or receive CEC messages. This is usually a HW * limitation. + * @is_enabled: the CEC adapter is enabled * @is_configuring: the CEC adapter is configuring (i.e. claiming LAs) * @must_reconfigure: while configuring, the PA changed, so reclaim LAs * @is_configured: the CEC adapter is configured (i.e. has claimed LAs) @@ -194,7 +195,6 @@ struct cec_adap_ops { * Drivers that need this can set this field to true after the * cec_allocate_adapter() call. * @last_initiator: the initiator of the last transmitted message. - * @activate_cnt: number of times that CEC is activated * @monitor_all_cnt: number of filehandles monitoring all msgs * @monitor_pin_cnt: number of filehandles monitoring pin changes * @follower_cnt: number of filehandles in follower mode @@ -243,13 +243,13 @@ struct cec_adapter { u16 phys_addr; bool needs_hpd; + bool is_enabled; bool is_configuring; bool must_reconfigure; bool is_configured; bool cec_pin_is_high; bool adap_controls_phys_addr; u8 last_initiator; - u32 activate_cnt; u32 monitor_all_cnt; u32 monitor_pin_cnt; u32 follower_cnt; |