From patchwork Mon Oct 24 15:39:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13017739 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 D4FD5C38A2D for ; Mon, 24 Oct 2022 15:43:26 +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=FfZTXqlgkx41k+ Fi/VCgRt/vBuIAd/xvIbxtwCszy6pFhZimsX0Rf5NWeSi+Fh2LIrvi3lWrJn81DuD3Aap6KEPOvHs /2gYTvClMzHr96v9Q8z7SKUKa1HKDwYDOkXwCRh79sx3dlYTxbkX0Lf+xkJO6D7LW9tIGU2EVYi+b bUTJU/T8NKLW0TvyUzMNWoKIjFSPhoT0wrugnBgq9Wv2CPN41DOsMeuX1Xk46SeFQwBS/y2SEB728 2pf+b2B5wwD3rlCDTXxazFmYkV9w3dcM7gQTmpiJDFD29C31uf3JOy1VV77WzYtBigtu4ITqUGVRV gSO4hgeqHp2Xb0PwsXzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1omzab-0028Qb-W7; Mon, 24 Oct 2022 15:42:10 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1omzY3-00272B-8S for linux-arm-kernel@lists.infradead.org; Mon, 24 Oct 2022 15:39:32 +0000 Received: by mail-lj1-x234.google.com with SMTP id b18so13240538ljr.13 for ; Mon, 24 Oct 2022 08:39:30 -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=YSyy0MzpgrvBvNqYkcjjjMujeQNgz2w0aplR2UtgE45kTtD5Tpn5OHIRnV3nLiNAUc lvYZRcE54vsOSTS3gXSM4HFBQ3my8Guc1axsWht9KNuaKWxiCl0w7Mr9UezQr3CI/Ew4 jOVO0asv1ZiPCgBR1lciM3e8wOAKipPUnpl/lcMmLzCnHJdfpdCk5gvpKC1jlH47f8HB q8QT3t3Mavn3gmwYJ9gzH+y1Pz6HjtyKcEnFvmMTPFpUizIBIJnHA8w/9+PTjrhI6Gik /k9NMsgvBFfFq+4AX1caF8UNru0qPubzJPzqIdV5Kk1mnBRAttYgpz8FmoLxUxFs8vjS g5WQ== 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=Vsar+5uNqslyW85HzJ5TtjYc/EDk0a59kt+BFl3v4EFSvDV1hgvW3Z9ztVaj2/fHNe GJXdcbfcSpEzp4pUdWJ+XeRXPk+9vL2qo2AoZjIlduAIzn6A2iVFhdmTrlZDRbh+eeaq F+fVpvuCj70ZivEebsjOGmpv8iWDmi17mXvmNQYl4PrrJbWAjb+NM10Bv3RdqBM+SpKD +a5Aa7L04MVsVcd/RgWJ1y8KbliLroPVwdu4NnXtuWCXBPdHcjxWhq4DUS9bQGSGEGtW 1ivCIgyeZe87Xp+Bfc6my+uag9ZdbqbKhSsSlwnMvoStI3UHpjHNkF2mxHqRCtWYM4aP 9vDQ== X-Gm-Message-State: ACrzQf2sirh3Yrt/fUytbrK/RUT/6nIRWnMJz3J6Uygv52CQE8Ye75ml gJktcZlNFMI1wRaD/R7FUVFu0A== X-Google-Smtp-Source: AMsMyM6oJ0SFF+Zwbo4Q7rqEzTwB8GtqAaRQSOc0HeMjfEBGYSBo6Ghd+iIxJhdZF4gHbWg69CLGnw== X-Received: by 2002:a2e:9a81:0:b0:26c:5b63:7a83 with SMTP id p1-20020a2e9a81000000b0026c5b637a83mr13313560lji.291.1666625968692; Mon, 24 Oct 2022 08:39:28 -0700 (PDT) Received: from eriador.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id f23-20020a19ae17000000b00497b198987bsm452181lfc.26.2022.10.24.08.39.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 08:39:28 -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 v2 1/7] drm/poll-helper: merge drm_kms_helper_poll_disable() and _fini() Date: Mon, 24 Oct 2022 18:39:20 +0300 Message-Id: <20221024153926.3222225-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221024153926.3222225-1-dmitry.baryshkov@linaro.org> References: <20221024153926.3222225-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-20221024_083931_336269_A8F44672 X-CRM114-Status: GOOD ( 10.86 ) 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);