Devicetree
 help / color / mirror / Atom feed
From: Marc Gonzalez <mgonzalez@freebox.fr>
To: Andrzej Hajda <andrzej.hajda@intel.com>,
	 Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>,
	 Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	 Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	 Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	 David Airlie <airlied@gmail.com>,
	Daniel Vetter <daniel@ffwll.ch>,
	 Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,  Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	 Arnaud Vrac <avrac@freebox.fr>,
	Pierre-Hugues Husson <phhusson@freebox.fr>,
	 Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	 Marc Gonzalez <mgonzalez@freebox.fr>
Subject: [PATCH 2/4] drm: bridge: simple-bridge: use dev pointer in probe
Date: Mon, 17 Jun 2024 18:03:00 +0200	[thread overview]
Message-ID: <20240617-tdp158-v1-2-df98ef7dec6d@freebox.fr> (raw)
In-Reply-To: <20240617-tdp158-v1-0-df98ef7dec6d@freebox.fr>

Prepare to factorize probe function.

Signed-off-by: Marc Gonzalez <mgonzalez@freebox.fr>
---
 drivers/gpu/drm/bridge/simple-bridge.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/bridge/simple-bridge.c b/drivers/gpu/drm/bridge/simple-bridge.c
index 5813a2c4fc5ee..d672e34970e18 100644
--- a/drivers/gpu/drm/bridge/simple-bridge.c
+++ b/drivers/gpu/drm/bridge/simple-bridge.c
@@ -169,18 +169,19 @@ static const struct drm_bridge_funcs simple_bridge_bridge_funcs = {
 
 static int simple_bridge_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
 	struct simple_bridge *sbridge;
 	struct device_node *remote;
 
-	sbridge = devm_kzalloc(&pdev->dev, sizeof(*sbridge), GFP_KERNEL);
+	sbridge = devm_kzalloc(dev, sizeof(*sbridge), GFP_KERNEL);
 	if (!sbridge)
 		return -ENOMEM;
 	platform_set_drvdata(pdev, sbridge);
 
-	sbridge->info = of_device_get_match_data(&pdev->dev);
+	sbridge->info = of_device_get_match_data(dev);
 
 	/* Get the next bridge in the pipeline. */
-	remote = of_graph_get_remote_node(pdev->dev.of_node, 1, -1);
+	remote = of_graph_get_remote_node(dev->of_node, 1, -1);
 	if (!remote)
 		return -EINVAL;
 
@@ -188,29 +189,29 @@ static int simple_bridge_probe(struct platform_device *pdev)
 	of_node_put(remote);
 
 	if (!sbridge->next_bridge) {
-		dev_dbg(&pdev->dev, "Next bridge not found, deferring probe\n");
+		dev_dbg(dev, "Next bridge not found, deferring probe\n");
 		return -EPROBE_DEFER;
 	}
 
 	/* Get the regulator and GPIO resources. */
-	sbridge->vdd = devm_regulator_get_optional(&pdev->dev, "vdd");
+	sbridge->vdd = devm_regulator_get_optional(dev, "vdd");
 	if (IS_ERR(sbridge->vdd)) {
 		int ret = PTR_ERR(sbridge->vdd);
 		if (ret == -EPROBE_DEFER)
 			return -EPROBE_DEFER;
 		sbridge->vdd = NULL;
-		dev_dbg(&pdev->dev, "No vdd regulator found: %d\n", ret);
+		dev_dbg(dev, "No vdd regulator found: %d\n", ret);
 	}
 
-	sbridge->enable = devm_gpiod_get_optional(&pdev->dev, "enable",
+	sbridge->enable = devm_gpiod_get_optional(dev, "enable",
 						  GPIOD_OUT_LOW);
 	if (IS_ERR(sbridge->enable))
-		return dev_err_probe(&pdev->dev, PTR_ERR(sbridge->enable),
+		return dev_err_probe(dev, PTR_ERR(sbridge->enable),
 				     "Unable to retrieve enable GPIO\n");
 
 	/* Register the bridge. */
 	sbridge->bridge.funcs = &simple_bridge_bridge_funcs;
-	sbridge->bridge.of_node = pdev->dev.of_node;
+	sbridge->bridge.of_node = dev->of_node;
 	sbridge->bridge.timings = sbridge->info->timings;
 
 	drm_bridge_add(&sbridge->bridge);

-- 
2.34.1


  parent reply	other threads:[~2024-06-17 16:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-17 16:02 [PATCH 0/4] Basic support for TI TDP158 Marc Gonzalez
2024-06-17 16:02 ` [PATCH 1/4] dt-bindings: display: simple-bridge: add ti,tdp158 Marc Gonzalez
2024-06-17 16:18   ` Conor Dooley
2024-06-17 19:37   ` Dmitry Baryshkov
2024-06-18  8:15     ` Maxime Ripard
2024-06-17 16:03 ` Marc Gonzalez [this message]
2024-06-17 19:53   ` [PATCH 2/4] drm: bridge: simple-bridge: use dev pointer in probe Dmitry Baryshkov
2024-06-18  8:16   ` Maxime Ripard
2024-06-17 16:03 ` [PATCH 3/4] drm: bridge: simple-bridge: use only devm* " Marc Gonzalez
2024-06-17 22:28   ` Dmitry Baryshkov
2024-06-18 11:37     ` Marc Gonzalez
2024-06-18 17:24       ` Dmitry Baryshkov
2024-06-17 16:03 ` [PATCH 4/4] drm: bridge: simple-bridge: add tdp158 support Marc Gonzalez
2024-06-17 22:33   ` Dmitry Baryshkov
2024-06-18 11:48     ` Marc Gonzalez
2024-06-18 17:25       ` Dmitry Baryshkov
2024-06-18 13:07 ` [PATCH 0/4] Basic support for TI TDP158 Marc Gonzalez
2024-06-18 14:36   ` Maxime Ripard
2024-06-18 16:17     ` Marc Gonzalez

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=20240617-tdp158-v1-2-df98ef7dec6d@freebox.fr \
    --to=mgonzalez@freebox.fr \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=avrac@freebox.fr \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=phhusson@freebox.fr \
    --cc=rfoss@kernel.org \
    --cc=robh@kernel.org \
    --cc=tzimmermann@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox