summaryrefslogtreecommitdiff
path: root/include/media/cec.h
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2017-11-22 04:12:39 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-08 11:11:25 -0500
commitc8959a39fd47189a1474a4e92ffa34763589d6b0 (patch)
treebcb5da7425de2bfb99c6ac1f34ed15eff7b79040 /include/media/cec.h
parent15ae0be9c671e912a6749d821bc69ccfff766c19 (diff)
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