@@ -68,7 +68,6 @@ struct xgpio_instance {
6868 DECLARE_BITMAP (dir , 64 );
6969 spinlock_t gpio_lock ; /* For serializing operations */
7070 int irq ;
71- struct irq_chip irqchip ;
7271 DECLARE_BITMAP (enable , 64 );
7372 DECLARE_BITMAP (rising_edge , 64 );
7473 DECLARE_BITMAP (falling_edge , 64 );
@@ -416,6 +415,8 @@ static void xgpio_irq_mask(struct irq_data *irq_data)
416415 xgpio_writereg (chip -> regs + XGPIO_IPIER_OFFSET , temp );
417416 }
418417 spin_unlock_irqrestore (& chip -> gpio_lock , flags );
418+
419+ gpiochip_disable_irq (& chip -> gc , irq_offset );
419420}
420421
421422/**
@@ -431,6 +432,8 @@ static void xgpio_irq_unmask(struct irq_data *irq_data)
431432 u32 old_enable = xgpio_get_value32 (chip -> enable , bit );
432433 u32 mask = BIT (bit / 32 ), val ;
433434
435+ gpiochip_enable_irq (& chip -> gc , irq_offset );
436+
434437 spin_lock_irqsave (& chip -> gpio_lock , flags );
435438
436439 __set_bit (bit , chip -> enable );
@@ -544,6 +547,16 @@ static void xgpio_irqhandler(struct irq_desc *desc)
544547 chained_irq_exit (irqchip , desc );
545548}
546549
550+ static const struct irq_chip xgpio_irq_chip = {
551+ .name = "gpio-xilinx" ,
552+ .irq_ack = xgpio_irq_ack ,
553+ .irq_mask = xgpio_irq_mask ,
554+ .irq_unmask = xgpio_irq_unmask ,
555+ .irq_set_type = xgpio_set_irq_type ,
556+ .flags = IRQCHIP_IMMUTABLE ,
557+ GPIOCHIP_IRQ_RESOURCE_HELPERS ,
558+ };
559+
547560/**
548561 * xgpio_probe - Probe method for the GPIO device.
549562 * @pdev: pointer to the platform device
@@ -653,12 +666,6 @@ static int xgpio_probe(struct platform_device *pdev)
653666 if (chip -> irq <= 0 )
654667 goto skip_irq ;
655668
656- chip -> irqchip .name = "gpio-xilinx" ;
657- chip -> irqchip .irq_ack = xgpio_irq_ack ;
658- chip -> irqchip .irq_mask = xgpio_irq_mask ;
659- chip -> irqchip .irq_unmask = xgpio_irq_unmask ;
660- chip -> irqchip .irq_set_type = xgpio_set_irq_type ;
661-
662669 /* Disable per-channel interrupts */
663670 xgpio_writereg (chip -> regs + XGPIO_IPIER_OFFSET , 0 );
664671 /* Clear any existing per-channel interrupts */
@@ -668,7 +675,7 @@ static int xgpio_probe(struct platform_device *pdev)
668675 xgpio_writereg (chip -> regs + XGPIO_GIER_OFFSET , XGPIO_GIER_IE );
669676
670677 girq = & chip -> gc .irq ;
671- girq -> chip = & chip -> irqchip ;
678+ gpio_irq_chip_set_chip ( girq , & xgpio_irq_chip ) ;
672679 girq -> parent_handler = xgpio_irqhandler ;
673680 girq -> num_parents = 1 ;
674681 girq -> parents = devm_kcalloc (& pdev -> dev , 1 ,
0 commit comments