Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2909712iog; Mon, 27 Jun 2022 05:34:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1swc0C2SD2quzbcyQ5TSdeRWzSY2fla3t5JPCEdsgmAVprghp2NmJ0+6Sla1YND6q++bwrU X-Received: by 2002:a17:90b:b12:b0:1ee:f30f:2fdf with SMTP id bf18-20020a17090b0b1200b001eef30f2fdfmr812982pjb.146.1656333265040; Mon, 27 Jun 2022 05:34:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333265; cv=none; d=google.com; s=arc-20160816; b=s908GQjQ8ORLEu6fCiLCzjhxJcNSccxxYHdbeLiz1PdhD1NkMzst6i3IqvtwUvfv6A XSps5L0h1iTZde9WkkVRoTB/LJVFQjYHGUdXD1D5G3LmKJTUZGFgwPObGUKWTcftGKPp SnqChJqEuiqGx3772tNEMJhyiI2zsdq+1C+dEhzsnJwjn2c5Zy8S1JJQqp/NDmPp5rf5 h1qVzX+fmK8TbhrygPv+ocA3g00/JfM4dqgZflP7drMtn29wAx/2TG4EyfE2unFVW29o 6m5bi4cwYOE5o7uifZ6n9F7Ublj4x7UX8xLfLi0LjGnW1bJZJgbrFvcNEgoGHPIN72jj Prsw== 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=lICUAaRS5y+pj5UuLV1yNG/Nl1R09cmzIdbCXkkBYc0=; b=MiTON/5Z+5xxYKVro4csjuakzJ8PDSwNkHL1RidBPuEHkz9WLYUVYVhKeX4ATU2BPj FYKPoWuJu3z47yIRwgZNjtF7o8Zk6nU+mAsfOotx896eRY02N9U9tTV4fp5B4e2eZdny 46fuw4qk0d1QiKIxBPirX+/6JfVNAFbZyJTHcU5ngrYtpXYXG3NIWVbw0TAAnfCjZaZa XOqoQgTzWVUssZMgrCZ8Y6eFz9IkJLng3zpxznc2ilsnCZ5Iu8KjTskCeeEcJEgIEVX7 K9XS/Z3ZNMn6V0QJVhrqPDk+5WKR8S3acYNfNUsLb1G5KO7NFMhaN1yr2t+4eZ0p9i78 kRuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MP1FFCYM; 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 ik18-20020a170902ab1200b0016a080b3988si15915884plb.130.2022.06.27.05.34.12; Mon, 27 Jun 2022 05:34:25 -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=MP1FFCYM; 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 S234940AbiF0LZg (ORCPT + 99 others); Mon, 27 Jun 2022 07:25:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234852AbiF0LZC (ORCPT ); Mon, 27 Jun 2022 07:25:02 -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 AE23565A4; Mon, 27 Jun 2022 04:25:00 -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 269EEB81131; Mon, 27 Jun 2022 11:24:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E158C341CE; Mon, 27 Jun 2022 11:24:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656329097; bh=imWpLDIsJjUTNYncTyKlDjjIaGoQwmFKsOjWoAA651Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MP1FFCYMWpj3Yk48aFT6KPYNf24BUpSGvu4qpPxhA1KeQtg/EPP2ZwNa4Ie280ZxM yKHdXv6LL2NOG8schf2R2yQTE7iat5Zf5yHfUtoG7b3u7ktQjFEYtZQxz0irvQSUZ0 axbGQfGz8xNmgglv45lD66PsdOnMbAmtBffm2dG4= 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.10 050/102] regmap-irq: Fix a bug in regmap_irq_enable() for type_in_mask chips Date: Mon, 27 Jun 2022 13:21:01 +0200 Message-Id: <20220627111934.957104272@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: 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 87c5c421e0f4..4466f8bdab2e 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -220,6 +220,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; @@ -236,14 +237,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