From patchwork Wed Aug 28 10:14:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Shao X-Patchwork-Id: 13781075 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 7331FC54E71 for ; Wed, 28 Aug 2024 10:21:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=l6EEmhk9Y5reOAFsAV+HEJlc3gS52f19SksxotmeIlc=; b=tDFgLVjGxfwDcBH4nbUyvwQJkI AU6f5mUgyz0iO3vPKTkcCT3lqj06kgnpCR+627/SxjdkEHDOw4M6nXPUhi913sWWTaA8eSrp/rf8J 1sUcAslIhJXqIXbJXV2D80Z3IjX1AcFPnmZ+c6GJdRc1uZutOsH5ot58MYcDleithOWlI3B6bS8Ts Qbcap3GMb3EYNz8Uz/nVbYV7cTLb2Nf722KUoonv5XbYk6ThFLekVfGs6DmuvN0VRho+vMscjHZjj AAhOZGL9aiLc1PFKTRVS4k30AN4kDWXNrhUyYCVW2vzY0WoeOYIeTgMM4ItAZcotZyhBDM+us4ASd WuatEtaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjFo1-0000000Euoi-3NDO; Wed, 28 Aug 2024 10:21:37 +0000 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjFie-0000000Esno-2Ssg for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 10:16:06 +0000 Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-202318c4f45so67537835ad.0 for ; Wed, 28 Aug 2024 03:16:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1724840163; x=1725444963; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=l6EEmhk9Y5reOAFsAV+HEJlc3gS52f19SksxotmeIlc=; b=JdVY2URFNBmJd0KuBa6LHHv1C20tvzKnVw4xICiow3fOrw95NfCObh9/b2NsbCGSCw dy9zOBZ3YNoUu0EuF49FKCKg63SHGUFHLlWb5Y4C9xZMrrIdWagsvYeiZykHxasAa0U2 LUYRbVgQz6t0YguWmhUNwv5FV+B9zJfZGIFc4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724840163; x=1725444963; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=l6EEmhk9Y5reOAFsAV+HEJlc3gS52f19SksxotmeIlc=; b=wtPzFnQ6NGHWpv386eN3FdNoszakc8hAC3QbYRG/99UIOyOIN2/aST22gx3rXwhoyo uPo5It9n8pbHuxyDLyVdbOca+8JMGBeQsfR2RIkA1WYad7DywMcg14URcBn2IwUpG4bb dJfiXrg/YIvG9MRb76gYR9lGKkvkp4JQZxjR4A0B4NEbokUkfIjhTmkjDrYnsrqdm/sI Ode3dlgVNK+BhcgFZgqxWMnxUtTdeXKeL/3dbL7pzy7jytt4JOSIjyaXV/opvc6uDuRI XOGY9/vYaMJzAJ7Ofs5k9u8z+d5n5MVTxhX7LkZfdekBU6PIrAxJzAkYNoXD7xWCu71+ tBmg== X-Forwarded-Encrypted: i=1; AJvYcCW9hKZ9uWDrTgx05pBFWmi18NgkCW8mqdeQvbN70GtVNOi/Bx1wbOgHbKel+R0Q2MGWMXZIKFhAUeIrrYRJhF22@lists.infradead.org X-Gm-Message-State: AOJu0Yz+2flS6XA37jPGEe6alZhcN3NitGCBv2C0zWrdwnl+HS6llJql FA34XiuFXx/6VEuJOS+EJc7TuTeAjVs8ElIU0a5hyLlLCJpt8l1nFn8JeR6dbQ== X-Google-Smtp-Source: AGHT+IGtCtgGflkPLcIWz63EIUUuX6MMYmWQAYa+kWCCehY2yI9ZV21P39BGDfxsdsq/CdkR0IzgFA== X-Received: by 2002:a17:902:fa88:b0:202:100f:7b99 with SMTP id d9443c01a7336-204f9b7f065mr15103095ad.22.1724840163370; Wed, 28 Aug 2024 03:16:03 -0700 (PDT) Received: from fshao-p620.tpe.corp.google.com ([2401:fa00:1:10:e0f3:8e32:ef17:cdd9]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2038560dfd1sm95645455ad.206.2024.08.28.03.16.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 03:16:02 -0700 (PDT) From: Fei Shao To: Chun-Kuang Hu Cc: Fei Shao , AngeloGioacchino Del Regno , Bibby Hsieh , CK Hu , Daniel Vetter , David Airlie , Matthias Brugger , Philipp Zabel , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH] drm/mediatek: Use spin_lock_irqsave() for CRTC event lock Date: Wed, 28 Aug 2024 18:14:47 +0800 Message-ID: <20240828101511.3269822-1-fshao@chromium.org> X-Mailer: git-send-email 2.46.0.295.g3b9ea8a38a-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_031604_676691_FE2A7D3A X-CRM114-Status: GOOD ( 13.10 ) 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 Use the state-aware spin_lock_irqsave() and spin_unlock_irqrestore() to avoid unconditionally re-enabling the local interrupts. Fixes: 411f5c1eacfe ("drm/mediatek: handle events when enabling/disabling crtc") Signed-off-by: Fei Shao --- drivers/gpu/drm/mediatek/mtk_crtc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_crtc.c b/drivers/gpu/drm/mediatek/mtk_crtc.c index 6f34f573e127..42f47086f414 100644 --- a/drivers/gpu/drm/mediatek/mtk_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_crtc.c @@ -449,6 +449,7 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_crtc *mtk_crtc) { struct drm_device *drm = mtk_crtc->base.dev; struct drm_crtc *crtc = &mtk_crtc->base; + unsigned long flags; int i; for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) { @@ -480,10 +481,10 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_crtc *mtk_crtc) pm_runtime_put(drm->dev); if (crtc->state->event && !crtc->state->active) { - spin_lock_irq(&crtc->dev->event_lock); + spin_lock_irqsave(&crtc->dev->event_lock, flags); drm_crtc_send_vblank_event(crtc, crtc->state->event); crtc->state->event = NULL; - spin_unlock_irq(&crtc->dev->event_lock); + spin_unlock_irqrestore(&crtc->dev->event_lock, flags); } }