Patch "regmap-irq: Fix a bug in regmap_irq_enable() for type_in_mask chips" has been added to the 5.18-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    regmap-irq: Fix a bug in regmap_irq_enable() for type_in_mask chips

to the 5.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     regmap-irq-fix-a-bug-in-regmap_irq_enable-for-type_i.patch
and it can be found in the queue-5.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 1361be52051ac0e03396564a6512d7bb96ca135d
Author: Aidan MacDonald <aidanmacdonald.0x0@xxxxxxxxx>
Date:   Mon Jun 20 21:05:56 2022 +0100

    regmap-irq: Fix a bug in regmap_irq_enable() for type_in_mask chips
    
    [ 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 <aidanmacdonald.0x0@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20220620200644.1961936-2-aidanmacdonald.0x0@xxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

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)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux