Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2912137iog; Mon, 27 Jun 2022 05:37:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vWFg7Q0cNiHvHR/ZdLHfby/dxfIsO/ZZSMsLtQHbyZFBU0HmbNVnwwrw9TLyvKiGjnldOm X-Received: by 2002:a05:6402:2750:b0:435:ab9f:1235 with SMTP id z16-20020a056402275000b00435ab9f1235mr16548116edd.188.1656333438224; Mon, 27 Jun 2022 05:37:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333438; cv=none; d=google.com; s=arc-20160816; b=g9N8eShyG3gz/x2zt51UvFkkC6DtnrC0rcQqzin0GfGeRy/v19S8PHMw8Sen6wRtLh F/M6v1W6TcNN1thCaR0Ui7Appbt3MAtznkuNFQ9IGIv7K1XGiXDoudJZ0jE+u8c6KlTp m166i7DPr9wF2lAGpsvpmb41mb4V778P5SdkRxN62fyrJwJ11pmqBtIMPu60ahhNtF6E HHHZkM/ZnqWTPh/7jIJuQxB76A02r/UH/t3UXhO2N3dnFuwbKbJ6hZu8sp5K73N7Mg1+ FJZPmFBAtDG8kxPeVfY5Ed4d3NGP2QKjoaeU8XOdpiDhs605XNxzBzpq7wiBh6fU0X3v olIg== 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=t4pBUcSGEA3Yq6CLLuXAOOv/m/tSb23TfRIsbthZUao=; b=eSySGDuZhFYzJJ6sQnyw/dsvA7Du8wymIqXUYc6N98cZz7e/mixFS/4Jyi/MSYKACl 7FGrjINUCCgiLm8f4yNYvr/axsbJo7JyW3LBRLg1vwGoJBiG5gB9FR/Bw0OCipQ1LFgQ IsGG5OggaevKxdSiEzceaxVNq45x7Oz90LZNKLfeUI7YLGr4TX2bC+mFSsoAeRE5Yc5w xoWgbbztC+5osDIOO9Eb4S/Lb6Yps+0Jh8c0AJ30YRWpzEsbbDX6XyjVGZ/g1UYaJ9Ho evRntpCPGDXjxutueQ80VqRcGQO6TFwyAzOHe0DLck+NrCxRqYMISGuCxDx6x35Habjm Wexg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PHxldZ4c; 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 b20-20020a0564021f1400b0043580c393casi12191272edb.40.2022.06.27.05.36.53; Mon, 27 Jun 2022 05:37:18 -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=PHxldZ4c; 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 S238931AbiF0L4F (ORCPT + 99 others); Mon, 27 Jun 2022 07:56:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237061AbiF0Lsu (ORCPT ); Mon, 27 Jun 2022 07:48:50 -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 CE871D60; Mon, 27 Jun 2022 04:42:50 -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 8A3DFB80E32; Mon, 27 Jun 2022 11:42:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2E01C3411D; Mon, 27 Jun 2022 11:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656330168; bh=iw43diHJtN+Vp2gXJ7OHL4Zzhj+a3l8VTeGf8BfgsPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PHxldZ4cio8tYH+ZgsIbTVrKmcP0OxsfdQr+fJEj2aqvHt6l/fFEOPzzB8bHvi7ZV lAWruDPlfthmGVREY8p3Fkn6loCj/40IGF8MoQ87lMtDPLABDI/8QZBeXRuJYbGqu4 3/q3+KvCwtyk954XrzuqSxZYbRjO7dff7pUlYmMo= 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.18 090/181] regmap-irq: Fix a bug in regmap_irq_enable() for type_in_mask chips Date: Mon, 27 Jun 2022 13:21:03 +0200 Message-Id: <20220627111947.169713407@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111944.553492442@linuxfoundation.org> References: <20220627111944.553492442@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 400c7412a7dc..4f785bc7981c 100644 --- a/drivers/base/regmap/regmap-irq.c +++ b/drivers/base/regmap/regmap-irq.c @@ -252,6 +252,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; @@ -268,14 +269,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