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>
This commit is contained in:
Hans Verkuil
2017-11-22 04:12:39 -05:00
committed by Mauro Carvalho Chehab
parent 15ae0be9c6
commit c8959a39fd
3 changed files with 25 additions and 13 deletions

View File

@@ -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