Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp3105908lqt; Tue, 23 Apr 2024 10:23:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXysjcvscQyrTVG7iW7cYM/xsdT+yXcbUMZy2VGTsD28IHLgQa5V3m2g7ZkAs4pj9LjjnMdP0sWGVSrO7AdqQd9tYfoMMZLkgbC86WeLQ== X-Google-Smtp-Source: AGHT+IFSBwm9vtthZigtpw4qwrB+vR4kMF3JDygO+o6dwqZyePlIeTR/0WI95Sscgch9ULoRnZIC X-Received: by 2002:a05:6a21:999d:b0:1a9:5a2a:7e37 with SMTP id ve29-20020a056a21999d00b001a95a2a7e37mr18054407pzb.56.1713892996980; Tue, 23 Apr 2024 10:23:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713892996; cv=pass; d=google.com; s=arc-20160816; b=R52VRDRYyN1skwrT0IkQ+cAz0marfiD+zeJDY5JwR7glsTFJk7ujYIPh41l2pwE406 Q4BXrRZKE2vcnMga1+LOzlD6LPpijg7eAa3uItD6FmtvWn//EkWOicwbYx9MmyCiOleF RwcaEOfvkpO1rQrUgCHzpqltcVkonFFp80lWqwgR1Cr5ALhtBzRMKET5sTigFrRrnUjO +a1KViVmW/VLVYnujNEk4+BXoC1eiCavqNCSS9qhcQ/w3yQISZwwE0BMkd0y7eD0jh6F 65PkF8Ivql23zg9gYEg29aYYjUoQ3Dh2wujYlNB8SkRnfJxZrjOSdBFfYFOAB81Vu6b5 XzsA== 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=CU8WVgLiJfT+zG1g0Gek4Quem8lI6e2UFlwZo7xAnnk=; fh=y/ZWbFXBmP32xuuB2aPYQ037wxAyEGcK3dXjHSf7t2w=; b=pnK7jmkdPEKftnuwtz2QnczoQgo25GmqJmWfmeL6OhLmGggg5SIm6vvt0VYdBdWOo2 DxbWb08LlL+XCupk1ZsRO1nZhWEEyaYmuagj3Rfm/P7qYHimCSznrkE/oiNAX1uGP6Jk k+Td5i0UDApyAZg/wYGOSKCJHLZQrnQi7m1TS49HwvU8p/rSWoSmOjDb1HeWXOQ2oQwP ZR9hTcmeyyFijAy0pIp6lv9IrfhFZwkx/AiGBO0rd4oqOcekJprvotQtgeOZhAsCCdeC szVYsKOTVLnThefvVnF4EBuCOuTZHhXS6A/36+cizqpvSedebUjxeUVlZTaCIR+nC8f0 y1iA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=K94Q1JsR; 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-155661-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155661-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. [139.178.88.99]) by mx.google.com with ESMTPS id n1-20020a638f01000000b005dbd4cf445csi9541512pgd.35.2024.04.23.10.23.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 10:23:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155661-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=K94Q1JsR; 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-155661-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155661-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 0907B283DEF for ; Tue, 23 Apr 2024 17:21:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 028B613E03B; Tue, 23 Apr 2024 17:19:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="K94Q1JsR" Received: from out-180.mta0.migadu.com (out-180.mta0.migadu.com [91.218.175.180]) (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 B3F391428E6 for ; Tue, 23 Apr 2024 17:19:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713892778; cv=none; b=X0yzexacEWFYo17E0W1eZoDhIfq/s3WofRcA6vKsxLJ3UC+BtPne5coKcFz2ImoZrXDWauCLuw4OKyuUCVInPDSG4m1h3soJ0DD/oUs/RQlsFEvtpcnVNhjUq2sMKtjaTcV2yJpkRUMPJzO374yUrXGnzXaBMqgLTdi1z+zvGPg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713892778; c=relaxed/simple; bh=14sT4ve1hf4VA7R7SLYTcJV6hUvEdx6n6tiFakm+v5Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=a6Ih54HDzdnm17I9EUupxpMwJj6J4ht/H4HtLK87bilUYhIGjJT9NUZ7KeFGyIa5PmuqymE3787julxVZfg+oU9lPmchs2jsD4JNo627lPEPSIcYEK4l6IkwrAOVWBK7JW7uio7oOHGOvGOhnSqYJJurYjfsgCDPFX461ikSFYY= 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=K94Q1JsR; arc=none smtp.client-ip=91.218.175.180 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=1713892774; 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=CU8WVgLiJfT+zG1g0Gek4Quem8lI6e2UFlwZo7xAnnk=; b=K94Q1JsRsc16CDjbMOTGnJO/IDJukNvHLRVShoEAsPAwDvZYPLTBSFaqNmTrbNDbj1IPaR v+t+dAoVutySLiYRAl2mq6dKi0Wwfp8Ii9Zg2hVkZVLYYd4hdrdo2eeEJ8clz/Hy1OyDYY Gzgz92WydoYjW2lQgNu9HQAdrFbG7tY= From: Sean Anderson To: Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , dri-devel@lists.freedesktop.org Cc: Daniel Vetter , linux-arm-kernel@lists.infradead.org, Michal Simek , linux-kernel@vger.kernel.org, David Airlie , Tomi Valkeinen , Sean Anderson Subject: [PATCH v4 12/13] drm: zynqmp_dp: Take dp->lock in zynqmp_dp_hpd_work_func Date: Tue, 23 Apr 2024 13:18:58 -0400 Message-Id: <20240423171859.3953024-13-sean.anderson@linux.dev> In-Reply-To: <20240423171859.3953024-1-sean.anderson@linux.dev> References: <20240423171859.3953024-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 --- (no changes since v3) Changes in v3: - New drivers/gpu/drm/xlnx/zynqmp_dp.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c index d5ee165046f8..fe002fef4662 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,26 @@ 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 const struct drm_edid *zynqmp_dp_bridge_edid_read(struct drm_bridge *bridge, struct drm_connector *connector) { @@ -1651,7 +1660,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