Commit 72a171d7 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: stih-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: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent ca3cc03b
...@@ -313,10 +313,6 @@ static int stih_cec_probe(struct platform_device *pdev) ...@@ -313,10 +313,6 @@ static int stih_cec_probe(struct platform_device *pdev)
if (!cec) if (!cec)
return -ENOMEM; return -ENOMEM;
cec->notifier = cec_notifier_get(hdmi_dev);
if (!cec->notifier)
return -ENOMEM;
cec->dev = dev; cec->dev = dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
...@@ -340,30 +336,42 @@ static int stih_cec_probe(struct platform_device *pdev) ...@@ -340,30 +336,42 @@ static int stih_cec_probe(struct platform_device *pdev)
return PTR_ERR(cec->clk); return PTR_ERR(cec->clk);
} }
cec->adap = cec_allocate_adapter(&sti_cec_adap_ops, cec, cec->adap = cec_allocate_adapter(&sti_cec_adap_ops, cec, CEC_NAME,
CEC_NAME, CEC_CAP_DEFAULTS, CEC_MAX_LOG_ADDRS); CEC_CAP_DEFAULTS |
CEC_CAP_CONNECTOR_INFO,
CEC_MAX_LOG_ADDRS);
ret = PTR_ERR_OR_ZERO(cec->adap); ret = PTR_ERR_OR_ZERO(cec->adap);
if (ret) if (ret)
return ret; return ret;
ret = cec_register_adapter(cec->adap, &pdev->dev); cec->notifier = cec_notifier_cec_adap_register(hdmi_dev, NULL,
if (ret) { cec->adap);
cec_delete_adapter(cec->adap); if (!cec->notifier) {
return ret; ret = -ENOMEM;
goto err_delete_adapter;
} }
cec_register_cec_notifier(cec->adap, cec->notifier); ret = cec_register_adapter(cec->adap, &pdev->dev);
if (ret)
goto err_notifier;
platform_set_drvdata(pdev, cec); platform_set_drvdata(pdev, cec);
return 0; return 0;
err_notifier:
cec_notifier_cec_adap_unregister(cec->notifier);
err_delete_adapter:
cec_delete_adapter(cec->adap);
return ret;
} }
static int stih_cec_remove(struct platform_device *pdev) static int stih_cec_remove(struct platform_device *pdev)
{ {
struct stih_cec *cec = platform_get_drvdata(pdev); struct stih_cec *cec = platform_get_drvdata(pdev);
cec_notifier_cec_adap_unregister(cec->notifier);
cec_unregister_adapter(cec->adap); cec_unregister_adapter(cec->adap);
cec_notifier_put(cec->notifier);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment