Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3025301rwb; Mon, 15 Aug 2022 16:23:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR6C1ulf7020XdVOuvOiD4c8XOqJ/DI5Za0lSEjKcVOrfZhwKwrC79HEZ0CxD8gSBAe3vcBx X-Received: by 2002:a17:902:ac97:b0:16e:eb08:fb15 with SMTP id h23-20020a170902ac9700b0016eeb08fb15mr19454883plr.7.1660605797866; Mon, 15 Aug 2022 16:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605797; cv=none; d=google.com; s=arc-20160816; b=Ifyvd5a6FiXJA4M2U2dG3M2/lc8Nr4e5fBd4MMDxyyWMfI8VN3p034f/B3JRLtoY4U NFDNUVSnXwvywxavxWi3mWN+pd40WEbgxls9XOKNW1/eAerG8wSh2ZNMVeRAsMaF5a14 XTmhJVUi87zfHIyblfv4C9Kgxd37tF+CQ9uoApLugIir7vHih8kFVvLJ9tyTRXf8AnCp 61NZdT4sO3qRwKtzUJnxu1WCLJ9WrmohKrBY/DMlbgPxZRt0/3VeOQ25fXYIKNNmZ9ez eKrp79m0KG1zLtudft9Mj9GyePzc57v9E2zIHwUI2fPdZZmgK31ESQoutfdprPC/UqsK kceg== 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=QU4L6AN5iyy6smO00zgweJH7FgJf0c03rs1nsdfgOp8uQQdZmigPDg6dmaRfU5fcHi ykRaxqKZbWbox0aVcUvnFLpzG6V8N0cUw3xRR3rli2RU8t1dMW/Vb7JaiZ4pDESdIAk1 hAu4vdU6mB5PdQ3iZFOxUbcIUGsxKTr2ir3X1Z592A9/nJm93mOuMzEF/wjbskuxIYNX FmGsl7A0yRQrLk5r+NMBxNT7s+f7GZKwh/wrZsOCH26baWuzqGfqxAr6nM5M4quRV/Tx imaKgNuZhRPIJVKkjIYIoDAkPvRvjpFmFa3utJrZ7CGhi8sL6pg1sUXxsk3kPhMnNp4u odNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h4eAIkb4; 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 pi14-20020a17090b1e4e00b001efbdf44c12si320046pjb.97.2022.08.15.16.23.06; Mon, 15 Aug 2022 16:23:17 -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=h4eAIkb4; 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 S1351706AbiHOWwQ (ORCPT + 99 others); Mon, 15 Aug 2022 18:52:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351867AbiHOWtd (ORCPT ); Mon, 15 Aug 2022 18:49:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E2EA136779; Mon, 15 Aug 2022 12:53:47 -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 ams.source.kernel.org (Postfix) with ESMTPS id E00F5B8114A; Mon, 15 Aug 2022 19:53:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34A4DC433D6; Mon, 15 Aug 2022 19:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593224; bh=PsZshobPurGVYu4Uh9WAkoFpIzsC+Nh4RYI6CN0A+XU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h4eAIkb48VaHhkKA3e981eykRqCWlMqDWRAfifIxln7X0/i9y9npB8zYggIILDh6f avup/LZlMd07/lmgOY5DmPt4syxvohdMzEH9KiZ5VLGsyan+FRTcnmy8ITjJ7c8igv oUcgwes7GuETjtq4+A7GmOfOmnovVxy4f6pAVPWs= 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.18 0914/1095] ASoC: mchp-spdifrx: disable end of block interrupt on failures Date: Mon, 15 Aug 2022 20:05:13 +0200 Message-Id: <20220815180507.099580115@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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