Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1613419ybi; Wed, 17 Jul 2019 18:45:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlLN1Hhfoy2fzWIl4BX2vGutdn4J66+QotcLD3fjF7JoYhnjqX66CPtujyH0gPLWkW78hb X-Received: by 2002:a17:902:744c:: with SMTP id e12mr46767509plt.287.1563414320812; Wed, 17 Jul 2019 18:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563414320; cv=none; d=google.com; s=arc-20160816; b=a/6Als2mlX/w/hnPGuZtAzP+nL/4huGVj5vaVtztCVxS2VrIRYuKev2MEywagSqrGQ mVmmblFjnHBg2JOgcvxI5nSNMAMQx7nGD1V9p5MS31bLGl4N3NW9uC9KMi1Ox+IDdDeZ UlILrMi58547GFZjJVo+1yISmnWLrW7yeLbndpg9K0qfeeEm5vO56KN2896gOxDJO3TD tQQ6+EeNHybo+bp0LlJwjWQk7047NkaFHX0hwcWmmGfvgGWB/F4ucBuecm4ZGRg7GVXn 0QM2RfNOdHhRrg0I2U+/eKHDPMTrs8C2rbVR1kFrxnXhkbBj03pIF7ohgs7MLZUErDjk 8MbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=qhFv765sKkDuyHMQlDLCPaNGn7yqAwGTLL5XXQSKBnE=; b=KPoVePz9ZgpJou8rruQFn3c5ooJUbyWJ807iJ+2ZKxwiZzSStZEESakIIJm0WhmBNa kAWbFFLcWPtfzgFxxbx8cla9Vu5Y3dljfws7/OaqH9rbe3MP0OBzSKwJqs+xtuchakuR NoQOzSAWwKHToyUAxEHyfyoYKP7rTwtlJrlrYOalRDmco6wwlFz0xZACue2h0TdkKqqQ MWsDGxDC8Bw855cpC7H+ifCrSU9zqQiSabfNCdqA3ACn3AuFRSgjfga6lL1wN7AtEDQy CRdqmtvLoWkX8ZAzPBmcvqWmEqGnR4OoFUUD+u+Qcf76RrGFnTiNe4liqFVhO0RluDbk E9uw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a1si25263627pgh.196.2019.07.17.18.45.04; Wed, 17 Jul 2019 18:45:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387601AbfGRBo1 (ORCPT + 99 others); Wed, 17 Jul 2019 21:44:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52786 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727811AbfGRBo0 (ORCPT ); Wed, 17 Jul 2019 21:44:26 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C7F2744BCD; Thu, 18 Jul 2019 01:44:25 +0000 (UTC) Received: from whitewolf.redhat.com (ovpn-120-112.rdu2.redhat.com [10.10.120.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C20619C78; Thu, 18 Jul 2019 01:44:24 +0000 (UTC) From: Lyude Paul To: dri-devel@lists.freedesktop.org Cc: Juston Li , Imre Deak , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Harry Wentland , Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org Subject: [PATCH 06/26] drm/dp_mst: Move PDT teardown for ports into destroy_connector_work Date: Wed, 17 Jul 2019 21:42:29 -0400 Message-Id: <20190718014329.8107-7-lyude@redhat.com> In-Reply-To: <20190718014329.8107-1-lyude@redhat.com> References: <20190718014329.8107-1-lyude@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 18 Jul 2019 01:44:25 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This will allow us to add some locking for port PDTs, which can't be done from drm_dp_destroy_port() since we don't know what locks the caller might be holding. Also, this gets rid of a good bit of unneeded code. Cc: Juston Li Cc: Imre Deak Cc: Ville Syrjälä Cc: Harry Wentland Signed-off-by: Lyude Paul --- drivers/gpu/drm/drm_dp_mst_topology.c | 42 +++++++++++---------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c index defc5e09fb9a..0295e007c836 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -1509,31 +1509,22 @@ static void drm_dp_destroy_port(struct kref *kref) container_of(kref, struct drm_dp_mst_port, topology_kref); struct drm_dp_mst_topology_mgr *mgr = port->mgr; - if (!port->input) { - kfree(port->cached_edid); - - /* - * The only time we don't have a connector - * on an output port is if the connector init - * fails. - */ - if (port->connector) { - /* we can't destroy the connector here, as - * we might be holding the mode_config.mutex - * from an EDID retrieval */ - - mutex_lock(&mgr->destroy_connector_lock); - list_add(&port->next, &mgr->destroy_connector_list); - mutex_unlock(&mgr->destroy_connector_lock); - schedule_work(&mgr->destroy_connector_work); - return; - } - /* no need to clean up vcpi - * as if we have no connector we never setup a vcpi */ - drm_dp_port_teardown_pdt(port, port->pdt); - port->pdt = DP_PEER_DEVICE_NONE; + /* There's nothing that needs locking to destroy an input port yet */ + if (port->input) { + drm_dp_mst_put_port_malloc(port); + return; } - drm_dp_mst_put_port_malloc(port); + + kfree(port->cached_edid); + + /* + * we can't destroy the connector here, as we might be holding the + * mode_config.mutex from an EDID retrieval + */ + mutex_lock(&mgr->destroy_connector_lock); + list_add(&port->next, &mgr->destroy_connector_list); + mutex_unlock(&mgr->destroy_connector_lock); + schedule_work(&mgr->destroy_connector_work); } /** @@ -3881,7 +3872,8 @@ drm_dp_finish_destroy_port(struct drm_dp_mst_port *port) { INIT_LIST_HEAD(&port->next); - port->mgr->cbs->destroy_connector(port->mgr, port->connector); + if (port->connector) + port->mgr->cbs->destroy_connector(port->mgr, port->connector); drm_dp_port_teardown_pdt(port, port->pdt); port->pdt = DP_PEER_DEVICE_NONE; -- 2.21.0