Skip to content

Commit 4e50573

Browse files
vladimirolteanlinusw
authored andcommitted
gpio: mpc8xxx: Don't overwrite default irq_set_type callback
The per-SoC devtype structures can contain their own callbacks that overwrite mpc8xxx_gpio_devtype_default. The clear intention is that mpc8xxx_irq_set_type is used in case the SoC does not specify a more specific callback. But what happens is that if the SoC doesn't specify one, its .irq_set_type is de-facto NULL, and this overwrites mpc8xxx_irq_set_type to a no-op. This means that the following SoCs are affected: - fsl,mpc8572-gpio - fsl,ls1028a-gpio - fsl,ls1088a-gpio On these boards, the irq_set_type does exactly nothing, and the GPIO controller keeps its GPICR register in the hardware-default state. On the LS1028A, that is ACTIVE_BOTH, which means 2 interrupts are raised even if the IRQ client requests LEVEL_HIGH. Another implication is that the IRQs are not checked (e.g. level-triggered interrupts are not rejected, although they are not supported). Fixes: 82e39b0 ("gpio: mpc8xxx: handle differences between incarnations at a single place") Signed-off-by: Vladimir Oltean <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Michael Walle <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent 3f86a7e commit 4e50573

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpio/gpio-mpc8xxx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,8 @@ static int mpc8xxx_probe(struct platform_device *pdev)
377377
* It's assumed that only a single type of gpio controller is available
378378
* on the current machine, so overwriting global data is fine.
379379
*/
380-
mpc8xxx_irq_chip.irq_set_type = devtype->irq_set_type;
380+
if (devtype->irq_set_type)
381+
mpc8xxx_irq_chip.irq_set_type = devtype->irq_set_type;
381382

382383
if (devtype->gpio_dir_out)
383384
gc->direction_output = devtype->gpio_dir_out;

0 commit comments

Comments
 (0)