Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1864512rwb; Fri, 19 Aug 2022 10:39:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR69J1Kx5G2lL7omn5poVIcMiTP/Yi7qYk47/SlAUD2iHwrJH2KGhMcYFWZBKe64JQo/6qQV X-Received: by 2002:a63:d703:0:b0:41a:8d7a:eb3d with SMTP id d3-20020a63d703000000b0041a8d7aeb3dmr7316313pgg.59.1660930772734; Fri, 19 Aug 2022 10:39:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930772; cv=none; d=google.com; s=arc-20160816; b=0Lu/PNPU8AKXeaTNvOMwYusPNgBVqscK76NsB9DROyPx3IeFOCg4mYkc2eZisl4Oy3 Yr8S2McVef7fN6rOzY7wynC883EkFtyNGeg731Z0kuKcFXgfV1ATLDh8rRP8zDCU+7OP b0o2T8kM1tYuP7lFkhnMaDD6P1KD10kpMkbBD3BidAlgwPzSfPbXkuVDVzQhzM6E9poE LlHWe5DpN8Wbzwpf/AO+rzo6Hb2MCaJcfvEbQiYdekCrVzUi7PcDgbcbr8Hie9Yal5BW s2ELVhZ732k2o7EGTv6h0jMC0Moaz7Ex1RbPz5QIEbgZT8YWujSX4s0skLBymJAnBRTT 38xg== 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=8S5QTE9G45hA+qCi1UwzJHa6J/aIAjXhco9ire3rKpU=; b=VmorGgpuqCoIomq+Bxf6RZ9IWBT1zwAymeTwbk6el1KPAmh+oZILs5Ot3fu0qnJBbR lY19JInbmQI0FBgOxoGXTIuHYV7uAvqjtoiGrgpxK2vlP8r/SWm2pOf7ERhGGThpHLJV /OY2tTHk3Mim3dNdnzs8NQmBwgWl4X++LmtsD8xs6ua0k/PohJ9phc8cropQRSv61D16 I6vagxhLddfQ98WFxARhcPP5JfXQ4oCuHRba23GYyCqi2HhZdJ+XNMnv7rj68YnMFre/ urcYAHAI2PDg17n+Wb+JAF7TcwBQC4yH/QUXbldF9LrsaCseAeGw/QI/oAz+1euvyri0 1OKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dArxODaD; 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 h24-20020a63df58000000b0041a11845a19si2548809pgj.703.2022.08.19.10.39.22; Fri, 19 Aug 2022 10:39:32 -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=dArxODaD; 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 S1353672AbiHSQmp (ORCPT + 99 others); Fri, 19 Aug 2022 12:42:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353332AbiHSQkF (ORCPT ); Fri, 19 Aug 2022 12:40:05 -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 0887BC6B5C; Fri, 19 Aug 2022 09:08:32 -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 25C7AB82822; Fri, 19 Aug 2022 16:08:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82872C433D6; Fri, 19 Aug 2022 16:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660925289; bh=NvIn2LoP/495gjA98dLbCw3goiC192Zqfodd4zGLDLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dArxODaDmrOdMtQxKDhPMFHY6TeRh50goWZinEXRYfu3Xijv3q1XmNnr6qnynl33J tZKXKDq9CW8zgjFpFL22yFO7ok0fGzLRUTTNZwjsAROu5R2gjA88cvZEJclUIofR/d NSBtSp/UZXnuDPaJgCeTWCvYPaE4Pr7RUgh81VYw= 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.10 415/545] ASoC: mchp-spdifrx: disable end of block interrupt on failures Date: Fri, 19 Aug 2022 17:43:05 +0200 Message-Id: <20220819153848.008018637@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@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 e6ded6f8453f..46f3407ed0e8 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