lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231114150130.497915-7-sui.jingfeng@linux.dev>
Date:   Tue, 14 Nov 2023 23:01:28 +0800
From:   Sui Jingfeng <sui.jingfeng@...ux.dev>
To:     Phong LE <ple@...libre.com>,
        Neil Armstrong <neil.armstrong@...aro.org>
Cc:     Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
        Maxime Ripard <mripard@...nel.org>,
        Thomas Zimmermann <tzimmermann@...e.de>,
        linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        Sui Jingfeng <suijingfeng@...ngson.cn>
Subject: [PATCH 6/8] drm/bridge: it66121: Add a helper to initialize the DRM bridge structure

From: Sui Jingfeng <suijingfeng@...ngson.cn>

Helps the it66121_probe() function to reduce weight, no functional change.

Signed-off-by: Sui Jingfeng <suijingfeng@...ngson.cn>
---
 drivers/gpu/drm/bridge/ite-it66121.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c
index f36d05331f25..2f7f00f1bedb 100644
--- a/drivers/gpu/drm/bridge/ite-it66121.c
+++ b/drivers/gpu/drm/bridge/ite-it66121.c
@@ -1004,6 +1004,21 @@ static const struct drm_bridge_funcs it66121_bridge_funcs = {
 	.hpd_disable = it66121_bridge_hpd_disable,
 };
 
+static void it66121_bridge_init_base(struct drm_bridge *bridge,
+				     struct device_node *of_node,
+				     bool hpd_support)
+{
+	bridge->funcs = &it66121_bridge_funcs;
+	bridge->type = DRM_MODE_CONNECTOR_HDMIA;
+	bridge->ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID;
+	if (hpd_support)
+		bridge->ops |= DRM_BRIDGE_OP_HPD;
+
+	bridge->of_node = of_node;
+
+	drm_bridge_add(bridge);
+}
+
 static irqreturn_t it66121_irq_threaded_handler(int irq, void *dev_id)
 {
 	int ret;
@@ -1637,11 +1652,6 @@ static int it66121_probe(struct i2c_client *client)
 	    ctx->device_id != ctx->info->pid)
 		return -ENODEV;
 
-	ctx->bridge.funcs = &it66121_bridge_funcs;
-	ctx->bridge.of_node = dev->of_node;
-	ctx->bridge.type = DRM_MODE_CONNECTOR_HDMIA;
-	ctx->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_HPD;
-
 	ret = devm_request_threaded_irq(dev, client->irq, NULL,	it66121_irq_threaded_handler,
 					IRQF_ONESHOT, dev_name(dev), ctx);
 	if (ret < 0) {
@@ -1649,9 +1659,9 @@ static int it66121_probe(struct i2c_client *client)
 		return ret;
 	}
 
-	it66121_audio_codec_init(ctx, dev);
+	it66121_bridge_init_base(&ctx->bridge, dev->of_node, true);
 
-	drm_bridge_add(&ctx->bridge);
+	it66121_audio_codec_init(ctx, dev);
 
 	dev_info(dev, "IT66121 probed, chip id: 0x%x:0x%x, revision: %u\n",
 		 ctx->vender_id, ctx->device_id, ctx->revision);
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ