forked from mirrors/linux
		
	gpio: xilinx: Convert to immutable irq_chip
Convert the driver to immutable irq-chip with a bit of intuition. Cc: Marc Zyngier <maz@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
		
							parent
							
								
									9c1282b745
								
							
						
					
					
						commit
						b4510f8fd5
					
				
					 1 changed files with 15 additions and 8 deletions
				
			
		|  | @ -68,7 +68,6 @@ struct xgpio_instance { | |||
| 	DECLARE_BITMAP(dir, 64); | ||||
| 	spinlock_t gpio_lock;	/* For serializing operations */ | ||||
| 	int irq; | ||||
| 	struct irq_chip irqchip; | ||||
| 	DECLARE_BITMAP(enable, 64); | ||||
| 	DECLARE_BITMAP(rising_edge, 64); | ||||
| 	DECLARE_BITMAP(falling_edge, 64); | ||||
|  | @ -416,6 +415,8 @@ static void xgpio_irq_mask(struct irq_data *irq_data) | |||
| 		xgpio_writereg(chip->regs + XGPIO_IPIER_OFFSET, temp); | ||||
| 	} | ||||
| 	spin_unlock_irqrestore(&chip->gpio_lock, flags); | ||||
| 
 | ||||
| 	gpiochip_disable_irq(&chip->gc, irq_offset); | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  | @ -431,6 +432,8 @@ static void xgpio_irq_unmask(struct irq_data *irq_data) | |||
| 	u32 old_enable = xgpio_get_value32(chip->enable, bit); | ||||
| 	u32 mask = BIT(bit / 32), val; | ||||
| 
 | ||||
| 	gpiochip_enable_irq(&chip->gc, irq_offset); | ||||
| 
 | ||||
| 	spin_lock_irqsave(&chip->gpio_lock, flags); | ||||
| 
 | ||||
| 	__set_bit(bit, chip->enable); | ||||
|  | @ -544,6 +547,16 @@ static void xgpio_irqhandler(struct irq_desc *desc) | |||
| 	chained_irq_exit(irqchip, desc); | ||||
| } | ||||
| 
 | ||||
| static const struct irq_chip xgpio_irq_chip = { | ||||
| 	.name = "gpio-xilinx", | ||||
| 	.irq_ack = xgpio_irq_ack, | ||||
| 	.irq_mask = xgpio_irq_mask, | ||||
| 	.irq_unmask = xgpio_irq_unmask, | ||||
| 	.irq_set_type = xgpio_set_irq_type, | ||||
| 	.flags = IRQCHIP_IMMUTABLE, | ||||
| 	GPIOCHIP_IRQ_RESOURCE_HELPERS, | ||||
| }; | ||||
| 
 | ||||
| /**
 | ||||
|  * xgpio_probe - Probe method for the GPIO device. | ||||
|  * @pdev: pointer to the platform device | ||||
|  | @ -653,12 +666,6 @@ static int xgpio_probe(struct platform_device *pdev) | |||
| 	if (chip->irq <= 0) | ||||
| 		goto skip_irq; | ||||
| 
 | ||||
| 	chip->irqchip.name = "gpio-xilinx"; | ||||
| 	chip->irqchip.irq_ack = xgpio_irq_ack; | ||||
| 	chip->irqchip.irq_mask = xgpio_irq_mask; | ||||
| 	chip->irqchip.irq_unmask = xgpio_irq_unmask; | ||||
| 	chip->irqchip.irq_set_type = xgpio_set_irq_type; | ||||
| 
 | ||||
| 	/* Disable per-channel interrupts */ | ||||
| 	xgpio_writereg(chip->regs + XGPIO_IPIER_OFFSET, 0); | ||||
| 	/* Clear any existing per-channel interrupts */ | ||||
|  | @ -668,7 +675,7 @@ static int xgpio_probe(struct platform_device *pdev) | |||
| 	xgpio_writereg(chip->regs + XGPIO_GIER_OFFSET, XGPIO_GIER_IE); | ||||
| 
 | ||||
| 	girq = &chip->gc.irq; | ||||
| 	girq->chip = &chip->irqchip; | ||||
| 	gpio_irq_chip_set_chip(girq, &xgpio_irq_chip); | ||||
| 	girq->parent_handler = xgpio_irqhandler; | ||||
| 	girq->num_parents = 1; | ||||
| 	girq->parents = devm_kcalloc(&pdev->dev, 1, | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Linus Walleij
						Linus Walleij