summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias.schiffer@ew.tq-group.com>2024-11-11 15:10:31 +0100
committerLee Jones <lee@kernel.org>2024-11-12 14:46:54 +0000
commit1f86faeb8b4bfeaa001a6c24141cdfc98093e9db (patch)
tree6b1d5f3fba99fe3fe3c8964f21c9bc1abca350b6
parentb58bbbd7c599eab4861cc68a13440f5ad4679dba (diff)
downloadlwn-1f86faeb8b4bfeaa001a6c24141cdfc98093e9db.tar.gz
lwn-1f86faeb8b4bfeaa001a6c24141cdfc98093e9db.zip
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>
-rw-r--r--drivers/mfd/tqmx86.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/mfd/tqmx86.c b/drivers/mfd/tqmx86.c
index 8aa448a67c9a..d2704526f9d4 100644
--- a/drivers/mfd/tqmx86.c
+++ b/drivers/mfd/tqmx86.c
@@ -68,13 +68,15 @@ static const struct resource tqmx_watchdog_resources[] = {
DEFINE_RES_IO(TQMX86_IOBASE_WATCHDOG, TQMX86_IOSIZE_WATCHDOG),
};
-/*
- * The IRQ resource must be first, since it is updated with the
- * configured IRQ in the probe function.
- */
+enum tqmx86_gpio_resource_type {
+ TQMX86_GPIO_IO,
+ TQMX86_GPIO_IRQ,
+};
+
static struct resource tqmx_gpio_resources[] = {
- DEFINE_RES_IRQ(0),
- DEFINE_RES_IO(TQMX86_IOBASE_GPIO, TQMX86_IOSIZE_GPIO),
+ [TQMX86_GPIO_IO] = DEFINE_RES_IO(TQMX86_IOBASE_GPIO, TQMX86_IOSIZE_GPIO),
+ /* Placeholder for IRQ resource */
+ [TQMX86_GPIO_IRQ] = {},
};
static struct i2c_board_info tqmx86_i2c_devices[] = {
@@ -255,13 +257,8 @@ static int tqmx86_probe(struct platform_device *pdev)
if (gpio_irq) {
err = tqmx86_setup_irq(dev, "GPIO", gpio_irq, io_base,
TQMX86_REG_IO_EXT_INT_GPIO_SHIFT);
- if (err)
- return err;
-
- /* Assumes the IRQ resource is first. */
- tqmx_gpio_resources[0].start = gpio_irq;
- } else {
- tqmx_gpio_resources[0].flags = 0;
+ if (!err)
+ tqmx_gpio_resources[TQMX86_GPIO_IRQ] = DEFINE_RES_IRQ(gpio_irq);
}
ocores_platform_data.clock_khz = tqmx86_board_id_to_clk_rate(dev, board_id);