Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2905198iog; Mon, 27 Jun 2022 05:29:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s+46AvIXlJv/5B+OYc/zCJlTjeVLmUdDDobDulMjy0z92uATbzRsZDlhVzuV7lkoIcRzcC X-Received: by 2002:a05:6402:2312:b0:437:69ec:adef with SMTP id l18-20020a056402231200b0043769ecadefmr15882439eda.366.1656332973677; Mon, 27 Jun 2022 05:29:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656332973; cv=none; d=google.com; s=arc-20160816; b=S2OtXW+4uRMcTEHCLHFMvxvd+KVeLxG0FXDTsFf5aUuh1eCklhGJuiWRGDFLnMP8HX cK9VWp0yIyj8Fo0UYKGb40BpJ8AU5CMLANpcjtFHte5OnrEDxB8A7YESEbk6RcgL3Fe+ m/vNPcC0X58vegG5ihpTt/Xy15Dw1aCN1aahe80fhso2wtzDrjzb3fDoYosGJodfFGnH QLRk6VqWfp/zFDQ7rOgoBTMjUlqd5Szx09U5L6YKPfbmiLJpZSuFpS27J041+a28opQj V+gTtQY8U+NOmLlRumG+oD2wIeHS9tMJaXLMocq5hWtE8NvSlfXLBQu5W4erK9rKInPH roSQ== 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=9FlzI3DoSXtBeycfW64lVKkvI4NTHxBaSy/xTA0p/wk=; b=ivyJ3gYj+j15K7ik4EWG1xCjoKEls1D7aZMjcezxpaekBsX9La1uHSEZd+/LpO4yGY 2Fi4odXrtItn56N+EZSooUMFBDAAvdqyVEwcSEGSCLJWrC7KqIH/PneMNyrAp0jniSBl wbtN5287mWbhLEv0HR9UEUsINU5ZbSn8R7Z2X7+Ze0WscRJNvtBTxTcvuAxlVrF48OiT YM3niLUIy3tiLDiz7mhZGzfsDPc7gMwjDCVwivwpUqMANQkoxHRnkSn6RaZlM5R++YAZ gvVbCZFkUYo5rCzKOjPG85aFbVnnSFcpMojxbYn0KNnKQmbGaDM6vYh23pIJPbFLhuD2 mr5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=O0zLexhS; 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 w3-20020a056402268300b0042e30989df3si15004571edd.147.2022.06.27.05.29.08; Mon, 27 Jun 2022 05:29:33 -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=O0zLexhS; 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 S235625AbiF0LcU (ORCPT + 99 others); Mon, 27 Jun 2022 07:32:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235104AbiF0Lb4 (ORCPT ); Mon, 27 Jun 2022 07:31:56 -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 3D878117C; Mon, 27 Jun 2022 04:29:12 -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 7B43EB81120; Mon, 27 Jun 2022 11:29:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C96C1C3411D; Mon, 27 Jun 2022 11:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656329349; bh=AQ+qKiZJFbHOjNCj/teult017izcdEKNS540K4VL6qU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O0zLexhSVdruxmkOSrrjpSvgGQfTuhaa88j6xVZ3MeOcmP3IRuvj2BjmfzYF7ljrx eQPtTS7tV56NtMFXbdjO6nA9zZQL9Vamov7hyDqNOMtgQc0Z/6EEap96t7dLQelDho dA0chPbF8BnY0O5E5SKp0pBXGXc4UKNQE29faD24= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aidan MacDonald , Mark Brown , Sasha Levin Subject: [PATCH 5.4 29/60] regmap-irq: Fix a bug in regmap_irq_enable() for type_in_mask chips Date: Mon, 27 Jun 2022 13:21:40 +0200 Message-Id: <20220627111928.544357960@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111927.641837068@linuxfoundation.org> References: <20220627111927.641837068@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: Aidan MacDonald [ Upstream commit 485037ae9a095491beb7f893c909a76cc4f9d1e7 ] When enabling a type_in_mask irq, the type_buf contents must be AND'd with the mask of the IRQ we're enabling to avoid enabling other IRQs by accident, which can happen if several type_in_mask irqs share a mask register. Fixes: bc998a730367 ("regmap: irq: handle HW using separate rising/falling edge interrupts") Signed-off-by: Aidan MacDonald Link: https://lore.kernel.org/r/20220620200644.1961936-2-aidanmacdonald.0x0@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/base/regmap/regmap-irq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c index 3d64c9331a82..3c1e554df4eb 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -214,6 +214,7 @@ static void regmap_irq_enable(struct irq_data *data) struct regmap_irq_chip_data *d = irq_data_get_irq_chip_data(data); struct regmap *map = d->map; const struct regmap_irq *irq_data = irq_to_regmap_irq(d, data->hwirq); + unsigned int reg = irq_data->reg_offset / map->reg_stride; unsigned int mask, type; type = irq_data->type.type_falling_val | irq_data->type.type_rising_val; @@ -230,14 +231,14 @@ static void regmap_irq_enable(struct irq_data *data) * at the corresponding offset in regmap_irq_set_type(). */ if (d->chip->type_in_mask && type) - mask = d->type_buf[irq_data->reg_offset / map->reg_stride]; + mask = d->type_buf[reg] & irq_data->mask; else mask = irq_data->mask; if (d->chip->clear_on_unmask) d->clear_status = true; - d->mask_buf[irq_data->reg_offset / map->reg_stride] &= ~mask; + d->mask_buf[reg] &= ~mask; } static void regmap_irq_disable(struct irq_data *data) -- 2.35.1