media: cec: add adap_free op
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 11 Jul 2017 06:30:36 +0000 (03:30 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 18 Jul 2017 15:47:29 +0000 (12:47 -0300)
This is needed for CEC adapters that allocate resources that have
to be freed before the cec_adapter is deleted.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/cec/cec-core.c
include/media/cec.h

index b516d599d6c44c4ddfd1f7b69c653edb6cc70c2c..2e5765344d07095f8c3d7e53393c0d87e96463d1 100644 (file)
@@ -374,6 +374,8 @@ void cec_delete_adapter(struct cec_adapter *adap)
        kthread_stop(adap->kthread);
        if (adap->kthread_config)
                kthread_stop(adap->kthread_config);
+       if (adap->ops->adap_free)
+               adap->ops->adap_free(adap);
 #ifdef CONFIG_MEDIA_CEC_RC
        rc_free_device(adap->rc);
 #endif
index e1e60dbb66c37391074162252a83da76462ae97e..37768203572d4275ebc2378be543b8956d49cce3 100644 (file)
@@ -114,6 +114,7 @@ struct cec_adap_ops {
        int (*adap_transmit)(struct cec_adapter *adap, u8 attempts,
                             u32 signal_free_time, struct cec_msg *msg);
        void (*adap_status)(struct cec_adapter *adap, struct seq_file *file);
+       void (*adap_free)(struct cec_adapter *adap);
 
        /* High-level CEC message callback */
        int (*received)(struct cec_adapter *adap, struct cec_msg *msg);