summaryrefslogtreecommitdiffstats
path: root/include/media/cec.h
diff options
context:
space:
mode:
authorHans Verkuil2017-11-22 10:12:39 +0100
committerMauro Carvalho Chehab2017-12-08 17:11:25 +0100
commitc8959a39fd47189a1474a4e92ffa34763589d6b0 (patch)
treebcb5da7425de2bfb99c6ac1f34ed15eff7b79040 /include/media/cec.h
parentmedia: cec-core.rst: document the new adap_monitor_pin_enable op (diff)
downloadkernel-qcow2-linux-c8959a39fd47189a1474a4e92ffa34763589d6b0.tar.gz
kernel-qcow2-linux-c8959a39fd47189a1474a4e92ffa34763589d6b0.tar.xz
kernel-qcow2-linux-c8959a39fd47189a1474a4e92ffa34763589d6b0.zip
media: cec: disable the hardware when unregistered
When the device is being unregistered disable the hardware, don't wait until cec_delete_adapter is called as the hardware may have disappeared by then. This would be the case for hotplugable devices. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reported-by: Bård Eirik Winther <bwinther@cisco.com> Tested-by: Bård Eirik Winther <bwinther@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'include/media/cec.h')
-rw-r--r--include/media/cec.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/media/cec.h b/include/media/cec.h
index dd781e928b72..1c6a797cb6d4 100644
--- a/include/media/cec.h
+++ b/include/media/cec.h
@@ -230,6 +230,18 @@ static inline bool cec_is_sink(const struct cec_adapter *adap)
return adap->phys_addr == 0;
}
+/**
+ * cec_is_registered() - is the CEC adapter registered?
+ *
+ * @adap: the CEC adapter, may be NULL.
+ *
+ * Return: true if the adapter is registered, false otherwise.
+ */
+static inline bool cec_is_registered(const struct cec_adapter *adap)
+{
+ return adap && adap->devnode.registered;
+}
+
#define cec_phys_addr_exp(pa) \
((pa) >> 12), ((pa) >> 8) & 0xf, ((pa) >> 4) & 0xf, (pa) & 0xf