@@ -663,7 +663,7 @@ static void lp_irq_ack(struct irq_data *d)
663663{
664664 struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
665665 struct intel_pinctrl * lg = gpiochip_get_data (gc );
666- u32 hwirq = irqd_to_hwirq (d );
666+ irq_hw_number_t hwirq = irqd_to_hwirq (d );
667667 void __iomem * reg = lp_gpio_reg (& lg -> chip , hwirq , LP_INT_STAT );
668668 unsigned long flags ;
669669
@@ -684,10 +684,12 @@ static void lp_irq_enable(struct irq_data *d)
684684{
685685 struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
686686 struct intel_pinctrl * lg = gpiochip_get_data (gc );
687- u32 hwirq = irqd_to_hwirq (d );
687+ irq_hw_number_t hwirq = irqd_to_hwirq (d );
688688 void __iomem * reg = lp_gpio_reg (& lg -> chip , hwirq , LP_INT_ENABLE );
689689 unsigned long flags ;
690690
691+ gpiochip_enable_irq (gc , hwirq );
692+
691693 raw_spin_lock_irqsave (& lg -> lock , flags );
692694 iowrite32 (ioread32 (reg ) | BIT (hwirq % 32 ), reg );
693695 raw_spin_unlock_irqrestore (& lg -> lock , flags );
@@ -697,30 +699,33 @@ static void lp_irq_disable(struct irq_data *d)
697699{
698700 struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
699701 struct intel_pinctrl * lg = gpiochip_get_data (gc );
700- u32 hwirq = irqd_to_hwirq (d );
702+ irq_hw_number_t hwirq = irqd_to_hwirq (d );
701703 void __iomem * reg = lp_gpio_reg (& lg -> chip , hwirq , LP_INT_ENABLE );
702704 unsigned long flags ;
703705
704706 raw_spin_lock_irqsave (& lg -> lock , flags );
705707 iowrite32 (ioread32 (reg ) & ~BIT (hwirq % 32 ), reg );
706708 raw_spin_unlock_irqrestore (& lg -> lock , flags );
709+
710+ gpiochip_disable_irq (gc , hwirq );
707711}
708712
709713static int lp_irq_set_type (struct irq_data * d , unsigned int type )
710714{
711715 struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
712716 struct intel_pinctrl * lg = gpiochip_get_data (gc );
713- u32 hwirq = irqd_to_hwirq (d );
714- void __iomem * reg = lp_gpio_reg (& lg -> chip , hwirq , LP_CONFIG1 );
717+ irq_hw_number_t hwirq = irqd_to_hwirq (d );
715718 unsigned long flags ;
719+ void __iomem * reg ;
716720 u32 value ;
717721
718- if (hwirq >= lg -> chip .ngpio )
722+ reg = lp_gpio_reg (& lg -> chip , hwirq , LP_CONFIG1 );
723+ if (!reg )
719724 return - EINVAL ;
720725
721726 /* Fail if BIOS reserved pin for ACPI use */
722727 if (lp_gpio_acpi_use (lg , hwirq )) {
723- dev_err (lg -> dev , "pin %u can't be used as IRQ\n" , hwirq );
728+ dev_err (lg -> dev , "pin %lu can't be used as IRQ\n" , hwirq );
724729 return - EBUSY ;
725730 }
726731
@@ -755,15 +760,16 @@ static int lp_irq_set_type(struct irq_data *d, unsigned int type)
755760 return 0 ;
756761}
757762
758- static struct irq_chip lp_irqchip = {
763+ static const struct irq_chip lp_irqchip = {
759764 .name = "LP-GPIO" ,
760765 .irq_ack = lp_irq_ack ,
761766 .irq_mask = lp_irq_mask ,
762767 .irq_unmask = lp_irq_unmask ,
763768 .irq_enable = lp_irq_enable ,
764769 .irq_disable = lp_irq_disable ,
765770 .irq_set_type = lp_irq_set_type ,
766- .flags = IRQCHIP_SKIP_SET_WAKE ,
771+ .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_IMMUTABLE ,
772+ GPIOCHIP_IRQ_RESOURCE_HELPERS ,
767773};
768774
769775static int lp_gpio_irq_init_hw (struct gpio_chip * chip )
@@ -884,7 +890,7 @@ static int lp_gpio_probe(struct platform_device *pdev)
884890 struct gpio_irq_chip * girq ;
885891
886892 girq = & gc -> irq ;
887- girq -> chip = & lp_irqchip ;
893+ gpio_irq_chip_set_chip ( girq , & lp_irqchip ) ;
888894 girq -> init_hw = lp_gpio_irq_init_hw ;
889895 girq -> parent_handler = lp_gpio_irq_handler ;
890896 girq -> num_parents = 1 ;
0 commit comments