From nobody Sun Feb 8 06:54:42 2026 Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED7A1156C4F for ; Fri, 3 May 2024 16:41:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714754496; cv=none; b=u/T0aHEm/pDG3DqL+9NHzxOfzmtYt/4OtBgCM4T1ZWqIOBnOiE1aHxZpWhU+SE1QLH4443gzuL/q1froon5LyTS9L1245jkLHrAnnW7v9Q46w3MFDLL5q+QW1gwh+0O6A7mYYvAIiZ79bzfESQApQB48JszqLiO0X/SvATnfR2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714754496; c=relaxed/simple; bh=HnaVgBqe9m8+G1f8WS8ykVxfLU1a8bkftOe8Stppbbg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AmAPf0Ma4GGl2avr5j1fIFM/1UPQ2jOXylLylyvvRVpsDIX6xsBbbWob9W0e9cKiqz2sKJ0FPtDY6P1L01JPs7iwKIyjuq3M/BXTCwYOJ6XEaHyyzwfqSy1K13s7kgd1LWXiS6lguw496ohoMg8BlIVKRRTCcedg3EhkoMTG3EY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=OD7/09iq; arc=none smtp.client-ip=95.215.58.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="OD7/09iq" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714754493; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RwBGzApFewAP1R1hUA1C3ehCFcGWcTVW40ujUMpzuS4=; b=OD7/09iqlp+lq7/G60IBN4bu/UCFSvxHUn17exg+h7y0Ji5UE31gkhqQ463anTHGqEjVOX BId+qsybxqsSOQKgZaz1cA0QenFbSd7cHvidsQXuiSRauNgkWOc/QKgvv60zQzy+ojPGI9 akvuAYNGDWMEYgDQy/nXiY7+fBU+to0= From: Sui Jingfeng To: Andrzej Hajda Cc: Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng Subject: [PATCH v5 03/10] drm/bridge: simple-bridge: Use fwnode APIs to acquire device properties Date: Sat, 4 May 2024 00:40:59 +0800 Message-Id: <20240503164106.1172650-4-sui.jingfeng@linux.dev> In-Reply-To: <20240503164106.1172650-1-sui.jingfeng@linux.dev> References: <20240503164106.1172650-1-sui.jingfeng@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Make this driver less DT-dependent by calling the newly created helpers, also switch to use fwnode APIs to acquire additional device properties. A side benifit is that boilerplates get reduced, no functional changes for DT-based systems. Signed-off-by: Sui Jingfeng --- drivers/gpu/drm/bridge/simple-bridge.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/simple-bridge.c b/drivers/gpu/drm/bridg= e/simple-bridge.c index 5813a2c4fc5e..865ddd38f371 100644 --- a/drivers/gpu/drm/bridge/simple-bridge.c +++ b/drivers/gpu/drm/bridge/simple-bridge.c @@ -8,8 +8,6 @@ =20 #include #include -#include -#include #include #include =20 @@ -169,33 +167,32 @@ static const struct drm_bridge_funcs simple_bridge_br= idge_funcs =3D { =20 static int simple_bridge_probe(struct platform_device *pdev) { + struct fwnode_handle *fwnode =3D dev_fwnode(&pdev->dev); struct simple_bridge *sbridge; - struct device_node *remote; + int ret; =20 sbridge =3D devm_kzalloc(&pdev->dev, sizeof(*sbridge), GFP_KERNEL); if (!sbridge) return -ENOMEM; platform_set_drvdata(pdev, sbridge); =20 - sbridge->info =3D of_device_get_match_data(&pdev->dev); + sbridge->info =3D device_get_match_data(&pdev->dev); =20 /* Get the next bridge in the pipeline. */ - remote =3D of_graph_get_remote_node(pdev->dev.of_node, 1, -1); - if (!remote) - return -EINVAL; - - sbridge->next_bridge =3D of_drm_find_bridge(remote); - of_node_put(remote); - + sbridge->next_bridge =3D drm_bridge_find_next_bridge_by_fwnode(fwnode, 1); if (!sbridge->next_bridge) { dev_dbg(&pdev->dev, "Next bridge not found, deferring probe\n"); return -EPROBE_DEFER; + } else if (IS_ERR(sbridge->next_bridge)) { + ret =3D PTR_ERR(sbridge->next_bridge); + dev_err(&pdev->dev, "Error on finding the next bridge: %d\n", ret); + return ret; } =20 /* Get the regulator and GPIO resources. */ sbridge->vdd =3D devm_regulator_get_optional(&pdev->dev, "vdd"); if (IS_ERR(sbridge->vdd)) { - int ret =3D PTR_ERR(sbridge->vdd); + ret =3D PTR_ERR(sbridge->vdd); if (ret =3D=3D -EPROBE_DEFER) return -EPROBE_DEFER; sbridge->vdd =3D NULL; @@ -209,8 +206,8 @@ static int simple_bridge_probe(struct platform_device *= pdev) "Unable to retrieve enable GPIO\n"); =20 /* Register the bridge. */ + drm_bridge_set_node(&sbridge->bridge, fwnode); sbridge->bridge.funcs =3D &simple_bridge_bridge_funcs; - sbridge->bridge.of_node =3D pdev->dev.of_node; sbridge->bridge.timings =3D sbridge->info->timings; =20 drm_bridge_add(&sbridge->bridge); --=20 2.34.1