From patchwork Fri Oct 15 16:33:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 12562499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90802C433EF for ; Fri, 15 Oct 2021 16:33:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 416C360E0C for ; Fri, 15 Oct 2021 16:33:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 416C360E0C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=emersion.fr Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5DDB76E329; Fri, 15 Oct 2021 16:33:52 +0000 (UTC) Received: from mail-4022.proton.ch (mail-4022.proton.ch [185.70.40.22]) by gabe.freedesktop.org (Postfix) with ESMTPS id 608026E329 for ; Fri, 15 Oct 2021 16:33:50 +0000 (UTC) Date: Fri, 15 Oct 2021 16:33:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1634315628; bh=aPO+eW2W5skbHtCOR+vFJXQIAh0kKiUACv5iHW3hLww=; h=Date:To:From:Reply-To:Subject:In-Reply-To:References:From; b=Ca+EuksK387XK2ccd7YBKnUbk/lKfl934A83CGrqObPhbLOQcxNGPtnKPzr2S+hmD NWw4XFm1EjjZQv15+ZVnueb0AUvHOPNeItxMlumGlTdRAxl/o8EKffpcFMwaAYx8Ql yHcG+Nh9O4taJeObaekXO7pdQilSqPk5gq3qJK1xEGgigfnWnvYsA0pyAOu67JDLcc cQ9WrTXG0lI06chfVnUDUo6UAWUj+usx+xQvUkzZI3v/z/FCSESVxj5EgJXLZXHHNC D9jiOlt02ys4enBtfQRIW+JyCOOHIFkrEzjfkyyxPtHTSbE5kQ48WzVipyZjLfiHSQ 6F55NWK2l34FA== To: dri-devel@lists.freedesktop.org From: Simon Ser Subject: [PATCH v3 5/6] drm/probe-helper: use drm_kms_helper_connector_hotplug_event Message-ID: <20211015163336.95188-6-contact@emersion.fr> In-Reply-To: <20211015163336.95188-1-contact@emersion.fr> References: <20211015163336.95188-1-contact@emersion.fr> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Simon Ser Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If an hotplug event only updates a single connector, use drm_kms_helper_connector_hotplug_event instead of drm_kms_helper_hotplug_event. Signed-off-by: Simon Ser --- drivers/gpu/drm/drm_probe_helper.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 3aef3b188c99..6049dc92324b 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -927,7 +927,7 @@ EXPORT_SYMBOL(drm_connector_helper_hpd_irq_event); */ bool drm_helper_hpd_irq_event(struct drm_device *dev) { - struct drm_connector *connector; + struct drm_connector *connector, *changed_connector = NULL; struct drm_connector_list_iter conn_iter; bool changed = false; @@ -941,15 +941,27 @@ bool drm_helper_hpd_irq_event(struct drm_device *dev) if (!(connector->polled & DRM_CONNECTOR_POLL_HPD)) continue; - if (check_connector_changed(connector)) + if (check_connector_changed(connector)) { + if (changed) { + if (changed_connector) + drm_connector_put(changed_connector); + changed_connector = NULL; + } else { + drm_connector_get(connector); + changed_connector = connector; + } + changed = true; + } } drm_connector_list_iter_end(&conn_iter); mutex_unlock(&dev->mode_config.mutex); - if (changed) { + if (changed_connector) { + drm_kms_helper_connector_hotplug_event(changed_connector); + drm_connector_put(changed_connector); + } else if (changed) { drm_kms_helper_hotplug_event(dev); - DRM_DEBUG_KMS("Sent hotplug event\n"); } return changed;