From mboxrd@z Thu Jan 1 00:00:00 1970 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 6B942C433F5 for ; Fri, 15 Oct 2021 19:42:03 +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 2590061151 for ; Fri, 15 Oct 2021 19:42:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2590061151 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com 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 4F52A6E3CE; Fri, 15 Oct 2021 19:42:02 +0000 (UTC) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 78CC16E3CE for ; Fri, 15 Oct 2021 19:42:01 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10138"; a="291456607" X-IronPort-AV: E=Sophos;i="5.85,376,1624345200"; d="scan'208";a="291456607" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2021 12:42:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,376,1624345200"; d="scan'208";a="442632449" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.171]) by orsmga006.jf.intel.com with SMTP; 15 Oct 2021 12:41:58 -0700 Received: by stinkbox (sSMTP sendmail emulation); Fri, 15 Oct 2021 22:41:57 +0300 Date: Fri, 15 Oct 2021 22:41:57 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Simon Ser Cc: dri-devel@lists.freedesktop.org Subject: Re: [PATCH v3 5/6] drm/probe-helper: use drm_kms_helper_connector_hotplug_event Message-ID: References: <20211015163336.95188-1-contact@emersion.fr> <20211015163336.95188-6-contact@emersion.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211015163336.95188-6-contact@emersion.fr> X-Patchwork-Hint: comment 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, Oct 15, 2021 at 04:33:45PM +0000, Simon Ser wrote: > 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; So many things that "changed". Would it not be simpler to just grab the first changed connector always, and count how many there were in total? > + } > } > 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; > -- > 2.33.1 > -- Ville Syrjälä Intel