From patchwork Wed Nov 2 18:06:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13028734 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D5B3CC4332F for ; Wed, 2 Nov 2022 18:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mNkzBQTp4CLiTrIiVag/EvIZJcrFKrinlee7cEe4YcA=; b=w78whOArub10o6 ITkGQSctXBWqTQYlqEEikrFBxWZ3+bH15dfQHJ3aXNmc2GXzBje4KwO/tpHno4QBBGB5cs7SJ1z5B QnS6ROiiWpsjOLJaW7iRAjF0Qnf0Uc8RjUBJ7cMc/W6twhyKdy6wBign3rtaA9pOUhowuNDp+yEVc kzqh/Yw/Sh8XjuNuPyLhdNHvAVWehqQsLCkwgcLjAtqSl1d/P5gA+w2bqDEFGSeCYbAgRPYBgaCaI 3HzYj9KY7pT6KBZNtoUxyI6Ek6YaVDkLpc+JnBnqb6GokWX8XJE9FsKKGeDOe810QAHRm0lIwvxAd B92NZaY3+pgYJlI6BL9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqI9O-00CoCf-4b; Wed, 02 Nov 2022 18:07:42 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqI8s-00Cnqq-Ms for linux-arm-kernel@lists.infradead.org; Wed, 02 Nov 2022 18:07:12 +0000 Received: by mail-lf1-x136.google.com with SMTP id f37so29503474lfv.8 for ; Wed, 02 Nov 2022 11:07:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=I3be5trhw3wsDg3ozZhQ1oc92P/aiH8PmAIGusb2quw=; b=U1V1Ie1snUM8Z8kW5FbPB+Uxui9aHzWBAvoKIzPL5WQtt7r1fbJDtKZfYL0BvXjZAX pJXlM3cUhAHFVupb1uRPIy1ukhaIzZwAyJB4gdhhGcw8JI31vp2Na7Z3w8CO8QhTzR9R KvUPtk1lO6e50dKm5UdWhcexeNthTu3tdl2sTg0S9cJJb0qQ29mQaq7fEiKOijMTBq78 AJjAm41uNWULtKqI30GYst1N49ngizQQX8dCwb9yXGsU8VHccitTrRtFDC0ASm442BuI o39Z887V1sbVS7fCnHaPRg7YhrxZEF1JL7e/zjTrWzvEQM+tv70DuSnESXnFQKx4s7ga TX3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I3be5trhw3wsDg3ozZhQ1oc92P/aiH8PmAIGusb2quw=; b=LOJDhhLlck6x2YJ434zCFlj1enyidkkEzWtGidE/CPQ3rervxZRy1GMLypmBqytS9D T/WQCg4eoQ+AdS97tF4pexvFcCljTE/XPaUM9vxLCgDIUWDjxMg4bfuPVSk+etAWDhqx hysnDy9gM8+PBlNVPeOx/PU2rKHFmta5nlPIzqPLXc1VVU1BxqRRJfA/ZIegSWPTk/2z Q5y6Bs2snQIiRboZ2d/Q0GBNGv1b72xqOlsrsFA+QiEs7gIWHyO0YzM4gmvRfdmzdIsy 16A030CHIrY/PItsk0IP8WmAPy+g+af5TWvOShypAgwNcqTOeKOcsuR5Oa3dcjeSAMBw byqA== X-Gm-Message-State: ACrzQf033Ey4vCgz2/CnZIlmofnZHE86kyNZVxRA0imQw6O+dv4jh1fS VVPyMoGaPy1WKg6b1G41j2T2qA== X-Google-Smtp-Source: AMsMyM73Sw3dwb1cK+9rqJCeye4EQEf8Qh00yXAocdLw3KYHslx7r/wcJUC94neRnIpmMp6sND42Rg== X-Received: by 2002:a05:6512:3085:b0:4a2:7d80:d4b4 with SMTP id z5-20020a056512308500b004a27d80d4b4mr10523057lfd.534.1667412426862; Wed, 02 Nov 2022 11:07:06 -0700 (PDT) Received: from eriador.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id r15-20020ac24d0f000000b00485caa0f5dfsm2085232lfi.44.2022.11.02.11.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 11:07:06 -0700 (PDT) From: Dmitry Baryshkov To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Laurentiu Palcu , Lucas Stach , Philipp Zabel , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rob Clark , Sean Paul , Abhinav Kumar , Tomi Valkeinen Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [PATCH v3 1/7] drm/poll-helper: merge drm_kms_helper_poll_disable() and _fini() Date: Wed, 2 Nov 2022 21:06:59 +0300 Message-Id: <20221102180705.459294-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221102180705.459294-1-dmitry.baryshkov@linaro.org> References: <20221102180705.459294-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221102_110710_782681_C252E71E X-CRM114-Status: GOOD ( 11.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Merge drm_kms_helper_poll_disable() and drm_kms_helper_poll_fini() code into a common helper function. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_probe_helper.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 69b0b2b9cc1c..f97fda3b1d34 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -803,6 +803,17 @@ bool drm_kms_helper_is_poll_worker(void) } EXPORT_SYMBOL(drm_kms_helper_is_poll_worker); +static void drm_kms_helper_poll_disable_fini(struct drm_device *dev, bool fini) +{ + if (!dev->mode_config.poll_enabled) + return; + + if (fini) + dev->mode_config.poll_enabled = false; + + cancel_delayed_work_sync(&dev->mode_config.output_poll_work); +} + /** * drm_kms_helper_poll_disable - disable output polling * @dev: drm_device @@ -819,9 +830,7 @@ EXPORT_SYMBOL(drm_kms_helper_is_poll_worker); */ void drm_kms_helper_poll_disable(struct drm_device *dev) { - if (!dev->mode_config.poll_enabled) - return; - cancel_delayed_work_sync(&dev->mode_config.output_poll_work); + drm_kms_helper_poll_disable_fini(dev, false); } EXPORT_SYMBOL(drm_kms_helper_poll_disable); @@ -859,11 +868,7 @@ EXPORT_SYMBOL(drm_kms_helper_poll_init); */ void drm_kms_helper_poll_fini(struct drm_device *dev) { - if (!dev->mode_config.poll_enabled) - return; - - dev->mode_config.poll_enabled = false; - cancel_delayed_work_sync(&dev->mode_config.output_poll_work); + drm_kms_helper_poll_disable_fini(dev, true); } EXPORT_SYMBOL(drm_kms_helper_poll_fini);