Skip to content

Commit 1f86fae

Browse files
tq-schiffermlag-linaro
authored andcommitted
mfd: tqmx86: Make IRQ setup errors non-fatal
GPIO IRQ setup can fail either because an invalid IRQ was passed as a parameter, or because the GPIO controller does not support interrupts. Neither is severe enough to stop the whole probe; simply disable IRQ support in the GPIO resource when setup fails. The code is made a bit more robust by introduing an enum for the resource list indices instead of assuming that the IRQ is at index 0. Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Link: https://lore.kernel.org/r/2b5522362098d54c6203be6da95bbc545a21fd49.1731325758.git.matthias.schiffer@ew.tq-group.com Signed-off-by: Lee Jones <lee@kernel.org>
1 parent b58bbbd commit 1f86fae

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

drivers/mfd/tqmx86.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,15 @@ static const struct resource tqmx_watchdog_resources[] = {
6868
DEFINE_RES_IO(TQMX86_IOBASE_WATCHDOG, TQMX86_IOSIZE_WATCHDOG),
6969
};
7070

71-
/*
72-
* The IRQ resource must be first, since it is updated with the
73-
* configured IRQ in the probe function.
74-
*/
71+
enum tqmx86_gpio_resource_type {
72+
TQMX86_GPIO_IO,
73+
TQMX86_GPIO_IRQ,
74+
};
75+
7576
static struct resource tqmx_gpio_resources[] = {
76-
DEFINE_RES_IRQ(0),
77-
DEFINE_RES_IO(TQMX86_IOBASE_GPIO, TQMX86_IOSIZE_GPIO),
77+
[TQMX86_GPIO_IO] = DEFINE_RES_IO(TQMX86_IOBASE_GPIO, TQMX86_IOSIZE_GPIO),
78+
/* Placeholder for IRQ resource */
79+
[TQMX86_GPIO_IRQ] = {},
7880
};
7981

8082
static struct i2c_board_info tqmx86_i2c_devices[] = {
@@ -255,13 +257,8 @@ static int tqmx86_probe(struct platform_device *pdev)
255257
if (gpio_irq) {
256258
err = tqmx86_setup_irq(dev, "GPIO", gpio_irq, io_base,
257259
TQMX86_REG_IO_EXT_INT_GPIO_SHIFT);
258-
if (err)
259-
return err;
260-
261-
/* Assumes the IRQ resource is first. */
262-
tqmx_gpio_resources[0].start = gpio_irq;
263-
} else {
264-
tqmx_gpio_resources[0].flags = 0;
260+
if (!err)
261+
tqmx_gpio_resources[TQMX86_GPIO_IRQ] = DEFINE_RES_IRQ(gpio_irq);
265262
}
266263

267264
ocores_platform_data.clock_khz = tqmx86_board_id_to_clk_rate(dev, board_id);

0 commit comments

Comments
 (0)