Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2478287lqt; Mon, 22 Apr 2024 11:49:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUT6f0H9+rcnxa61+2HESvfgJ4rwK7noTC9qxVSL0D/c2+ESygsRJs1CtirTwVq0h7DHd62hz9NBJLOMp86sCuanjnLowvm94deVxzLyg== X-Google-Smtp-Source: AGHT+IEdb68R9iyKVohdStpAQZM4Atah2L3Oz4mfrV1v7wqHER8x2tvRPljfwXYJTU0O3RMQLx2l X-Received: by 2002:ae9:ec0b:0:b0:78d:601f:f955 with SMTP id h11-20020ae9ec0b000000b0078d601ff955mr11061669qkg.30.1713811765035; Mon, 22 Apr 2024 11:49:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713811765; cv=pass; d=google.com; s=arc-20160816; b=zyyNwyreIVV3H4+p1eTlzq6MhD7eU3iH90uSbrP381jmKnKrKOoYCdJ/bEIjT0q+cu vXjbbQGDS7F0hkGcZSrDjP/wXlj6AtW2+k8/MzwVN7n6WSArBXIFyazJC7rxx6loaOd3 OrcB/gJkd/WdWwV7yoBdnfYzXlH7ZgEZw7EeYrmZ69z4ilveO8LESwyMWVU7HuUhhFdt pD4PJJqZd8cpXFRgvn8ahuJACHbRh8SbYkJecXIrpv8ftsoN2kRKq9D4haYDEgykFLuI as/zbGjycxckgcb08sk/vDy2X67wvUni6w0oVsuZW3BUjcCOMkf1ugnNSsPLQls2ICQH gDvQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=+CogjN3acB3+vV+8SCv672LGBoCQduo6GilyAiW/HPs=; fh=NFKGmghyy/TSvnzoXgX9rMjnndbtusN4FE9pRXVIZkY=; b=TXFMGYs6N8wmmlUdGep5mEIoDtTf81Ud5suHYi4QyYxlcIBeg2nypebBJuyeFvOjpa TpkCe8Bm8H4D3ctN2r5ptwQTNDJm/ZrkLt0hOcFRVo0PyW074mK147OmTnOzAlXKi0KK fewY0Wg97rDP67TZF+eouG4cpyAiC9+cLcdDEGzfttgzhojwPcaTH6IFJsJHWoL2HFYO Ns/DfEiLj7sM0d5peYeoZjWj8zcfpGi0z6k9AdVNHSBJqk79YVk3QzauuXc6yNg3imSv awP9Ar19v1x7B4Vfrc5ORrfNZPpP9uRXBfaA4QDKo0JD7YChSzgEkvaNpg6RwJpFzbx1 k6Uw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=oDEq5oij; 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-153868-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153868-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g15-20020a05620a40cf00b0078be9dd4553si12362606qko.419.2024.04.22.11.49.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 11:49:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153868-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=oDEq5oij; 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-153868-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153868-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id BE59F1C20FF1 for ; Mon, 22 Apr 2024 18:49:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AAE3C156F3B; Mon, 22 Apr 2024 18:46:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="oDEq5oij" Received: from out-189.mta0.migadu.com (out-189.mta0.migadu.com [91.218.175.189]) (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 85B38156C78 for ; Mon, 22 Apr 2024 18:46:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713811586; cv=none; b=FvDwIbWONLBJu+E1axkO8tbtS816zwXiQfXYsVO1zU+OvWTblexVhOBBwq7N/+D7j3vHnYf7HwMaM05hcafnP79hG/953X+qx84gIMlHJnoefO9GGr7f9jRDPjbO0yIpr9qNnYLUhrRozbzeCj01dc7w5DqnSPtow3xyai7axFQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713811586; c=relaxed/simple; bh=wPxlB+PlQ9IUSDbuVoffC/E6mBAPrbVU/eGzWCQjAvU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BrXNF8xcLSI9eiQ1jsIFFHC5ZQ0z5+yLMQQcqnjG7kdCVzeG8zYpT3/ePP205Qecg0SoFr7vbQIryuQQMMkbuKAL8kUQnQuhoYC3vormY6Gjw3960tsy68jjMiRN7m6AZxo7Qw0yrr6VOw05fzDbhShIlBzQptUmv0gzxuj627s= 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=oDEq5oij; arc=none smtp.client-ip=91.218.175.189 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=1713811583; 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=+CogjN3acB3+vV+8SCv672LGBoCQduo6GilyAiW/HPs=; b=oDEq5oij1nflTfCpvhhL87tZlKoNxWgF2rqK3vmK/3jnT3IB2M8WebR2f6WlHDu8DV7Uv1 Yqsq35RUuwncVzbMV9fFee1Q3wE8k59xLoKcfzTxnvzLDuEDM2EyX97pJo0leKkh22RDjg iPUP/WywJlgmSEWlqd+CYwfAnZBcLYs= From: Sean Anderson To: Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org Cc: David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michal Simek , Sean Anderson Subject: [PATCH v3 12/13] drm: zynqmp_dp: Take dp->lock in zynqmp_dp_hpd_work_func Date: Mon, 22 Apr 2024 14:45:52 -0400 Message-Id: <20240422184553.3573009-13-sean.anderson@linux.dev> In-Reply-To: <20240422184553.3573009-1-sean.anderson@linux.dev> References: <20240422184553.3573009-1-sean.anderson@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 Add a non-locking version of zynqmp_dp_bridge_detect and use it in zynqmp_dp_hpd_work_func so we can take the lock explicitly. This will make it easier to check for hpd_ignore when we add debugfs support. Signed-off-by: Sean Anderson --- Changes in v3: - New drivers/gpu/drm/xlnx/zynqmp_dp.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c index 364caaf26f49..dea4b8a819fd 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -1552,14 +1552,13 @@ static int zynqmp_dp_bridge_atomic_check(struct drm_bridge *bridge, return 0; } -static enum drm_connector_status zynqmp_dp_bridge_detect(struct drm_bridge *bridge) +static enum drm_connector_status __zynqmp_dp_bridge_detect(struct zynqmp_dp *dp) { - struct zynqmp_dp *dp = bridge_to_dp(bridge); struct zynqmp_dp_link_config *link_config = &dp->link_config; u32 state, i; int ret; - mutex_lock(&dp->lock); + lockdep_assert_held(&dp->lock); /* * This is from heuristic. It takes some delay (ex, 100 ~ 500 msec) to @@ -1588,16 +1587,27 @@ static enum drm_connector_status zynqmp_dp_bridge_detect(struct drm_bridge *brid dp->num_lanes); dp->status = connector_status_connected; - mutex_unlock(&dp->lock); return connector_status_connected; } disconnected: dp->status = connector_status_disconnected; - mutex_unlock(&dp->lock); return connector_status_disconnected; } + +static enum drm_connector_status zynqmp_dp_bridge_detect(struct drm_bridge *bridge) +{ + struct zynqmp_dp *dp = bridge_to_dp(bridge); + enum drm_connector_status ret; + + mutex_lock(&dp->lock); + ret = __zynqmp_dp_bridge_detect(dp); + mutex_unlock(&dp->lock); + + return ret; +} + static struct edid *zynqmp_dp_bridge_get_edid(struct drm_bridge *bridge, struct drm_connector *connector) { @@ -1651,7 +1661,10 @@ static void zynqmp_dp_hpd_work_func(struct work_struct *work) struct zynqmp_dp *dp = container_of(work, struct zynqmp_dp, hpd_work); enum drm_connector_status status; - status = zynqmp_dp_bridge_detect(&dp->bridge); + mutex_lock(&dp->lock); + status = __zynqmp_dp_bridge_detect(dp); + mutex_unlock(&dp->lock); + drm_bridge_hpd_notify(&dp->bridge, status); } -- 2.35.1.1320.gc452695387.dirty