Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2907832iog; Mon, 27 Jun 2022 05:32:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uHvk2OgtizICl71WnFXndlU8NH6G1KIGNAlTogFrfMdLcbazBGcxVBrlXWWfkuCCvQTScm X-Received: by 2002:a05:6402:22b9:b0:435:750f:b4c9 with SMTP id cx25-20020a05640222b900b00435750fb4c9mr16417556edb.181.1656333155887; Mon, 27 Jun 2022 05:32:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333155; cv=none; d=google.com; s=arc-20160816; b=aucCQnzewccCSTb/OXVMSwuiHOEEJ1WoEGTJhPZevUod7+6ahvHESaeGicqovkkOOe EMM2+XwuG3O8wm9YSf4DD+w1f1o6f/8jlgVBng/ehs7et6ziP28wUbCZTRty0B/hJLGa 8gkuLfM2qR3qQ7U5vMV3sMUK849c0j0wRcegKbwoWsu1ikMfRHPxSNeBYyfwbJz6eWmK 1UlVpewQUcKuce7zyJV5j4vQM79HOr0HkBStouTRR5cQlGv6PV6dGFjsM6aegf5uo1CB B1jzN/3FM2N5eyYlR7THooj/NDNPPDwiBLK5N1AP0VUdujvmckF+vr8ZAuVMHSPceYiD 52nA== 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=FKX5Q/f/scTuyg/yTwFTCGpngc1AwS6OxDd8zh829MU=; b=osG+aAsO56GsrT6qFZqmsNMW/j+t3ZuNRjYgCJoRFDZgU5jhPhB8ytrPbXdiPtIUXr MzfjK+CGoOn+UOm+vHEOzSPc7yCIov2eJEQQYT5T6Q9JAyLbtV/qte4ByYIjJDVohKy9 uK/gIgtC3sHbMH5A+YqzNjI5nVuWokMe+zhTrBpfJhDUeSEh1c7Hs7fUq/rNkIb5EbsB OSJRG69SXxwzbFeDgOgi137CdXc6bqhyBfnneUL5UA9X4NdR8bm586aTuN3RvB7PnGFU l3CgWjAAtlijjxTBq+Qh7jpdV0dFX3xKm0rPXJHv/OikimL3ME/Gzmz3S5U/l2QRU6BO h3hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YNy7gBBl; 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 z22-20020a17090655d600b00710939b43a6si11532813ejp.69.2022.06.27.05.32.10; Mon, 27 Jun 2022 05:32:35 -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=YNy7gBBl; 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 S235064AbiF0L2J (ORCPT + 99 others); Mon, 27 Jun 2022 07:28:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235121AbiF0L0p (ORCPT ); Mon, 27 Jun 2022 07:26:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 013399FC2; Mon, 27 Jun 2022 04:26:41 -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 8D06D61456; Mon, 27 Jun 2022 11:26:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FC82C3411D; Mon, 27 Jun 2022 11:26:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656329200; bh=aSg6SCDboFrRDptYfGjd8aZCjQ3TtrJ6lY+80tf9SwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YNy7gBBlNYOPKkQS4BgZHVphX5l59qsGvcGQh5lcF7eV7FtDTBVuau84kx14biN7P Ysh6576Z0uo7j5RU2I8EM4w2E1baeBSyTYyHZ6/mjB7SyBEF5tRPo3Ky2hk7Zp3wH4 PnQipCJGrvgDtVyb44bvcOrrJ7gRfdBRdaJPynIo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yannick Brosseau , Fabrice Gasnier , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.10 081/102] iio: adc: stm32: Fix ADCs iteration in irq handler Date: Mon, 27 Jun 2022 13:21:32 +0200 Message-Id: <20220627111935.871020960@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111933.455024953@linuxfoundation.org> References: <20220627111933.455024953@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 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: Yannick Brosseau commit d2214cca4d3eadc74eac9e30301ec7cad5355f00 upstream. The irq handler was only checking the mask for the first ADCs in the case of the F4 and H7 generation, since it was iterating up to the num_irq value. This patch add the maximum number of ADC in the common register, which map to the number of entries of eoc_msk and ovr_msk in stm32_adc_common_regs. This allow the handler to check all ADCs in that module. Tested on a STM32F429NIH6. Fixes: 695e2f5c289b ("iio: adc: stm32-adc: fix a regression when using dma and irq") Signed-off-by: Yannick Brosseau Reviewed-by: Fabrice Gasnier Link: https://lore.kernel.org/r/20220516203939.3498673-2-yannick.brosseau@gmail.com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/stm32-adc-core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/iio/adc/stm32-adc-core.c +++ b/drivers/iio/adc/stm32-adc-core.c @@ -64,6 +64,7 @@ struct stm32_adc_priv; * @max_clk_rate_hz: maximum analog clock rate (Hz, from datasheet) * @has_syscfg: SYSCFG capability flags * @num_irqs: number of interrupt lines + * @num_adcs: maximum number of ADC instances in the common registers */ struct stm32_adc_priv_cfg { const struct stm32_adc_common_regs *regs; @@ -71,6 +72,7 @@ struct stm32_adc_priv_cfg { u32 max_clk_rate_hz; unsigned int has_syscfg; unsigned int num_irqs; + unsigned int num_adcs; }; /** @@ -333,7 +335,7 @@ static void stm32_adc_irq_handler(struct * before invoking the interrupt handler (e.g. call ISR only for * IRQ-enabled ADCs). */ - for (i = 0; i < priv->cfg->num_irqs; i++) { + for (i = 0; i < priv->cfg->num_adcs; i++) { if ((status & priv->cfg->regs->eoc_msk[i] && stm32_adc_eoc_enabled(priv, i)) || (status & priv->cfg->regs->ovr_msk[i])) @@ -784,6 +786,7 @@ static const struct stm32_adc_priv_cfg s .clk_sel = stm32f4_adc_clk_sel, .max_clk_rate_hz = 36000000, .num_irqs = 1, + .num_adcs = 3, }; static const struct stm32_adc_priv_cfg stm32h7_adc_priv_cfg = { @@ -792,6 +795,7 @@ static const struct stm32_adc_priv_cfg s .max_clk_rate_hz = 36000000, .has_syscfg = HAS_VBOOSTER, .num_irqs = 1, + .num_adcs = 2, }; static const struct stm32_adc_priv_cfg stm32mp1_adc_priv_cfg = { @@ -800,6 +804,7 @@ static const struct stm32_adc_priv_cfg s .max_clk_rate_hz = 36000000, .has_syscfg = HAS_VBOOSTER | HAS_ANASWVDD, .num_irqs = 2, + .num_adcs = 2, }; static const struct of_device_id stm32_adc_of_match[] = {