Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2882975rwb; Mon, 15 Aug 2022 13:15:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR64p95X8yT26pGXUzLqx3K1582ZOAMdW5SHulnX4wWENx3lXZYiXizQ9dGHtfdwqF1noxVt X-Received: by 2002:a05:6402:4385:b0:440:679a:c3fa with SMTP id o5-20020a056402438500b00440679ac3famr15376491edc.118.1660594511849; Mon, 15 Aug 2022 13:15:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594511; cv=none; d=google.com; s=arc-20160816; b=yDDeh8h7KDrWQMffI6kdQBhjGEMx87rMUO07dpZu9RFt17Sb34O+zg9abNuss8Ni4b rqEO1WmvBLSEsogEwj4sLLJ484qCJLIgS+keejDfHtSAKgZ4fcTF6fuZlhcVy3u7UF3D AeHTDRfxx1Zlbpo2gWda2m77Qlhr9P6p+430Sk0uDMuMLefmKSqrYUvIFxA1VT2Nz52L SZNQvRDMLYwgTe6n49NEXGzm3aslVM5OEUrAdCZsOWe3cLShAMuwm04CTD0O7v81zc4g vX9Wp0WDaMuu4QtKUsoUHwWO6lbaLSBAv29mLZW1/L+J8rkuTQQeA8Wl/XFieds0MLm/ KsFw== 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=aBM3Nc2X49xQ/7aoG7ZmaIkzAvm6/GrjRLNKR+SqSUg=; b=WyghzWyUmOWX/ZS7/hhlA/3peMsi+1VGoP4/ZYZxqzgvXIVSMPYPnGd0UHVPjLRfVg dH1RtfZmK9R2rq3JQ+DsI+flBO14pqAA6vDoK+0qDMplpw1oNcG+N+vAzvyU1/TxF0tN e5+Bh2Th4LzWr6iH4tgCEQfKmkbZpYSeRW79mkY9PlDk1hsdwsmPzdVEaIULBPSGRMQh bch/CDDpWWCHdhZjb6zK/i/A9ySm9KlWS0o609H5m4Mg1DnuLBLqwUwwGpujuxNmEmJs d3i981nH5mENZDo6JzX4G/o99kg57c/ySNwVbLhDv1Y6JWGMX+XOm18+Kpya45J+STCK VZ8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GbkZpL1k; 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 f12-20020a056402354c00b0043bb8df080fsi8145938edd.606.2022.08.15.13.14.45; Mon, 15 Aug 2022 13:15:11 -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=GbkZpL1k; 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 S1344868AbiHOTpV (ORCPT + 99 others); Mon, 15 Aug 2022 15:45:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344998AbiHOTmH (ORCPT ); Mon, 15 Aug 2022 15:42:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 064A967CAA; Mon, 15 Aug 2022 11:47:51 -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 2F4D7B81057; Mon, 15 Aug 2022 18:47:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73191C433D7; Mon, 15 Aug 2022 18:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589268; bh=V1JLJD5JDI15dPV+5pZwuivXT3yv18inMqghy5mVCUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GbkZpL1kEADQG9Mtx3gqenqdMv5OwGVOdTofsc9p5rEgvMBLM+gAwkM3taVUDXROv eu7QW4JQkJKQ0Ve8vAd9AJSWzm+i8mS53jUEhifvs0V/DPLqs+XHRQ8ZI462qRl+RH BOAI6wbRLEFc41ShHa4Qcm1lthsZUFCm38CVWdG4= 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.15 634/779] ASoC: mchp-spdifrx: disable end of block interrupt on failures Date: Mon, 15 Aug 2022 20:04:38 +0200 Message-Id: <20220815180404.444352967@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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 bcd4f3e4fb0f..2a62d9a2fa0d 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