From ebe15c7679680308268b99d911b1db15d514c7b8 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 15 Jul 2019 06:09:06 -0400 Subject: [PATCH] media: tegra-cec: use cec_notifier_cec_adap_(un)register Use cec_notifier_cec_adap_(un)register instead of cec_notifier_get, cec_notifier_put and cec_register_cec_notifier. Also enable the CEC_CAP_CONNECTOR_INFO capability. Signed-off-by: Hans Verkuil Cc: Thierry Reding Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/tegra-cec/tegra_cec.c | 35 ++++++++++---------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/media/platform/tegra-cec/tegra_cec.c b/drivers/media/platform/tegra-cec/tegra_cec.c index 6498b2d0492e..a632602131f2 100644 --- a/drivers/media/platform/tegra-cec/tegra_cec.c +++ b/drivers/media/platform/tegra-cec/tegra_cec.c @@ -380,38 +380,39 @@ static int tegra_cec_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "Unable to request interrupt for device\n"); - goto clk_error; - } - - cec->notifier = cec_notifier_get(hdmi_dev); - if (!cec->notifier) { - ret = -ENOMEM; - goto clk_error; + goto err_clk; } cec->adap = cec_allocate_adapter(&tegra_cec_ops, cec, TEGRA_CEC_NAME, - CEC_CAP_DEFAULTS | CEC_CAP_MONITOR_ALL, + CEC_CAP_DEFAULTS | CEC_CAP_MONITOR_ALL | + CEC_CAP_CONNECTOR_INFO, CEC_MAX_LOG_ADDRS); if (IS_ERR(cec->adap)) { ret = -ENOMEM; dev_err(&pdev->dev, "Couldn't create cec adapter\n"); - goto cec_error; + goto err_clk; } + + cec->notifier = cec_notifier_cec_adap_register(hdmi_dev, NULL, + cec->adap); + if (!cec->notifier) { + ret = -ENOMEM; + goto err_adapter; + } + ret = cec_register_adapter(cec->adap, &pdev->dev); if (ret) { dev_err(&pdev->dev, "Couldn't register device\n"); - goto cec_error; + goto err_notifier; } - cec_register_cec_notifier(cec->adap, cec->notifier); - return 0; -cec_error: - if (cec->notifier) - cec_notifier_put(cec->notifier); +err_notifier: + cec_notifier_cec_adap_unregister(cec->notifier); +err_adapter: cec_delete_adapter(cec->adap); -clk_error: +err_clk: clk_disable_unprepare(cec->clk); return ret; } @@ -422,8 +423,8 @@ static int tegra_cec_remove(struct platform_device *pdev) clk_disable_unprepare(cec->clk); + cec_notifier_cec_adap_unregister(cec->notifier); cec_unregister_adapter(cec->adap); - cec_notifier_put(cec->notifier); return 0; }