Use the new cec_notifier_conn_(un)register() functions to
(un)register the notifier for the HDMI connector, and fill
in the cec_connector_info.

Signed-off-by: Dariusz Marcinkiewicz <dar...@google.com>
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c 
b/drivers/gpu/drm/i2c/tda998x_drv.c
index 7f34601bb5155..d8d51c6a2d390 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -794,9 +794,14 @@ static irqreturn_t tda998x_irq_thread(int irq, void *data)
                        if (lvl & CEC_RXSHPDLEV_HPD) {
                                tda998x_edid_delay_start(priv);
                        } else {
+                               struct cec_notifier *notify;
+
                                schedule_work(&priv->detect_work);
-                               cec_notifier_set_phys_addr(priv->cec_notify,
-                                                  CEC_PHYS_ADDR_INVALID);
+
+                               notify = READ_ONCE(priv->cec_notify);
+                               if (notify)
+                                       cec_notifier_set_phys_addr(notify,
+                                                       CEC_PHYS_ADDR_INVALID);
                        }
 
                        handled = true;
@@ -1253,6 +1258,8 @@ static int tda998x_connector_init(struct tda998x_priv 
*priv,
                                  struct drm_device *drm)
 {
        struct drm_connector *connector = &priv->connector;
+       struct cec_connector_info conn_info;
+       struct cec_notifier *notifier;
        int ret;
 
        connector->interlace_allowed = 1;
@@ -1269,6 +1276,14 @@ static int tda998x_connector_init(struct tda998x_priv 
*priv,
        if (ret)
                return ret;
 
+       cec_fill_conn_info_from_drm(&conn_info, connector);
+
+       notifier = cec_notifier_conn_register(priv->cec_glue.parent,
+                                             NULL, &conn_info);
+       if (!notifier)
+               return -ENOMEM;
+       WRITE_ONCE(priv->cec_notify, notifier);
+
        drm_connector_attach_encoder(&priv->connector,
                                     priv->bridge.encoder);
 
@@ -1651,7 +1666,7 @@ static void tda998x_destroy(struct device *dev)
        i2c_unregister_device(priv->cec);
 
        if (priv->cec_notify)
-               cec_notifier_put(priv->cec_notify);
+               cec_notifier_conn_unregister(priv->cec_notify);
 }
 
 static int tda998x_create(struct device *dev)
@@ -1776,12 +1791,6 @@ static int tda998x_create(struct device *dev)
                cec_write(priv, REG_CEC_RXSHPDINTENA, CEC_RXSHPDLEV_HPD);
        }
 
-       priv->cec_notify = cec_notifier_get(dev);
-       if (!priv->cec_notify) {
-               ret = -ENOMEM;
-               goto fail;
-       }
-
        priv->cec_glue.parent = dev;
        priv->cec_glue.data = priv;
        priv->cec_glue.init = tda998x_cec_hook_init;
-- 
2.22.0.410.gd8fdbe21b5-goog

Reply via email to