]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
media: cec-funcs.h: add status_req checks
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Tue, 1 Oct 2019 07:56:38 +0000 (04:56 -0300)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 29 Jan 2020 04:45:21 +0000 (23:45 -0500)
BugLink: https://bugs.launchpad.net/bugs/1859712
[ Upstream commit 9b211f9c5a0b67afc435b86f75d78273b97db1c5 ]

The CEC_MSG_GIVE_DECK_STATUS and CEC_MSG_GIVE_TUNER_DEVICE_STATUS commands
both have a status_req argument: ON, OFF, ONCE. If ON or ONCE, then the
follower will reply with a STATUS message. Either once or whenever the
status changes (status_req == ON).

If status_req == OFF, then it will stop sending continuous status updates,
but the follower will *not* send a STATUS message in that case.

This means that if status_req == OFF, then msg->reply should be 0 as well
since no reply is expected in that case.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
include/uapi/linux/cec-funcs.h

index 28e8a2a86e16653c647cb0acc1ce50f3e34f7f96..2a114f7a24d4290132fabd3d2d952812aa420966 100644 (file)
@@ -952,7 +952,8 @@ static inline void cec_msg_give_deck_status(struct cec_msg *msg,
        msg->len = 3;
        msg->msg[1] = CEC_MSG_GIVE_DECK_STATUS;
        msg->msg[2] = status_req;
-       msg->reply = reply ? CEC_MSG_DECK_STATUS : 0;
+       msg->reply = (reply && status_req != CEC_OP_STATUS_REQ_OFF) ?
+                               CEC_MSG_DECK_STATUS : 0;
 }
 
 static inline void cec_ops_give_deck_status(const struct cec_msg *msg,
@@ -1056,7 +1057,8 @@ static inline void cec_msg_give_tuner_device_status(struct cec_msg *msg,
        msg->len = 3;
        msg->msg[1] = CEC_MSG_GIVE_TUNER_DEVICE_STATUS;
        msg->msg[2] = status_req;
-       msg->reply = reply ? CEC_MSG_TUNER_DEVICE_STATUS : 0;
+       msg->reply = (reply && status_req != CEC_OP_STATUS_REQ_OFF) ?
+                               CEC_MSG_TUNER_DEVICE_STATUS : 0;
 }
 
 static inline void cec_ops_give_tuner_device_status(const struct cec_msg *msg,