@@ -147,6 +147,7 @@ struct chv_pin_context {
147
147
* @pctldesc: Pin controller description
148
148
* @pctldev: Pointer to the pin controller device
149
149
* @chip: GPIO chip in this pin controller
150
+ * @irqchip: IRQ chip in this pin controller
150
151
* @regs: MMIO registers
151
152
* @intr_lines: Stores mapping between 16 HW interrupt wires and GPIO
152
153
* offset (in GPIO number space)
@@ -162,6 +163,7 @@ struct chv_pinctrl {
162
163
struct pinctrl_desc pctldesc ;
163
164
struct pinctrl_dev * pctldev ;
164
165
struct gpio_chip chip ;
166
+ struct irq_chip irqchip ;
165
167
void __iomem * regs ;
166
168
unsigned intr_lines [16 ];
167
169
const struct chv_community * community ;
@@ -1466,16 +1468,6 @@ static int chv_gpio_irq_type(struct irq_data *d, unsigned int type)
1466
1468
return 0 ;
1467
1469
}
1468
1470
1469
- static struct irq_chip chv_gpio_irqchip = {
1470
- .name = "chv-gpio" ,
1471
- .irq_startup = chv_gpio_irq_startup ,
1472
- .irq_ack = chv_gpio_irq_ack ,
1473
- .irq_mask = chv_gpio_irq_mask ,
1474
- .irq_unmask = chv_gpio_irq_unmask ,
1475
- .irq_set_type = chv_gpio_irq_type ,
1476
- .flags = IRQCHIP_SKIP_SET_WAKE ,
1477
- };
1478
-
1479
1471
static void chv_gpio_irq_handler (struct irq_desc * desc )
1480
1472
{
1481
1473
struct gpio_chip * gc = irq_desc_get_handler_data (desc );
@@ -1559,7 +1551,7 @@ static void chv_init_irq_valid_mask(struct gpio_chip *chip,
1559
1551
intsel >>= CHV_PADCTRL0_INTSEL_SHIFT ;
1560
1552
1561
1553
if (intsel >= community -> nirqs )
1562
- clear_bit (i , valid_mask );
1554
+ clear_bit (desc -> number , valid_mask );
1563
1555
}
1564
1556
}
1565
1557
@@ -1625,7 +1617,15 @@ static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq)
1625
1617
}
1626
1618
}
1627
1619
1628
- ret = gpiochip_irqchip_add (chip , & chv_gpio_irqchip , 0 ,
1620
+ pctrl -> irqchip .name = "chv-gpio" ;
1621
+ pctrl -> irqchip .irq_startup = chv_gpio_irq_startup ;
1622
+ pctrl -> irqchip .irq_ack = chv_gpio_irq_ack ;
1623
+ pctrl -> irqchip .irq_mask = chv_gpio_irq_mask ;
1624
+ pctrl -> irqchip .irq_unmask = chv_gpio_irq_unmask ;
1625
+ pctrl -> irqchip .irq_set_type = chv_gpio_irq_type ;
1626
+ pctrl -> irqchip .flags = IRQCHIP_SKIP_SET_WAKE ;
1627
+
1628
+ ret = gpiochip_irqchip_add (chip , & pctrl -> irqchip , 0 ,
1629
1629
handle_bad_irq , IRQ_TYPE_NONE );
1630
1630
if (ret ) {
1631
1631
dev_err (pctrl -> dev , "failed to add IRQ chip\n" );
@@ -1642,7 +1642,7 @@ static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq)
1642
1642
}
1643
1643
}
1644
1644
1645
- gpiochip_set_chained_irqchip (chip , & chv_gpio_irqchip , irq ,
1645
+ gpiochip_set_chained_irqchip (chip , & pctrl -> irqchip , irq ,
1646
1646
chv_gpio_irq_handler );
1647
1647
return 0 ;
1648
1648
}
0 commit comments