diff options
author | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2019-04-10 12:13:29 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-04-22 20:10:52 +0300 |
commit | 6bc37729df640748ed1718e3f150d63cbff1dc7e (patch) | |
tree | 8c3d01339b725bc641ab43eb41902460671df620 /drivers/media/platform/meson/ao-cec.c | |
parent | fbbd403b3286b4467f8b755efa0f10819cef9bba (diff) | |
download | linux-6bc37729df640748ed1718e3f150d63cbff1dc7e.tar.xz |
media: meson: ao-cec: use new cec_notifier_parse_hdmi_phandle helper
The meson CEC driver increased the HDMI device refcount when
it shouldn't. Use the new helper function to ensure that that
doesn't happen and to simplify the driver code.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform/meson/ao-cec.c')
-rw-r--r-- | drivers/media/platform/meson/ao-cec.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/media/platform/meson/ao-cec.c b/drivers/media/platform/meson/ao-cec.c index cd4be38ab5ac..facf9b029e79 100644 --- a/drivers/media/platform/meson/ao-cec.c +++ b/drivers/media/platform/meson/ao-cec.c @@ -601,20 +601,14 @@ static const struct cec_adap_ops meson_ao_cec_ops = { static int meson_ao_cec_probe(struct platform_device *pdev) { struct meson_ao_cec_device *ao_cec; - struct platform_device *hdmi_dev; - struct device_node *np; + struct device *hdmi_dev; struct resource *res; int ret, irq; - np = of_parse_phandle(pdev->dev.of_node, "hdmi-phandle", 0); - if (!np) { - dev_err(&pdev->dev, "Failed to find hdmi node\n"); - return -ENODEV; - } + hdmi_dev = cec_notifier_parse_hdmi_phandle(&pdev->dev); - hdmi_dev = of_find_device_by_node(np); - if (hdmi_dev == NULL) - return -EPROBE_DEFER; + if (IS_ERR(hdmi_dev)) + return PTR_ERR(hdmi_dev); ao_cec = devm_kzalloc(&pdev->dev, sizeof(*ao_cec), GFP_KERNEL); if (!ao_cec) @@ -622,7 +616,7 @@ static int meson_ao_cec_probe(struct platform_device *pdev) spin_lock_init(&ao_cec->cec_reg_lock); - ao_cec->notify = cec_notifier_get(&hdmi_dev->dev); + ao_cec->notify = cec_notifier_get(hdmi_dev); if (!ao_cec->notify) return -ENOMEM; |