Commit 1993f1d7 authored by Jorge Ramirez-Ortiz's avatar Jorge Ramirez-Ortiz Committed by Wim Van Sebroeck
Browse files

watchdog: pm8916_wdt: fix pretimeout registration flow



When an IRQ is present in the dts, the probe function shall fail if
the interrupt can not be registered.

The probe function shall also be retried if getting the irq is being
deferred.

Signed-off-by: default avatarJorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Reviewed-by: default avatarLoic Poulain <loic.poulain@linaro.org>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent c58e8134
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -163,9 +163,17 @@ static int pm8916_wdt_probe(struct platform_device *pdev)

	irq = platform_get_irq(pdev, 0);
	if (irq > 0) {
		if (devm_request_irq(dev, irq, pm8916_wdt_isr, 0, "pm8916_wdt",
				     wdt))
			irq = 0;
		err = devm_request_irq(dev, irq, pm8916_wdt_isr, 0,
				       "pm8916_wdt", wdt);
		if (err)
			return err;

		wdt->wdev.info = &pm8916_wdt_pt_ident;
	} else {
		if (irq == -EPROBE_DEFER)
			return -EPROBE_DEFER;

		wdt->wdev.info = &pm8916_wdt_ident;
	}

	/* Configure watchdog to hard-reset mode */
@@ -177,7 +185,6 @@ static int pm8916_wdt_probe(struct platform_device *pdev)
		return err;
	}

	wdt->wdev.info = (irq > 0) ? &pm8916_wdt_pt_ident : &pm8916_wdt_ident,
	wdt->wdev.ops = &pm8916_wdt_ops,
	wdt->wdev.parent = dev;
	wdt->wdev.min_timeout = PM8916_WDT_MIN_TIMEOUT;