Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3257865rwb; Mon, 15 Aug 2022 22:30:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR4MZFDvRerWuB76wWIRVRHrRoezxb4b1idw3k4qTcwTgAl/WTy25F8YGwkZp4Ls7TKivg53 X-Received: by 2002:a05:6402:5190:b0:43d:da02:566a with SMTP id q16-20020a056402519000b0043dda02566amr17364776edd.187.1660627858190; Mon, 15 Aug 2022 22:30:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660627858; cv=none; d=google.com; s=arc-20160816; b=MIjSy/cRFhLQT+fwHNYMiQ6bbbCyMHqHCU1vKL4z2Y7SkAsvkYH9Gzv95UXuPEqAcp gLufxr2tmsd4+wLoYEuAoTpcNL0WwnnB7sRUzHpdFEAVUQGEpP/mLo0J1xIO1F7mjpyj R/O2iZSO+UOSHl/9pE1KdizpimRTZMPb09a30NrIIJpiTU9DvdU3Pw35aW+OhSZmNZYJ SBViTOT8aH8IDB/xw6XLNiNAYnhKy6gpq1+cc/gNoLIhTlv6/1ox/flXc5scBMC/b9ss mK3OO7NiWujjepcSYlr2oyPyDHi5cy+LjEMCnQK7oylUdEv6ap/V1iM2F8qI1B3YN7Wo xlRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3DEwnH2jL9LkJdBQvvq2ctXxwwY98T0601Qyg1Z5yK4=; b=DrAbnBsM3obH76VmaalL1eMP8rnj5SGbvo9fW8cjtQuRh3R34s9IGNh+Y/mYNHJ6dD licSOE3xQmjYI4nJcTWh/G5rDg22wcBZiPf7zYKGUDGauTkzQJKY7Y/5ElYfWDursO5w js28HqLjAinZkQh8OmnEAPJ+9JKTPLzfrueoJYBT0xyWcXf7zg6dBUygKR9LqZ0wXMRL a24K8k9AruwN4wBRc+5QIL55os44Jtaa+wUD0PQMadwVtVQTROWaS2wMMBvijRxAqJTA m7hpxdsn7qkcHbChd7VBCARSifaHyVNPYiC18DEwDtbRTEpidffnqqNdHfI9YXm4RSMr DwGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xyNpAHSW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr17-20020a170907721100b00731646a574esi9424757ejc.839.2022.08.15.22.30.31; Mon, 15 Aug 2022 22:30:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xyNpAHSW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232570AbiHPEtU (ORCPT + 99 others); Tue, 16 Aug 2022 00:49:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232711AbiHPEpr (ORCPT ); Tue, 16 Aug 2022 00:45:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B773AF0EC; Mon, 15 Aug 2022 13:42:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9AD39611FA; Mon, 15 Aug 2022 20:42:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B86FC433C1; Mon, 15 Aug 2022 20:42:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596162; bh=PsZshobPurGVYu4Uh9WAkoFpIzsC+Nh4RYI6CN0A+XU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xyNpAHSW+UkctzOK9GuUIHzP3+dcffSq1746H2x7uHur8qmis/ljagjS7mA8TDSDl IErJpuuafrhuuPOPzCVgHK3LFfFw4Ib4ge6kTQhGBUjjVfDUvKSxJJoFE25Fjb626u /7AKRq6nowwl0ABYGrop7JSxL28zyLLHPDRsFndc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Mark Brown , Sasha Levin Subject: [PATCH 5.19 0992/1157] ASoC: mchp-spdifrx: disable end of block interrupt on failures Date: Mon, 15 Aug 2022 20:05:48 +0200 Message-Id: <20220815180519.401023225@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Claudiu Beznea [ Upstream commit 768ac4f12ca0fda935f58eb8c5120e9d795bc6e3 ] Disable end of block interrupt in case of wait for completion timeout or errors to undo previously enable operation (done in mchp_spdifrx_isr_blockend_en()). Otherwise we can end up with an unbalanced reference counter for this interrupt. Fixes: ef265c55c1ac ("ASoC: mchp-spdifrx: add driver for SPDIF RX") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220727090814.2446111-2-claudiu.beznea@microchip.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/atmel/mchp-spdifrx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sound/soc/atmel/mchp-spdifrx.c b/sound/soc/atmel/mchp-spdifrx.c index 5fc968483f2c..a7baa0385ec5 100644 --- a/sound/soc/atmel/mchp-spdifrx.c +++ b/sound/soc/atmel/mchp-spdifrx.c @@ -288,15 +288,17 @@ static void mchp_spdifrx_isr_blockend_en(struct mchp_spdifrx_dev *dev) spin_unlock_irqrestore(&dev->blockend_lock, flags); } -/* called from atomic context only */ +/* called from atomic/non-atomic context */ static void mchp_spdifrx_isr_blockend_dis(struct mchp_spdifrx_dev *dev) { - spin_lock(&dev->blockend_lock); + unsigned long flags; + + spin_lock_irqsave(&dev->blockend_lock, flags); dev->blockend_refcount--; /* don't enable BLOCKEND interrupt if it's already enabled */ if (dev->blockend_refcount == 0) regmap_write(dev->regmap, SPDIFRX_IDR, SPDIFRX_IR_BLOCKEND); - spin_unlock(&dev->blockend_lock); + spin_unlock_irqrestore(&dev->blockend_lock, flags); } static irqreturn_t mchp_spdif_interrupt(int irq, void *dev_id) @@ -575,6 +577,7 @@ static int mchp_spdifrx_subcode_ch_get(struct mchp_spdifrx_dev *dev, if (ret <= 0) { dev_dbg(dev->dev, "user data for channel %d timeout\n", channel); + mchp_spdifrx_isr_blockend_dis(dev); return ret; } -- 2.35.1