mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	genirq/chip: Rework irq_set_chip()
Use the new guards to get and lock the interrupt descriptor and tidy up the code. Fixup the kernel doc comment while at it. No functional change. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/all/20250429065421.295400891@linutronix.de
This commit is contained in:
		
							parent
							
								
									e7c6542557
								
							
						
					
					
						commit
						46ff4d11f0
					
				
					 1 changed files with 12 additions and 16 deletions
				
			
		| 
						 | 
					@ -40,20 +40,16 @@ struct irqaction chained_action = {
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
int irq_set_chip(unsigned int irq, const struct irq_chip *chip)
 | 
					int irq_set_chip(unsigned int irq, const struct irq_chip *chip)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	unsigned long flags;
 | 
						int ret = -EINVAL;
 | 
				
			||||||
	struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!desc)
 | 
						scoped_irqdesc_get_and_lock(irq, 0) {
 | 
				
			||||||
		return -EINVAL;
 | 
							scoped_irqdesc->irq_data.chip = (struct irq_chip *)(chip ?: &no_irq_chip);
 | 
				
			||||||
 | 
							ret = 0;
 | 
				
			||||||
	desc->irq_data.chip = (struct irq_chip *)(chip ?: &no_irq_chip);
 | 
						}
 | 
				
			||||||
	irq_put_desc_unlock(desc, flags);
 | 
						/* For !CONFIG_SPARSE_IRQ make the irq show up in allocated_irqs. */
 | 
				
			||||||
	/*
 | 
						if (!ret)
 | 
				
			||||||
	 * For !CONFIG_SPARSE_IRQ make the irq show up in
 | 
					 | 
				
			||||||
	 * allocated_irqs.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
		irq_mark_irq(irq);
 | 
							irq_mark_irq(irq);
 | 
				
			||||||
	return 0;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL(irq_set_chip);
 | 
					EXPORT_SYMBOL(irq_set_chip);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue