mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	irqchip: Convert generic irqchip locking to guards
Conversion was done with Coccinelle and a few manual fixups. In a few interrupt chip callbacks this changes replaces raw_spin_lock_irqsave() with a guard(raw_spinlock). That's intended and correct because those interrupt chip callbacks are invoked with the interrupt descriptor lock held and interrupts disabled. No point in using the irqsave variant. No functional change. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/all/20250313142524.325627746@linutronix.de
This commit is contained in:
		
							parent
							
								
									9949aec666
								
							
						
					
					
						commit
						b00bee8afa
					
				
					 14 changed files with 56 additions and 127 deletions
				
			
		| 
						 | 
					@ -65,15 +65,13 @@ static int al_fic_irq_set_type(struct irq_data *data, unsigned int flow_type)
 | 
				
			||||||
	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data);
 | 
						struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data);
 | 
				
			||||||
	struct al_fic *fic = gc->private;
 | 
						struct al_fic *fic = gc->private;
 | 
				
			||||||
	enum al_fic_state new_state;
 | 
						enum al_fic_state new_state;
 | 
				
			||||||
	int ret = 0;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (((flow_type & IRQ_TYPE_SENSE_MASK) != IRQ_TYPE_LEVEL_HIGH) &&
 | 
						if (((flow_type & IRQ_TYPE_SENSE_MASK) != IRQ_TYPE_LEVEL_HIGH) &&
 | 
				
			||||||
	    ((flow_type & IRQ_TYPE_SENSE_MASK) != IRQ_TYPE_EDGE_RISING)) {
 | 
						    ((flow_type & IRQ_TYPE_SENSE_MASK) != IRQ_TYPE_EDGE_RISING)) {
 | 
				
			||||||
		pr_debug("fic doesn't support flow type %d\n", flow_type);
 | 
							pr_debug("fic doesn't support flow type %d\n", flow_type);
 | 
				
			||||||
		ret = -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
		goto err;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	new_state = (flow_type & IRQ_TYPE_LEVEL_HIGH) ?
 | 
						new_state = (flow_type & IRQ_TYPE_LEVEL_HIGH) ?
 | 
				
			||||||
| 
						 | 
					@ -91,16 +89,10 @@ static int al_fic_irq_set_type(struct irq_data *data, unsigned int flow_type)
 | 
				
			||||||
	if (fic->state == AL_FIC_UNCONFIGURED) {
 | 
						if (fic->state == AL_FIC_UNCONFIGURED) {
 | 
				
			||||||
		al_fic_set_trigger(fic, gc, new_state);
 | 
							al_fic_set_trigger(fic, gc, new_state);
 | 
				
			||||||
	} else if (fic->state != new_state) {
 | 
						} else if (fic->state != new_state) {
 | 
				
			||||||
		pr_debug("fic %s state already configured to %d\n",
 | 
							pr_debug("fic %s state already configured to %d\n", fic->name, fic->state);
 | 
				
			||||||
			 fic->name, fic->state);
 | 
							return -EINVAL;
 | 
				
			||||||
		ret = -EINVAL;
 | 
					 | 
				
			||||||
		goto err;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
err:
 | 
					 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return ret;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void al_fic_irq_handler(struct irq_desc *desc)
 | 
					static void al_fic_irq_handler(struct irq_desc *desc)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,9 +78,8 @@ static int aic_retrigger(struct irq_data *d)
 | 
				
			||||||
	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
						struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Enable interrupt on AIC5 */
 | 
						/* Enable interrupt on AIC5 */
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
	irq_reg_writel(gc, d->mask, AT91_AIC_ISCR);
 | 
						irq_reg_writel(gc, d->mask, AT91_AIC_ISCR);
 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -106,30 +105,27 @@ static void aic_suspend(struct irq_data *d)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
						struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
	irq_reg_writel(gc, gc->mask_cache, AT91_AIC_IDCR);
 | 
						irq_reg_writel(gc, gc->mask_cache, AT91_AIC_IDCR);
 | 
				
			||||||
	irq_reg_writel(gc, gc->wake_active, AT91_AIC_IECR);
 | 
						irq_reg_writel(gc, gc->wake_active, AT91_AIC_IECR);
 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void aic_resume(struct irq_data *d)
 | 
					static void aic_resume(struct irq_data *d)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
						struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
	irq_reg_writel(gc, gc->wake_active, AT91_AIC_IDCR);
 | 
						irq_reg_writel(gc, gc->wake_active, AT91_AIC_IDCR);
 | 
				
			||||||
	irq_reg_writel(gc, gc->mask_cache, AT91_AIC_IECR);
 | 
						irq_reg_writel(gc, gc->mask_cache, AT91_AIC_IECR);
 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void aic_pm_shutdown(struct irq_data *d)
 | 
					static void aic_pm_shutdown(struct irq_data *d)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
						struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
	irq_reg_writel(gc, 0xffffffff, AT91_AIC_IDCR);
 | 
						irq_reg_writel(gc, 0xffffffff, AT91_AIC_IDCR);
 | 
				
			||||||
	irq_reg_writel(gc, 0xffffffff, AT91_AIC_ICCR);
 | 
						irq_reg_writel(gc, 0xffffffff, AT91_AIC_ICCR);
 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define aic_suspend		NULL
 | 
					#define aic_suspend		NULL
 | 
				
			||||||
| 
						 | 
					@ -175,10 +171,8 @@ static int aic_irq_domain_xlate(struct irq_domain *d,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct irq_domain_chip_generic *dgc = d->gc;
 | 
						struct irq_domain_chip_generic *dgc = d->gc;
 | 
				
			||||||
	struct irq_chip_generic *gc;
 | 
						struct irq_chip_generic *gc;
 | 
				
			||||||
	unsigned long flags;
 | 
					 | 
				
			||||||
	unsigned smr;
 | 
						unsigned smr;
 | 
				
			||||||
	int idx;
 | 
						int idx, ret;
 | 
				
			||||||
	int ret;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!dgc)
 | 
						if (!dgc)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
| 
						 | 
					@ -194,11 +188,10 @@ static int aic_irq_domain_xlate(struct irq_domain *d,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	gc = dgc->gc[idx];
 | 
						gc = dgc->gc[idx];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock_irqsave(gc, flags);
 | 
						guard(raw_spinlock_irq)(&gc->lock);
 | 
				
			||||||
	smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq));
 | 
						smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq));
 | 
				
			||||||
	aic_common_set_priority(intspec[2], &smr);
 | 
						aic_common_set_priority(intspec[2], &smr);
 | 
				
			||||||
	irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq));
 | 
						irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq));
 | 
				
			||||||
	irq_gc_unlock_irqrestore(gc, flags);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -92,11 +92,10 @@ static void aic5_mask(struct irq_data *d)
 | 
				
			||||||
	 * Disable interrupt on AIC5. We always take the lock of the
 | 
						 * Disable interrupt on AIC5. We always take the lock of the
 | 
				
			||||||
	 * first irq chip as all chips share the same registers.
 | 
						 * first irq chip as all chips share the same registers.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	irq_gc_lock(bgc);
 | 
						guard(raw_spinlock)(&bgc->lock);
 | 
				
			||||||
	irq_reg_writel(gc, d->hwirq, AT91_AIC5_SSR);
 | 
						irq_reg_writel(gc, d->hwirq, AT91_AIC5_SSR);
 | 
				
			||||||
	irq_reg_writel(gc, 1, AT91_AIC5_IDCR);
 | 
						irq_reg_writel(gc, 1, AT91_AIC5_IDCR);
 | 
				
			||||||
	gc->mask_cache &= ~d->mask;
 | 
						gc->mask_cache &= ~d->mask;
 | 
				
			||||||
	irq_gc_unlock(bgc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void aic5_unmask(struct irq_data *d)
 | 
					static void aic5_unmask(struct irq_data *d)
 | 
				
			||||||
| 
						 | 
					@ -109,11 +108,10 @@ static void aic5_unmask(struct irq_data *d)
 | 
				
			||||||
	 * Enable interrupt on AIC5. We always take the lock of the
 | 
						 * Enable interrupt on AIC5. We always take the lock of the
 | 
				
			||||||
	 * first irq chip as all chips share the same registers.
 | 
						 * first irq chip as all chips share the same registers.
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	irq_gc_lock(bgc);
 | 
						guard(raw_spinlock)(&bgc->lock);
 | 
				
			||||||
	irq_reg_writel(gc, d->hwirq, AT91_AIC5_SSR);
 | 
						irq_reg_writel(gc, d->hwirq, AT91_AIC5_SSR);
 | 
				
			||||||
	irq_reg_writel(gc, 1, AT91_AIC5_IECR);
 | 
						irq_reg_writel(gc, 1, AT91_AIC5_IECR);
 | 
				
			||||||
	gc->mask_cache |= d->mask;
 | 
						gc->mask_cache |= d->mask;
 | 
				
			||||||
	irq_gc_unlock(bgc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int aic5_retrigger(struct irq_data *d)
 | 
					static int aic5_retrigger(struct irq_data *d)
 | 
				
			||||||
| 
						 | 
					@ -122,11 +120,9 @@ static int aic5_retrigger(struct irq_data *d)
 | 
				
			||||||
	struct irq_chip_generic *bgc = irq_get_domain_generic_chip(domain, 0);
 | 
						struct irq_chip_generic *bgc = irq_get_domain_generic_chip(domain, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Enable interrupt on AIC5 */
 | 
						/* Enable interrupt on AIC5 */
 | 
				
			||||||
	irq_gc_lock(bgc);
 | 
						guard(raw_spinlock)(&bgc->lock);
 | 
				
			||||||
	irq_reg_writel(bgc, d->hwirq, AT91_AIC5_SSR);
 | 
						irq_reg_writel(bgc, d->hwirq, AT91_AIC5_SSR);
 | 
				
			||||||
	irq_reg_writel(bgc, 1, AT91_AIC5_ISCR);
 | 
						irq_reg_writel(bgc, 1, AT91_AIC5_ISCR);
 | 
				
			||||||
	irq_gc_unlock(bgc);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return 1;
 | 
						return 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -137,14 +133,12 @@ static int aic5_set_type(struct irq_data *d, unsigned type)
 | 
				
			||||||
	unsigned int smr;
 | 
						unsigned int smr;
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(bgc);
 | 
						guard(raw_spinlock)(&bgc->lock);
 | 
				
			||||||
	irq_reg_writel(bgc, d->hwirq, AT91_AIC5_SSR);
 | 
						irq_reg_writel(bgc, d->hwirq, AT91_AIC5_SSR);
 | 
				
			||||||
	smr = irq_reg_readl(bgc, AT91_AIC5_SMR);
 | 
						smr = irq_reg_readl(bgc, AT91_AIC5_SMR);
 | 
				
			||||||
	ret = aic_common_set_type(d, type, &smr);
 | 
						ret = aic_common_set_type(d, type, &smr);
 | 
				
			||||||
	if (!ret)
 | 
						if (!ret)
 | 
				
			||||||
		irq_reg_writel(bgc, smr, AT91_AIC5_SMR);
 | 
							irq_reg_writel(bgc, smr, AT91_AIC5_SMR);
 | 
				
			||||||
	irq_gc_unlock(bgc);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -166,7 +160,7 @@ static void aic5_suspend(struct irq_data *d)
 | 
				
			||||||
			smr_cache[i] = irq_reg_readl(bgc, AT91_AIC5_SMR);
 | 
								smr_cache[i] = irq_reg_readl(bgc, AT91_AIC5_SMR);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(bgc);
 | 
						guard(raw_spinlock)(&bgc->lock);
 | 
				
			||||||
	for (i = 0; i < dgc->irqs_per_chip; i++) {
 | 
						for (i = 0; i < dgc->irqs_per_chip; i++) {
 | 
				
			||||||
		mask = 1 << i;
 | 
							mask = 1 << i;
 | 
				
			||||||
		if ((mask & gc->mask_cache) == (mask & gc->wake_active))
 | 
							if ((mask & gc->mask_cache) == (mask & gc->wake_active))
 | 
				
			||||||
| 
						 | 
					@ -178,7 +172,6 @@ static void aic5_suspend(struct irq_data *d)
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			irq_reg_writel(bgc, 1, AT91_AIC5_IDCR);
 | 
								irq_reg_writel(bgc, 1, AT91_AIC5_IDCR);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	irq_gc_unlock(bgc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void aic5_resume(struct irq_data *d)
 | 
					static void aic5_resume(struct irq_data *d)
 | 
				
			||||||
| 
						 | 
					@ -190,7 +183,7 @@ static void aic5_resume(struct irq_data *d)
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
	u32 mask;
 | 
						u32 mask;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(bgc);
 | 
						guard(raw_spinlock)(&bgc->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (smr_cache) {
 | 
						if (smr_cache) {
 | 
				
			||||||
		irq_reg_writel(bgc, 0xffffffff, AT91_AIC5_SPU);
 | 
							irq_reg_writel(bgc, 0xffffffff, AT91_AIC5_SPU);
 | 
				
			||||||
| 
						 | 
					@ -214,7 +207,6 @@ static void aic5_resume(struct irq_data *d)
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			irq_reg_writel(bgc, 1, AT91_AIC5_IDCR);
 | 
								irq_reg_writel(bgc, 1, AT91_AIC5_IDCR);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	irq_gc_unlock(bgc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void aic5_pm_shutdown(struct irq_data *d)
 | 
					static void aic5_pm_shutdown(struct irq_data *d)
 | 
				
			||||||
| 
						 | 
					@ -225,13 +217,12 @@ static void aic5_pm_shutdown(struct irq_data *d)
 | 
				
			||||||
	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
						struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(bgc);
 | 
						guard(raw_spinlock)(&bgc->lock);
 | 
				
			||||||
	for (i = 0; i < dgc->irqs_per_chip; i++) {
 | 
						for (i = 0; i < dgc->irqs_per_chip; i++) {
 | 
				
			||||||
		irq_reg_writel(bgc, i + gc->irq_base, AT91_AIC5_SSR);
 | 
							irq_reg_writel(bgc, i + gc->irq_base, AT91_AIC5_SSR);
 | 
				
			||||||
		irq_reg_writel(bgc, 1, AT91_AIC5_IDCR);
 | 
							irq_reg_writel(bgc, 1, AT91_AIC5_IDCR);
 | 
				
			||||||
		irq_reg_writel(bgc, 1, AT91_AIC5_ICCR);
 | 
							irq_reg_writel(bgc, 1, AT91_AIC5_ICCR);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	irq_gc_unlock(bgc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define aic5_suspend		NULL
 | 
					#define aic5_suspend		NULL
 | 
				
			||||||
| 
						 | 
					@ -277,7 +268,6 @@ static int aic5_irq_domain_xlate(struct irq_domain *d,
 | 
				
			||||||
				 unsigned int *out_type)
 | 
									 unsigned int *out_type)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct irq_chip_generic *bgc = irq_get_domain_generic_chip(d, 0);
 | 
						struct irq_chip_generic *bgc = irq_get_domain_generic_chip(d, 0);
 | 
				
			||||||
	unsigned long flags;
 | 
					 | 
				
			||||||
	unsigned smr;
 | 
						unsigned smr;
 | 
				
			||||||
	int ret;
 | 
						int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -289,13 +279,11 @@ static int aic5_irq_domain_xlate(struct irq_domain *d,
 | 
				
			||||||
	if (ret)
 | 
						if (ret)
 | 
				
			||||||
		return ret;
 | 
							return ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock_irqsave(bgc, flags);
 | 
						guard(raw_spinlock_irq)(&bgc->lock);
 | 
				
			||||||
	irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR);
 | 
						irq_reg_writel(bgc, *out_hwirq, AT91_AIC5_SSR);
 | 
				
			||||||
	smr = irq_reg_readl(bgc, AT91_AIC5_SMR);
 | 
						smr = irq_reg_readl(bgc, AT91_AIC5_SMR);
 | 
				
			||||||
	aic_common_set_priority(intspec[2], &smr);
 | 
						aic_common_set_priority(intspec[2], &smr);
 | 
				
			||||||
	irq_reg_writel(bgc, smr, AT91_AIC5_SMR);
 | 
						irq_reg_writel(bgc, smr, AT91_AIC5_SMR);
 | 
				
			||||||
	irq_gc_unlock_irqrestore(bgc, flags);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,16 +63,15 @@ static void bcm7120_l2_intc_irq_handle(struct irq_desc *desc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (idx = 0; idx < b->n_words; idx++) {
 | 
						for (idx = 0; idx < b->n_words; idx++) {
 | 
				
			||||||
		int base = idx * IRQS_PER_WORD;
 | 
							int base = idx * IRQS_PER_WORD;
 | 
				
			||||||
		struct irq_chip_generic *gc =
 | 
							struct irq_chip_generic *gc;
 | 
				
			||||||
			irq_get_domain_generic_chip(b->domain, base);
 | 
					 | 
				
			||||||
		unsigned long pending;
 | 
							unsigned long pending;
 | 
				
			||||||
		int hwirq;
 | 
							int hwirq;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		irq_gc_lock(gc);
 | 
							gc = irq_get_domain_generic_chip(b->domain, base);
 | 
				
			||||||
		pending = irq_reg_readl(gc, b->stat_offset[idx]) &
 | 
							scoped_guard (raw_spinlock, &gc->lock) {
 | 
				
			||||||
					    gc->mask_cache &
 | 
								pending = irq_reg_readl(gc, b->stat_offset[idx]) & gc->mask_cache &
 | 
				
			||||||
				data->irq_map_mask[idx];
 | 
									data->irq_map_mask[idx];
 | 
				
			||||||
		irq_gc_unlock(gc);
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for_each_set_bit(hwirq, &pending, IRQS_PER_WORD)
 | 
							for_each_set_bit(hwirq, &pending, IRQS_PER_WORD)
 | 
				
			||||||
			generic_handle_domain_irq(b->domain, base + hwirq);
 | 
								generic_handle_domain_irq(b->domain, base + hwirq);
 | 
				
			||||||
| 
						 | 
					@ -86,11 +85,9 @@ static void bcm7120_l2_intc_suspend(struct irq_chip_generic *gc)
 | 
				
			||||||
	struct bcm7120_l2_intc_data *b = gc->private;
 | 
						struct bcm7120_l2_intc_data *b = gc->private;
 | 
				
			||||||
	struct irq_chip_type *ct = gc->chip_types;
 | 
						struct irq_chip_type *ct = gc->chip_types;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
	if (b->can_wake)
 | 
						if (b->can_wake)
 | 
				
			||||||
		irq_reg_writel(gc, gc->mask_cache | gc->wake_active,
 | 
							irq_reg_writel(gc, gc->mask_cache | gc->wake_active, ct->regs.mask);
 | 
				
			||||||
			       ct->regs.mask);
 | 
					 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void bcm7120_l2_intc_resume(struct irq_chip_generic *gc)
 | 
					static void bcm7120_l2_intc_resume(struct irq_chip_generic *gc)
 | 
				
			||||||
| 
						 | 
					@ -98,9 +95,8 @@ static void bcm7120_l2_intc_resume(struct irq_chip_generic *gc)
 | 
				
			||||||
	struct irq_chip_type *ct = gc->chip_types;
 | 
						struct irq_chip_type *ct = gc->chip_types;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Restore the saved mask */
 | 
						/* Restore the saved mask */
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
	irq_reg_writel(gc, gc->mask_cache, ct->regs.mask);
 | 
						irq_reg_writel(gc, gc->mask_cache, ct->regs.mask);
 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int bcm7120_l2_intc_init_one(struct device_node *dn,
 | 
					static int bcm7120_l2_intc_init_one(struct device_node *dn,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -97,9 +97,8 @@ static void __brcmstb_l2_intc_suspend(struct irq_data *d, bool save)
 | 
				
			||||||
	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
						struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
				
			||||||
	struct irq_chip_type *ct = irq_data_get_chip_type(d);
 | 
						struct irq_chip_type *ct = irq_data_get_chip_type(d);
 | 
				
			||||||
	struct brcmstb_l2_intc_data *b = gc->private;
 | 
						struct brcmstb_l2_intc_data *b = gc->private;
 | 
				
			||||||
	unsigned long flags;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock_irqsave(gc, flags);
 | 
						guard(raw_spinlock_irqsave)(&gc->lock);
 | 
				
			||||||
	/* Save the current mask */
 | 
						/* Save the current mask */
 | 
				
			||||||
	if (save)
 | 
						if (save)
 | 
				
			||||||
		b->saved_mask = irq_reg_readl(gc, ct->regs.mask);
 | 
							b->saved_mask = irq_reg_readl(gc, ct->regs.mask);
 | 
				
			||||||
| 
						 | 
					@ -109,7 +108,6 @@ static void __brcmstb_l2_intc_suspend(struct irq_data *d, bool save)
 | 
				
			||||||
		irq_reg_writel(gc, ~gc->wake_active, ct->regs.disable);
 | 
							irq_reg_writel(gc, ~gc->wake_active, ct->regs.disable);
 | 
				
			||||||
		irq_reg_writel(gc, gc->wake_active, ct->regs.enable);
 | 
							irq_reg_writel(gc, gc->wake_active, ct->regs.enable);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	irq_gc_unlock_irqrestore(gc, flags);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void brcmstb_l2_intc_shutdown(struct irq_data *d)
 | 
					static void brcmstb_l2_intc_shutdown(struct irq_data *d)
 | 
				
			||||||
| 
						 | 
					@ -127,9 +125,8 @@ static void brcmstb_l2_intc_resume(struct irq_data *d)
 | 
				
			||||||
	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
						struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
				
			||||||
	struct irq_chip_type *ct = irq_data_get_chip_type(d);
 | 
						struct irq_chip_type *ct = irq_data_get_chip_type(d);
 | 
				
			||||||
	struct brcmstb_l2_intc_data *b = gc->private;
 | 
						struct brcmstb_l2_intc_data *b = gc->private;
 | 
				
			||||||
	unsigned long flags;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock_irqsave(gc, flags);
 | 
						guard(raw_spinlock_irqsave)(&gc->lock);
 | 
				
			||||||
	if (ct->chip.irq_ack) {
 | 
						if (ct->chip.irq_ack) {
 | 
				
			||||||
		/* Clear unmasked non-wakeup interrupts */
 | 
							/* Clear unmasked non-wakeup interrupts */
 | 
				
			||||||
		irq_reg_writel(gc, ~b->saved_mask & ~gc->wake_active,
 | 
							irq_reg_writel(gc, ~b->saved_mask & ~gc->wake_active,
 | 
				
			||||||
| 
						 | 
					@ -139,7 +136,6 @@ static void brcmstb_l2_intc_resume(struct irq_data *d)
 | 
				
			||||||
	/* Restore the saved mask */
 | 
						/* Restore the saved mask */
 | 
				
			||||||
	irq_reg_writel(gc, b->saved_mask, ct->regs.disable);
 | 
						irq_reg_writel(gc, b->saved_mask, ct->regs.disable);
 | 
				
			||||||
	irq_reg_writel(gc, ~b->saved_mask, ct->regs.enable);
 | 
						irq_reg_writel(gc, ~b->saved_mask, ct->regs.enable);
 | 
				
			||||||
	irq_gc_unlock_irqrestore(gc, flags);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int __init brcmstb_l2_intc_of_init(struct device_node *np,
 | 
					static int __init brcmstb_l2_intc_of_init(struct device_node *np,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,11 +50,10 @@ static void irq_ck_mask_set_bit(struct irq_data *d)
 | 
				
			||||||
	unsigned long ifr = ct->regs.mask - 8;
 | 
						unsigned long ifr = ct->regs.mask - 8;
 | 
				
			||||||
	u32 mask = d->mask;
 | 
						u32 mask = d->mask;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
	*ct->mask_cache |= mask;
 | 
						*ct->mask_cache |= mask;
 | 
				
			||||||
	irq_reg_writel(gc, *ct->mask_cache, ct->regs.mask);
 | 
						irq_reg_writel(gc, *ct->mask_cache, ct->regs.mask);
 | 
				
			||||||
	irq_reg_writel(gc, irq_reg_readl(gc, ifr) & ~mask, ifr);
 | 
						irq_reg_writel(gc, irq_reg_readl(gc, ifr) & ~mask, ifr);
 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void __init ck_set_gc(struct device_node *node, void __iomem *reg_base,
 | 
					static void __init ck_set_gc(struct device_node *node, void __iomem *reg_base,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -101,10 +101,9 @@ static void dw_apb_ictl_resume(struct irq_data *d)
 | 
				
			||||||
	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
						struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
 | 
				
			||||||
	struct irq_chip_type *ct = irq_data_get_chip_type(d);
 | 
						struct irq_chip_type *ct = irq_data_get_chip_type(d);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
	writel_relaxed(~0, gc->reg_base + ct->regs.enable);
 | 
						writel_relaxed(~0, gc->reg_base + ct->regs.enable);
 | 
				
			||||||
	writel_relaxed(*ct->mask_cache, gc->reg_base + ct->regs.mask);
 | 
						writel_relaxed(*ct->mask_cache, gc->reg_base + ct->regs.mask);
 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define dw_apb_ictl_resume	NULL
 | 
					#define dw_apb_ictl_resume	NULL
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,11 +52,10 @@ static void ingenic_tcu_gc_unmask_enable_reg(struct irq_data *d)
 | 
				
			||||||
	struct regmap *map = gc->private;
 | 
						struct regmap *map = gc->private;
 | 
				
			||||||
	u32 mask = d->mask;
 | 
						u32 mask = d->mask;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
	regmap_write(map, ct->regs.ack, mask);
 | 
						regmap_write(map, ct->regs.ack, mask);
 | 
				
			||||||
	regmap_write(map, ct->regs.enable, mask);
 | 
						regmap_write(map, ct->regs.enable, mask);
 | 
				
			||||||
	*ct->mask_cache |= mask;
 | 
						*ct->mask_cache |= mask;
 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void ingenic_tcu_gc_mask_disable_reg(struct irq_data *d)
 | 
					static void ingenic_tcu_gc_mask_disable_reg(struct irq_data *d)
 | 
				
			||||||
| 
						 | 
					@ -66,10 +65,9 @@ static void ingenic_tcu_gc_mask_disable_reg(struct irq_data *d)
 | 
				
			||||||
	struct regmap *map = gc->private;
 | 
						struct regmap *map = gc->private;
 | 
				
			||||||
	u32 mask = d->mask;
 | 
						u32 mask = d->mask;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
	regmap_write(map, ct->regs.disable, mask);
 | 
						regmap_write(map, ct->regs.disable, mask);
 | 
				
			||||||
	*ct->mask_cache &= ~mask;
 | 
						*ct->mask_cache &= ~mask;
 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void ingenic_tcu_gc_mask_disable_reg_and_ack(struct irq_data *d)
 | 
					static void ingenic_tcu_gc_mask_disable_reg_and_ack(struct irq_data *d)
 | 
				
			||||||
| 
						 | 
					@ -79,10 +77,9 @@ static void ingenic_tcu_gc_mask_disable_reg_and_ack(struct irq_data *d)
 | 
				
			||||||
	struct regmap *map = gc->private;
 | 
						struct regmap *map = gc->private;
 | 
				
			||||||
	u32 mask = d->mask;
 | 
						u32 mask = d->mask;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
	regmap_write(map, ct->regs.ack, mask);
 | 
						regmap_write(map, ct->regs.ack, mask);
 | 
				
			||||||
	regmap_write(map, ct->regs.disable, mask);
 | 
						regmap_write(map, ct->regs.disable, mask);
 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int __init ingenic_tcu_irq_init(struct device_node *np,
 | 
					static int __init ingenic_tcu_irq_init(struct device_node *np,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,14 +71,12 @@ static unsigned int lan966x_oic_irq_startup(struct irq_data *data)
 | 
				
			||||||
	struct lan966x_oic_chip_regs *chip_regs = gc->private;
 | 
						struct lan966x_oic_chip_regs *chip_regs = gc->private;
 | 
				
			||||||
	u32 map;
 | 
						u32 map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						scoped_guard (raw_spinlock, &gc->lock) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
		/* Map the source interrupt to the destination */
 | 
							/* Map the source interrupt to the destination */
 | 
				
			||||||
		map = irq_reg_readl(gc, chip_regs->reg_off_map);
 | 
							map = irq_reg_readl(gc, chip_regs->reg_off_map);
 | 
				
			||||||
		map |= data->mask;
 | 
							map |= data->mask;
 | 
				
			||||||
		irq_reg_writel(gc, map, chip_regs->reg_off_map);
 | 
							irq_reg_writel(gc, map, chip_regs->reg_off_map);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ct->chip.irq_ack(data);
 | 
						ct->chip.irq_ack(data);
 | 
				
			||||||
	ct->chip.irq_unmask(data);
 | 
						ct->chip.irq_unmask(data);
 | 
				
			||||||
| 
						 | 
					@ -95,14 +93,12 @@ static void lan966x_oic_irq_shutdown(struct irq_data *data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ct->chip.irq_mask(data);
 | 
						ct->chip.irq_mask(data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Unmap the interrupt */
 | 
						/* Unmap the interrupt */
 | 
				
			||||||
	map = irq_reg_readl(gc, chip_regs->reg_off_map);
 | 
						map = irq_reg_readl(gc, chip_regs->reg_off_map);
 | 
				
			||||||
	map &= ~data->mask;
 | 
						map &= ~data->mask;
 | 
				
			||||||
	irq_reg_writel(gc, map, chip_regs->reg_off_map);
 | 
						irq_reg_writel(gc, map, chip_regs->reg_off_map);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int lan966x_oic_irq_set_type(struct irq_data *data,
 | 
					static int lan966x_oic_irq_set_type(struct irq_data *data,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -116,9 +116,8 @@ static int liointc_set_type(struct irq_data *data, unsigned int type)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data);
 | 
						struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data);
 | 
				
			||||||
	u32 mask = data->mask;
 | 
						u32 mask = data->mask;
 | 
				
			||||||
	unsigned long flags;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock_irqsave(gc, flags);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
	switch (type) {
 | 
						switch (type) {
 | 
				
			||||||
	case IRQ_TYPE_LEVEL_HIGH:
 | 
						case IRQ_TYPE_LEVEL_HIGH:
 | 
				
			||||||
		liointc_set_bit(gc, LIOINTC_REG_INTC_EDGE, mask, false);
 | 
							liointc_set_bit(gc, LIOINTC_REG_INTC_EDGE, mask, false);
 | 
				
			||||||
| 
						 | 
					@ -137,10 +136,8 @@ static int liointc_set_type(struct irq_data *data, unsigned int type)
 | 
				
			||||||
		liointc_set_bit(gc, LIOINTC_REG_INTC_POL, mask, true);
 | 
							liointc_set_bit(gc, LIOINTC_REG_INTC_POL, mask, true);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		irq_gc_unlock_irqrestore(gc, flags);
 | 
					 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	irq_gc_unlock_irqrestore(gc, flags);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irqd_set_trigger_type(data, type);
 | 
						irqd_set_trigger_type(data, type);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
| 
						 | 
					@ -157,10 +154,9 @@ static void liointc_suspend(struct irq_chip_generic *gc)
 | 
				
			||||||
static void liointc_resume(struct irq_chip_generic *gc)
 | 
					static void liointc_resume(struct irq_chip_generic *gc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct liointc_priv *priv = gc->private;
 | 
						struct liointc_priv *priv = gc->private;
 | 
				
			||||||
	unsigned long flags;
 | 
					 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock_irqsave(gc, flags);
 | 
						guard(raw_spinlock_irqsave)(&gc->lock);
 | 
				
			||||||
	/* Disable all at first */
 | 
						/* Disable all at first */
 | 
				
			||||||
	writel(0xffffffff, gc->reg_base + LIOINTC_REG_INTC_DISABLE);
 | 
						writel(0xffffffff, gc->reg_base + LIOINTC_REG_INTC_DISABLE);
 | 
				
			||||||
	/* Restore map cache */
 | 
						/* Restore map cache */
 | 
				
			||||||
| 
						 | 
					@ -170,7 +166,6 @@ static void liointc_resume(struct irq_chip_generic *gc)
 | 
				
			||||||
	writel(priv->int_edge, gc->reg_base + LIOINTC_REG_INTC_EDGE);
 | 
						writel(priv->int_edge, gc->reg_base + LIOINTC_REG_INTC_EDGE);
 | 
				
			||||||
	/* Restore mask cache */
 | 
						/* Restore mask cache */
 | 
				
			||||||
	writel(gc->mask_cache, gc->reg_base + LIOINTC_REG_INTC_ENABLE);
 | 
						writel(gc->mask_cache, gc->reg_base + LIOINTC_REG_INTC_ENABLE);
 | 
				
			||||||
	irq_gc_unlock_irqrestore(gc, flags);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int parent_irq[LIOINTC_NUM_PARENT];
 | 
					static int parent_irq[LIOINTC_NUM_PARENT];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -83,7 +83,7 @@ static void ocelot_irq_unmask(struct irq_data *data)
 | 
				
			||||||
	unsigned int mask = data->mask;
 | 
						unsigned int mask = data->mask;
 | 
				
			||||||
	u32 val;
 | 
						u32 val;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Clear sticky bits for edge mode interrupts.
 | 
						 * Clear sticky bits for edge mode interrupts.
 | 
				
			||||||
	 * Serval has only one trigger register replication, but the adjacent
 | 
						 * Serval has only one trigger register replication, but the adjacent
 | 
				
			||||||
| 
						 | 
					@ -97,7 +97,6 @@ static void ocelot_irq_unmask(struct irq_data *data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	*ct->mask_cache &= ~mask;
 | 
						*ct->mask_cache &= ~mask;
 | 
				
			||||||
	irq_reg_writel(gc, mask, p->reg_off_ena_set);
 | 
						irq_reg_writel(gc, mask, p->reg_off_ena_set);
 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void ocelot_irq_handler(struct irq_desc *desc)
 | 
					static void ocelot_irq_handler(struct irq_desc *desc)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -169,22 +169,18 @@ static int stm32_irq_set_type(struct irq_data *d, unsigned int type)
 | 
				
			||||||
	u32 rtsr, ftsr;
 | 
						u32 rtsr, ftsr;
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rtsr = irq_reg_readl(gc, stm32_bank->rtsr_ofst);
 | 
						rtsr = irq_reg_readl(gc, stm32_bank->rtsr_ofst);
 | 
				
			||||||
	ftsr = irq_reg_readl(gc, stm32_bank->ftsr_ofst);
 | 
						ftsr = irq_reg_readl(gc, stm32_bank->ftsr_ofst);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = stm32_exti_set_type(d, type, &rtsr, &ftsr);
 | 
						err = stm32_exti_set_type(d, type, &rtsr, &ftsr);
 | 
				
			||||||
	if (err)
 | 
						if (err)
 | 
				
			||||||
		goto unlock;
 | 
							return err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_reg_writel(gc, rtsr, stm32_bank->rtsr_ofst);
 | 
						irq_reg_writel(gc, rtsr, stm32_bank->rtsr_ofst);
 | 
				
			||||||
	irq_reg_writel(gc, ftsr, stm32_bank->ftsr_ofst);
 | 
						irq_reg_writel(gc, ftsr, stm32_bank->ftsr_ofst);
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
unlock:
 | 
					 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return err;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void stm32_chip_suspend(struct stm32_exti_chip_data *chip_data,
 | 
					static void stm32_chip_suspend(struct stm32_exti_chip_data *chip_data,
 | 
				
			||||||
| 
						 | 
					@ -217,18 +213,16 @@ static void stm32_irq_suspend(struct irq_chip_generic *gc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct stm32_exti_chip_data *chip_data = gc->private;
 | 
						struct stm32_exti_chip_data *chip_data = gc->private;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
	stm32_chip_suspend(chip_data, gc->wake_active);
 | 
						stm32_chip_suspend(chip_data, gc->wake_active);
 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void stm32_irq_resume(struct irq_chip_generic *gc)
 | 
					static void stm32_irq_resume(struct irq_chip_generic *gc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct stm32_exti_chip_data *chip_data = gc->private;
 | 
						struct stm32_exti_chip_data *chip_data = gc->private;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
	stm32_chip_resume(chip_data, gc->mask_cache);
 | 
						stm32_chip_resume(chip_data, gc->mask_cache);
 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int stm32_exti_alloc(struct irq_domain *d, unsigned int virq,
 | 
					static int stm32_exti_alloc(struct irq_domain *d, unsigned int virq,
 | 
				
			||||||
| 
						 | 
					@ -265,11 +259,8 @@ static void stm32_irq_ack(struct irq_data *d)
 | 
				
			||||||
	struct stm32_exti_chip_data *chip_data = gc->private;
 | 
						struct stm32_exti_chip_data *chip_data = gc->private;
 | 
				
			||||||
	const struct stm32_exti_bank *stm32_bank = chip_data->reg_bank;
 | 
						const struct stm32_exti_bank *stm32_bank = chip_data->reg_bank;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	irq_reg_writel(gc, d->mask, stm32_bank->rpr_ofst);
 | 
						irq_reg_writel(gc, d->mask, stm32_bank->rpr_ofst);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct
 | 
					static struct
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -111,7 +111,7 @@ static int sunxi_sc_nmi_set_type(struct irq_data *data, unsigned int flow_type)
 | 
				
			||||||
	unsigned int src_type;
 | 
						unsigned int src_type;
 | 
				
			||||||
	unsigned int i;
 | 
						unsigned int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	irq_gc_lock(gc);
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (flow_type & IRQF_TRIGGER_MASK) {
 | 
						switch (flow_type & IRQF_TRIGGER_MASK) {
 | 
				
			||||||
	case IRQ_TYPE_EDGE_FALLING:
 | 
						case IRQ_TYPE_EDGE_FALLING:
 | 
				
			||||||
| 
						 | 
					@ -128,9 +128,7 @@ static int sunxi_sc_nmi_set_type(struct irq_data *data, unsigned int flow_type)
 | 
				
			||||||
		src_type = SUNXI_SRC_TYPE_LEVEL_LOW;
 | 
							src_type = SUNXI_SRC_TYPE_LEVEL_LOW;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		irq_gc_unlock(gc);
 | 
							pr_err("Cannot assign multiple trigger modes to IRQ %d.\n", data->irq);
 | 
				
			||||||
		pr_err("Cannot assign multiple trigger modes to IRQ %d.\n",
 | 
					 | 
				
			||||||
			data->irq);
 | 
					 | 
				
			||||||
		return -EBADR;
 | 
							return -EBADR;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -145,9 +143,6 @@ static int sunxi_sc_nmi_set_type(struct irq_data *data, unsigned int flow_type)
 | 
				
			||||||
	src_type_reg &= ~SUNXI_NMI_SRC_TYPE_MASK;
 | 
						src_type_reg &= ~SUNXI_NMI_SRC_TYPE_MASK;
 | 
				
			||||||
	src_type_reg |= src_type;
 | 
						src_type_reg |= src_type;
 | 
				
			||||||
	sunxi_sc_nmi_write(gc, ctrl_off, src_type_reg);
 | 
						sunxi_sc_nmi_write(gc, ctrl_off, src_type_reg);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return IRQ_SET_MASK_OK;
 | 
						return IRQ_SET_MASK_OK;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,11 +41,9 @@ static inline u32 ab_irqctl_readreg(struct irq_chip_generic *gc, u32 reg)
 | 
				
			||||||
static int tb10x_irq_set_type(struct irq_data *data, unsigned int flow_type)
 | 
					static int tb10x_irq_set_type(struct irq_data *data, unsigned int flow_type)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data);
 | 
						struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data);
 | 
				
			||||||
	uint32_t im, mod, pol;
 | 
						uint32_t mod, pol, im = data->mask;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	im = data->mask;
 | 
						guard(raw_spinlock)(&gc->lock);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	irq_gc_lock(gc);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mod = ab_irqctl_readreg(gc, AB_IRQCTL_SRC_MODE) | im;
 | 
						mod = ab_irqctl_readreg(gc, AB_IRQCTL_SRC_MODE) | im;
 | 
				
			||||||
	pol = ab_irqctl_readreg(gc, AB_IRQCTL_SRC_POLARITY) | im;
 | 
						pol = ab_irqctl_readreg(gc, AB_IRQCTL_SRC_POLARITY) | im;
 | 
				
			||||||
| 
						 | 
					@ -67,9 +65,7 @@ static int tb10x_irq_set_type(struct irq_data *data, unsigned int flow_type)
 | 
				
			||||||
	case IRQ_TYPE_EDGE_RISING:
 | 
						case IRQ_TYPE_EDGE_RISING:
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		irq_gc_unlock(gc);
 | 
							pr_err("%s: Cannot assign multiple trigger modes to IRQ %d.\n",	__func__, data->irq);
 | 
				
			||||||
		pr_err("%s: Cannot assign multiple trigger modes to IRQ %d.\n",
 | 
					 | 
				
			||||||
			__func__, data->irq);
 | 
					 | 
				
			||||||
		return -EBADR;
 | 
							return -EBADR;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -79,9 +75,6 @@ static int tb10x_irq_set_type(struct irq_data *data, unsigned int flow_type)
 | 
				
			||||||
	ab_irqctl_writereg(gc, AB_IRQCTL_SRC_MODE, mod);
 | 
						ab_irqctl_writereg(gc, AB_IRQCTL_SRC_MODE, mod);
 | 
				
			||||||
	ab_irqctl_writereg(gc, AB_IRQCTL_SRC_POLARITY, pol);
 | 
						ab_irqctl_writereg(gc, AB_IRQCTL_SRC_POLARITY, pol);
 | 
				
			||||||
	ab_irqctl_writereg(gc, AB_IRQCTL_INT_STATUS, im);
 | 
						ab_irqctl_writereg(gc, AB_IRQCTL_INT_STATUS, im);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	irq_gc_unlock(gc);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return IRQ_SET_MASK_OK;
 | 
						return IRQ_SET_MASK_OK;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue