watchdog: xilinx: Remove no_timeout variable

Remove no_timeout variable and check variables
directly.

Suggested-by: Rob Herring <robherring2@gmail.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
This commit is contained in:
Michal Simek 2014-02-12 14:41:25 +01:00 committed by Wim Van Sebroeck
parent c9dcf9f2ea
commit 8d6a140b5f

View file

@ -146,10 +146,9 @@ static u32 xwdt_selftest(struct xwdt_device *xdev)
static int xwdt_probe(struct platform_device *pdev) static int xwdt_probe(struct platform_device *pdev)
{ {
int rc; int rc;
u32 pfreq, enable_once = 0; u32 pfreq = 0, enable_once = 0;
struct resource *res; struct resource *res;
struct xwdt_device *xdev; struct xwdt_device *xdev;
bool no_timeout = false;
struct watchdog_device *xilinx_wdt_wdd; struct watchdog_device *xilinx_wdt_wdd;
xdev = devm_kzalloc(&pdev->dev, sizeof(*xdev), GFP_KERNEL); xdev = devm_kzalloc(&pdev->dev, sizeof(*xdev), GFP_KERNEL);
@ -167,19 +166,15 @@ static int xwdt_probe(struct platform_device *pdev)
return PTR_ERR(xdev->base); return PTR_ERR(xdev->base);
rc = of_property_read_u32(pdev->dev.of_node, "clock-frequency", &pfreq); rc = of_property_read_u32(pdev->dev.of_node, "clock-frequency", &pfreq);
if (rc) { if (rc)
dev_warn(&pdev->dev, dev_warn(&pdev->dev,
"The watchdog clock frequency cannot be obtained\n"); "The watchdog clock frequency cannot be obtained\n");
no_timeout = true;
}
rc = of_property_read_u32(pdev->dev.of_node, "xlnx,wdt-interval", rc = of_property_read_u32(pdev->dev.of_node, "xlnx,wdt-interval",
&xdev->wdt_interval); &xdev->wdt_interval);
if (rc) { if (rc)
dev_warn(&pdev->dev, dev_warn(&pdev->dev,
"Parameter \"xlnx,wdt-interval\" not found\n"); "Parameter \"xlnx,wdt-interval\" not found\n");
no_timeout = true;
}
rc = of_property_read_u32(pdev->dev.of_node, "xlnx,wdt-enable-once", rc = of_property_read_u32(pdev->dev.of_node, "xlnx,wdt-enable-once",
&enable_once); &enable_once);
@ -193,7 +188,7 @@ static int xwdt_probe(struct platform_device *pdev)
* Twice of the 2^wdt_interval / freq because the first wdt overflow is * Twice of the 2^wdt_interval / freq because the first wdt overflow is
* ignored (interrupt), reset is only generated at second wdt overflow * ignored (interrupt), reset is only generated at second wdt overflow
*/ */
if (!no_timeout) if (pfreq && xdev->wdt_interval)
xilinx_wdt_wdd->timeout = 2 * ((1 << xdev->wdt_interval) / xilinx_wdt_wdd->timeout = 2 * ((1 << xdev->wdt_interval) /
pfreq); pfreq);