Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1126293lqo; Sat, 11 May 2024 08:22:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJY4j6KMoV7Qkq2xjPaXFlm00I64ejD8KKhblKKcp9VbNCIAU2NytTAhV5BgfJ4m69tHQzcgH2EZ4fbUO9oWlZTfYT5AfSH7Hg7FJDhQ== X-Google-Smtp-Source: AGHT+IFX40BjdgBWM/L4jTsbGc1mZYwNqADUxgQOmGTQsuksamhJKsldNRypGCdvT0obXJ+3blxP X-Received: by 2002:a05:6e02:19cc:b0:36c:7bdb:c85c with SMTP id e9e14a558f8ab-36cc144e951mr74788895ab.10.1715440963051; Sat, 11 May 2024 08:22:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715440963; cv=pass; d=google.com; s=arc-20160816; b=qb2ZmaQFlRDY1ddKojCIBgypFMykkadNa6PVLYndd1u3oMyuAb+lKRP3d46/Dv2mrO X2KOB4dqz+cZPsLzfpI6fbJck3lafGSWw+pYywadY6q5Xzt16qVlhXBCtvVHekMmceRq 7mZByQfkJ8E2uA6KmiwHRbNKdBrUpgfGveqZok/29NBiEVZkYNAJnFE1Q3F15hV/gXLj pQzH0xO6W7czji65efvG/gAQf/tUvU1OkXbvi2KPQ0gDT2p1FJKbZ77WsuX68XEFqBqb HS0+552hkq21+VjjVseaGghbWwN/GrJAgj9UiLNJ6T+yXiy9DLPFsU/xGZowcaWhSGfq Ch9Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=Zn+NlbHxeYSvVqfREiTXaRsBKPDscSLweHWMfpzNE2s=; fh=5QMhP8DqRB2YZbuRcAnXSgbYm+5QpF2ZZyrE0eAxJYE=; b=mAgs/T5m2YjbC4QSHhlc/8vL5VWzC74T56DUx3uUYNR2NBJMEqaSM0th8xdLLBezDB MngNag43wwU6bLXpccCul0F6VDYKc+j0w6JMEHHW5fNTmSG/cKgWr+fK8FjOU7DTWywX XanYTAG+LWBAC+o5k67KOnzgAslfDadlnM/lUz2SZAxOItPFmWdX0pjU4yFHTFoTQI7H 8ir17gUZCONdoDydMpxJ92FohnSqs/H65GJmCTyaTpKZWs6zoAu/uc88qB4xJwE+o4eM CmU8y0j8EhVCxwhMhj7aTJlOUj0h/8c/cgxQ+jpM7cld9CJtEUudw4gpgEUeKc0VFCxL 2d3Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=eDfeM7Z1; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-176600-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176600-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6341153064asi5900450a12.460.2024.05.11.08.22.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 08:22:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176600-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=eDfeM7Z1; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-176600-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176600-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A2CFB281FA0 for ; Sat, 11 May 2024 15:22:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A6D1D5646D; Sat, 11 May 2024 15:22:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="eDfeM7Z1" Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (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 A929E5336F for ; Sat, 11 May 2024 15:22:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715440955; cv=none; b=DyznvbvBvym5wHVT+fQFONdPZmbHHK3TOksxXiE2FMSvGVmQQ6nfgvMEzrViPNLi3+DhUFB9McWjlxKjXxYAzwwAaGwScpfAoZXWvlnnbJ+qKmdmZynpEZ5QQBrFcOklQW+vX4bLD52/awjMiqHArQJjQpTzdCz6zkUpAb0+XS4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715440955; c=relaxed/simple; bh=z3sBI8ia7gDjInnl0n+PFQCHcogcgMw0G2fChr1g/A4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=I7wgpsUcuuJts7VqUTdD2n7Uurt4DE8fZBOmIwXX6ddzs9BPv5z3iqj3wV44AGojirASeWHxL/ggjHDWyA53Z/iTuA0mupj83Fl29wA03Pc0IRBEcwcQawhIvd9YIB47xx+JdnicK/Pn7/VK0DHJQgXr+JRNhU3rU+5cTa6diYU= 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=eDfeM7Z1; arc=none smtp.client-ip=91.218.175.182 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 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=1715440950; 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; bh=Zn+NlbHxeYSvVqfREiTXaRsBKPDscSLweHWMfpzNE2s=; b=eDfeM7Z1XlXSmGLgTTbhpV5YcWNR8K2J6fTuLToaCwIZwVFuqHtnz9zXRVTeyh9+EwdSjb HsTHaWWZ6CwhzmfpJq5TNmB6QJpQQ+vA/jZzNBIaHCrm2ipoNY4UJ/WE385GQjgiQRdoOf nw5krkp9PGBQVReHI8OdjPfwMGpZiYk= From: Sui Jingfeng To: Kieran Bingham , Biju Das , Alicja Michalska , Chen-Yu Tsai Cc: Hsin-Yi Wang , Maxime Ripard , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng Subject: [PATCH] drm/bridge: analogix: Remove redundant checks on existence of bridge->encoder Date: Sat, 11 May 2024 23:22:22 +0800 Message-ID: <20240511152222.328167-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: 8bit X-Migadu-Flow: FLOW_OUT The check on the existence of bridge->encoder on the implementation layer of drm bridge driver is not necessary, as it has already been done in the drm_bridge_attach() function. It is guaranteed that the .encoder member of the drm_bridge instance is not NULL when various anxxxx_bridge_attach() function gets called. And .atomic_enable() of struct drm_bridge_funcs shouldn't be able to called before the various is acctached. Remove the redundant checking codes "if (!bridge->encoder) { ... }". Signed-off-by: Sui Jingfeng --- drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 5 ----- drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 5 ----- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 5 ----- drivers/gpu/drm/bridge/analogix/anx7625.c | 10 ---------- 4 files changed, 25 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c index c9e35731e6a1..cfe43d2ca3be 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c @@ -528,11 +528,6 @@ static int anx6345_bridge_attach(struct drm_bridge *bridge, return -EINVAL; } - if (!bridge->encoder) { - DRM_ERROR("Parent encoder object not found"); - return -ENODEV; - } - /* Register aux channel */ anx6345->aux.name = "DP-AUX"; anx6345->aux.dev = &anx6345->client->dev; diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c index 5748a8581af4..58875dde496f 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c @@ -897,11 +897,6 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge, return -EINVAL; } - if (!bridge->encoder) { - DRM_ERROR("Parent encoder object not found"); - return -ENODEV; - } - /* Register aux channel */ anx78xx->aux.name = "DP-AUX"; anx78xx->aux.dev = &anx78xx->client->dev; diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index df9370e0ff23..7b841232321f 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1228,11 +1228,6 @@ static int analogix_dp_bridge_attach(struct drm_bridge *bridge, return -EINVAL; } - if (!bridge->encoder) { - DRM_ERROR("Parent encoder object not found"); - return -ENODEV; - } - if (!dp->plat_data->skip_connector) { connector = &dp->connector; connector->polled = DRM_CONNECTOR_POLL_HPD; diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 59e9ad349969..3d09efa4199c 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -2193,11 +2193,6 @@ static int anx7625_bridge_attach(struct drm_bridge *bridge, if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) return -EINVAL; - if (!bridge->encoder) { - DRM_DEV_ERROR(dev, "Parent encoder object not found"); - return -ENODEV; - } - ctx->aux.drm_dev = bridge->dev; err = drm_dp_aux_register(&ctx->aux); if (err) { @@ -2435,11 +2430,6 @@ static void anx7625_bridge_atomic_enable(struct drm_bridge *bridge, dev_dbg(dev, "drm atomic enable\n"); - if (!bridge->encoder) { - dev_err(dev, "Parent encoder object not found"); - return; - } - connector = drm_atomic_get_new_connector_for_encoder(state->base.state, bridge->encoder); if (!connector) -- 2.43.0