| .. | .. |
|---|
| 426 | 426 | return time_left; |
|---|
| 427 | 427 | } |
|---|
| 428 | 428 | |
|---|
| 429 | +/* Returns true if the watchdog was running */ |
|---|
| 430 | +static bool iTCO_wdt_set_running(struct iTCO_wdt_private *p) |
|---|
| 431 | +{ |
|---|
| 432 | + u16 val; |
|---|
| 433 | + |
|---|
| 434 | + /* Bit 11: TCO Timer Halt -> 0 = The TCO timer is enabled */ |
|---|
| 435 | + val = inw(TCO1_CNT(p)); |
|---|
| 436 | + if (!(val & BIT(11))) { |
|---|
| 437 | + set_bit(WDOG_HW_RUNNING, &p->wddev.status); |
|---|
| 438 | + return true; |
|---|
| 439 | + } |
|---|
| 440 | + return false; |
|---|
| 441 | +} |
|---|
| 442 | + |
|---|
| 429 | 443 | /* |
|---|
| 430 | 444 | * Kernel Interfaces |
|---|
| 431 | 445 | */ |
|---|
| .. | .. |
|---|
| 514 | 528 | return -ENODEV; /* Cannot reset NO_REBOOT bit */ |
|---|
| 515 | 529 | } |
|---|
| 516 | 530 | |
|---|
| 517 | | - /* Set the NO_REBOOT bit to prevent later reboots, just for sure */ |
|---|
| 518 | | - p->update_no_reboot_bit(p->no_reboot_priv, true); |
|---|
| 519 | | - |
|---|
| 520 | 531 | if (turn_SMI_watchdog_clear_off >= p->iTCO_version) { |
|---|
| 521 | 532 | /* |
|---|
| 522 | 533 | * Bit 13: TCO_EN -> 0 |
|---|
| .. | .. |
|---|
| 568 | 579 | watchdog_set_drvdata(&p->wddev, p); |
|---|
| 569 | 580 | platform_set_drvdata(pdev, p); |
|---|
| 570 | 581 | |
|---|
| 571 | | - /* Make sure the watchdog is not running */ |
|---|
| 572 | | - iTCO_wdt_stop(&p->wddev); |
|---|
| 582 | + if (!iTCO_wdt_set_running(p)) { |
|---|
| 583 | + /* |
|---|
| 584 | + * If the watchdog was not running set NO_REBOOT now to |
|---|
| 585 | + * prevent later reboots. |
|---|
| 586 | + */ |
|---|
| 587 | + p->update_no_reboot_bit(p->no_reboot_priv, true); |
|---|
| 588 | + } |
|---|
| 573 | 589 | |
|---|
| 574 | 590 | /* Check that the heartbeat value is within it's range; |
|---|
| 575 | 591 | if not reset to the default */ |
|---|