From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2A21B23A98C; Thu, 3 Apr 2025 19:19:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743707975; cv=none; b=TSfwt3HDBOi4yJZAJSjJpVcR+XYUc2/8tcaSed+UCVB8R24XUmTzeOizZ7tJIFRTE4PeozswHWeF01Iq4ncdaQYwGbV2JQfpG1efUq/XRHBQyqL0oRL/DtIHepffV29HJu0u+S+6MSuxik706l5YhLebXAXJTlKpMMx0AQsHRXE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743707975; c=relaxed/simple; bh=Aukq3tmQCLJmA1gdRb8cjrzyv0lX691slKjdUWkiyqo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sK4p1q7h4RTM4IDyS31ZMa91ySkTgvz/b6Ai3cWfZku9bakwd+5AXGHJzAyzxk1KC7ICz74UjQTVPHKUBpvvwdSon+Qd6WwF/wrJISc7HKimerd7R4/B77/MqkccR41fSFP0lyWaNAA+p+6EqPZqUY/GQuDH6h28SqceuFCdjko= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MOw29Imm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MOw29Imm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A40DBC4CEE3; Thu, 3 Apr 2025 19:19:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743707975; bh=Aukq3tmQCLJmA1gdRb8cjrzyv0lX691slKjdUWkiyqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MOw29Imm1PZjPBrONBcENM1gL/ls29M2ilwzx4KLNkVIaFfD+H4LQ+u/69Ckpbfqv Xv123dkxYtB3cAtIdHkOVNo9GXc2rAPMFO7g017hfybo0UNxm83N1BVx3lbBdjFJyP iW6QOQucWyuFEViGK4qra87caym+O6MUHx0M/PBkrVUnSxCV9x4CFeGiWeTxXspXYh eJAnX4+G0hfetn/yECKmLYnhEKAYnw/ZGLc/SJVNraX+nUzyC2JPhd1yg8KJFwIy2H GSqa0QEwQaAHFAajNzbCSbU05g+L45bf5muw+taBS/T+zJBAh9Ac2AjDtmlb3TQOtr Ipno7tkOvP/3g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Luca Ceresoli , Dmitry Baryshkov , Robert Foss , Sasha Levin , neil.armstrong@linaro.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.1 08/20] drm/bridge: panel: forbid initializing a panel with unknown connector type Date: Thu, 3 Apr 2025 15:19:01 -0400 Message-Id: <20250403191913.2681831-8-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250403191913.2681831-1-sashal@kernel.org> References: <20250403191913.2681831-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.132 Content-Transfer-Encoding: 8bit From: Luca Ceresoli [ Upstream commit b296955b3a740ecc8b3b08e34fd64f1ceabb8fb4 ] Having an DRM_MODE_CONNECTOR_Unknown connector type is considered bad, and drm_panel_bridge_add_typed() and derivatives are deprecated for this. drm_panel_init() won't prevent initializing a panel with a DRM_MODE_CONNECTOR_Unknown connector type. Luckily there are no in-tree users doing it, so take this as an opportinuty to document a valid connector type must be passed. Returning an error if this rule is violated is not possible because drm_panel_init() is a void function. Add at least a warning to make any violations noticeable, especially to non-upstream drivers. Reviewed-by: Dmitry Baryshkov Signed-off-by: Luca Ceresoli Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20250214-drm-assorted-cleanups-v7-5-88ca5827d7af@bootlin.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/drm_panel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index 7fd3de89ed079..acd29b4f43f84 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -49,7 +49,7 @@ static LIST_HEAD(panel_list); * @dev: parent device of the panel * @funcs: panel operations * @connector_type: the connector type (DRM_MODE_CONNECTOR_*) corresponding to - * the panel interface + * the panel interface (must NOT be DRM_MODE_CONNECTOR_Unknown) * * Initialize the panel structure for subsequent registration with * drm_panel_add(). @@ -57,6 +57,9 @@ static LIST_HEAD(panel_list); void drm_panel_init(struct drm_panel *panel, struct device *dev, const struct drm_panel_funcs *funcs, int connector_type) { + if (connector_type == DRM_MODE_CONNECTOR_Unknown) + DRM_WARN("%s: %s: a valid connector type is required!\n", __func__, dev_name(dev)); + INIT_LIST_HEAD(&panel->list); panel->dev = dev; panel->funcs = funcs; -- 2.39.5