irqchip: atmel-aic-common: Prevent clobbering of priority when changing IRQ type

This patch makes the bitmask for AIC_SRCTYPE consistent
with that of its valid values, and prevents the priority
field at bits 2:0 from being clobbered by an incorrect
AND with the AIC_SRCTYPE mask.

Signed-off-by: Gavin Li <[email protected]>
Cc: <[email protected]> # v3.17+
Acked-by: Boris Brezillon <[email protected]>
Acked-by: Nicolas Ferre <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Jason Cooper <[email protected]>
This commit is contained in:
Gavin Li 2015-01-06 18:47:23 -08:00 • committed by Jason Cooper
commit 91d1179212

View file

@ -28,7 +28,7 @@
#define AT91_AIC_IRQ_MIN_PRIORITY 0
#define AT91_AIC_IRQ_MAX_PRIORITY 7
#define AT91_AIC_SRCTYPE GENMASK(7, 6)
#define AT91_AIC_SRCTYPE GENMASK(6, 5)
#define AT91_AIC_SRCTYPE_LOW (0 << 5)
#define AT91_AIC_SRCTYPE_FALLING (1 << 5)
#define AT91_AIC_SRCTYPE_HIGH (2 << 5)
@ -74,7 +74,7 @@ int aic_common_set_type(struct irq_data *d, unsigned type, unsigned *val)
return -EINVAL;
}
*val &= AT91_AIC_SRCTYPE;
*val &= ~AT91_AIC_SRCTYPE;
*val |= aic_type;
return 0;