All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: Neil Armstrong <narmstrong@baylibre.com>,
	Sylwester Nawrocki <snawrocki@kernel.org>,
	Benjamin Gaignard <benjamin.gaignard@linaro.org>,
	Thierry Reding <treding@nvidia.com>,
	Ettore Chimenti <ek5.chimenti@gmail.com>,
	Wen Yang <wen.yang99@zte.com.cn>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>
Subject: [PATCH 5/7] tegra_cec: use new cec_notifier_find_hdmi_dev helper
Date: Mon,  8 Apr 2019 13:03:59 +0200	[thread overview]
Message-ID: <20190408110401.3345-6-hverkuil-cisco@xs4all.nl> (raw)
In-Reply-To: <20190408110401.3345-1-hverkuil-cisco@xs4all.nl>

The Tegra 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>
---
 drivers/media/platform/tegra-cec/tegra_cec.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/media/platform/tegra-cec/tegra_cec.c b/drivers/media/platform/tegra-cec/tegra_cec.c
index aba488cd0e64..074d647f2908 100644
--- a/drivers/media/platform/tegra-cec/tegra_cec.c
+++ b/drivers/media/platform/tegra-cec/tegra_cec.c
@@ -327,21 +327,15 @@ static const struct cec_adap_ops tegra_cec_ops = {
 
 static int tegra_cec_probe(struct platform_device *pdev)
 {
-	struct platform_device *hdmi_dev;
-	struct device_node *np;
+	struct device *hdmi_dev;
 	struct tegra_cec *cec;
 	struct resource *res;
 	int ret = 0;
 
-	np = of_parse_phandle(pdev->dev.of_node, "hdmi-phandle", 0);
+	hdmi_dev = cec_notifier_find_hdmi_dev(&pdev->dev);
 
-	if (!np) {
-		dev_err(&pdev->dev, "Failed to find hdmi node in device tree\n");
+	if (!hdmi_dev)
 		return -ENODEV;
-	}
-	hdmi_dev = of_find_device_by_node(np);
-	if (hdmi_dev == NULL)
-		return -EPROBE_DEFER;
 
 	cec = devm_kzalloc(&pdev->dev, sizeof(struct tegra_cec), GFP_KERNEL);
 
@@ -400,7 +394,7 @@ static int tegra_cec_probe(struct platform_device *pdev)
 		goto clk_error;
 	}
 
-	cec->notifier = cec_notifier_get(&hdmi_dev->dev);
+	cec->notifier = cec_notifier_get(hdmi_dev);
 	if (!cec->notifier) {
 		ret = -ENOMEM;
 		goto clk_error;
-- 
2.20.1


  parent reply	other threads:[~2019-04-08 11:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-08 11:03 [PATCH 0/7] cec: introduce cec_notifier_find_hdmi_dev helper Hans Verkuil
2019-04-08 11:03 ` [PATCH 1/7] cec-notifier: add " Hans Verkuil
2019-04-08 13:09   ` Thierry Reding
2019-04-08 13:17     ` Hans Verkuil
2019-04-08 11:03 ` [PATCH 2/7] meson: ao-cec: use new " Hans Verkuil
2019-04-08 12:01   ` Neil Armstrong
2019-04-08 11:03 ` [PATCH 3/7] s5p_cec: " Hans Verkuil
2019-04-08 11:03 ` [PATCH 4/7] stih_cec: " Hans Verkuil
2019-04-08 12:44   ` Benjamin Gaignard
2019-04-08 11:03 ` Hans Verkuil [this message]
2019-04-08 11:04 ` [PATCH 6/7] seco-cec: decrement HDMI device refcount Hans Verkuil
2019-04-08 13:21   ` Ettore Chimenti
2019-04-08 11:04 ` [PATCH 7/7] cros-ec-cec: " Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190408110401.3345-6-hverkuil-cisco@xs4all.nl \
    --to=hverkuil-cisco@xs4all.nl \
    --cc=benjamin.gaignard@linaro.org \
    --cc=ek5.chimenti@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=narmstrong@baylibre.com \
    --cc=snawrocki@kernel.org \
    --cc=treding@nvidia.com \
    --cc=wen.yang99@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.