@@ -201,7 +201,6 @@ struct pca953x_chip {
201
201
DECLARE_BITMAP (irq_stat , MAX_LINE );
202
202
DECLARE_BITMAP (irq_trig_raise , MAX_LINE );
203
203
DECLARE_BITMAP (irq_trig_fall , MAX_LINE );
204
- struct irq_chip irq_chip ;
205
204
#endif
206
205
atomic_t wakeup_path ;
207
206
@@ -629,6 +628,7 @@ static void pca953x_irq_mask(struct irq_data *d)
629
628
irq_hw_number_t hwirq = irqd_to_hwirq (d );
630
629
631
630
clear_bit (hwirq , chip -> irq_mask );
631
+ gpiochip_disable_irq (gc , hwirq );
632
632
}
633
633
634
634
static void pca953x_irq_unmask (struct irq_data * d )
@@ -637,6 +637,7 @@ static void pca953x_irq_unmask(struct irq_data *d)
637
637
struct pca953x_chip * chip = gpiochip_get_data (gc );
638
638
irq_hw_number_t hwirq = irqd_to_hwirq (d );
639
639
640
+ gpiochip_enable_irq (gc , hwirq );
640
641
set_bit (hwirq , chip -> irq_mask );
641
642
}
642
643
@@ -721,6 +722,26 @@ static void pca953x_irq_shutdown(struct irq_data *d)
721
722
clear_bit (hwirq , chip -> irq_trig_fall );
722
723
}
723
724
725
+ static void pca953x_irq_print_chip (struct irq_data * data , struct seq_file * p )
726
+ {
727
+ struct gpio_chip * gc = irq_data_get_irq_chip_data (data );
728
+
729
+ seq_printf (p , dev_name (gc -> parent ));
730
+ }
731
+
732
+ static const struct irq_chip pca953x_irq_chip = {
733
+ .irq_mask = pca953x_irq_mask ,
734
+ .irq_unmask = pca953x_irq_unmask ,
735
+ .irq_set_wake = pca953x_irq_set_wake ,
736
+ .irq_bus_lock = pca953x_irq_bus_lock ,
737
+ .irq_bus_sync_unlock = pca953x_irq_bus_sync_unlock ,
738
+ .irq_set_type = pca953x_irq_set_type ,
739
+ .irq_shutdown = pca953x_irq_shutdown ,
740
+ .irq_print_chip = pca953x_irq_print_chip ,
741
+ .flags = IRQCHIP_IMMUTABLE ,
742
+ GPIOCHIP_IRQ_RESOURCE_HELPERS ,
743
+ };
744
+
724
745
static bool pca953x_irq_pending (struct pca953x_chip * chip , unsigned long * pending )
725
746
{
726
747
struct gpio_chip * gc = & chip -> gpio_chip ;
@@ -812,7 +833,6 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid)
812
833
static int pca953x_irq_setup (struct pca953x_chip * chip , int irq_base )
813
834
{
814
835
struct i2c_client * client = chip -> client ;
815
- struct irq_chip * irq_chip = & chip -> irq_chip ;
816
836
DECLARE_BITMAP (reg_direction , MAX_LINE );
817
837
DECLARE_BITMAP (irq_stat , MAX_LINE );
818
838
struct gpio_irq_chip * girq ;
@@ -846,17 +866,8 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, int irq_base)
846
866
bitmap_and (chip -> irq_stat , irq_stat , reg_direction , chip -> gpio_chip .ngpio );
847
867
mutex_init (& chip -> irq_lock );
848
868
849
- irq_chip -> name = dev_name (& client -> dev );
850
- irq_chip -> irq_mask = pca953x_irq_mask ;
851
- irq_chip -> irq_unmask = pca953x_irq_unmask ;
852
- irq_chip -> irq_set_wake = pca953x_irq_set_wake ;
853
- irq_chip -> irq_bus_lock = pca953x_irq_bus_lock ;
854
- irq_chip -> irq_bus_sync_unlock = pca953x_irq_bus_sync_unlock ;
855
- irq_chip -> irq_set_type = pca953x_irq_set_type ;
856
- irq_chip -> irq_shutdown = pca953x_irq_shutdown ;
857
-
858
869
girq = & chip -> gpio_chip .irq ;
859
- girq -> chip = irq_chip ;
870
+ gpio_irq_chip_set_chip ( girq , & pca953x_irq_chip ) ;
860
871
/* This will let us handle the parent IRQ in the driver */
861
872
girq -> parent_handler = NULL ;
862
873
girq -> num_parents = 0 ;
0 commit comments