Commit 85a2e40c authored by Hans de Goede's avatar Hans de Goede Committed by Wim Van Sebroeck

watchdog: sch56xx: Remove unnecessary checks for register changes

Since the watchdog core keeps track of the watchdog's active state, start/stop
will never get called when no changes are necessary. So we can remove the
check for the output_enable register changing before writing it (which is
an expensive operation).
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent fb551405
...@@ -334,18 +334,14 @@ static int watchdog_start(struct watchdog_device *wddev) ...@@ -334,18 +334,14 @@ static int watchdog_start(struct watchdog_device *wddev)
if (ret) if (ret)
goto leave; goto leave;
/* 2. Enable output (if not already enabled) */ /* 2. Enable output */
if (!(data->watchdog_output_enable & SCH56XX_WDOG_OUTPUT_ENABLE)) { val = data->watchdog_output_enable | SCH56XX_WDOG_OUTPUT_ENABLE;
val = data->watchdog_output_enable | ret = sch56xx_write_virtual_reg(data->addr,
SCH56XX_WDOG_OUTPUT_ENABLE; SCH56XX_REG_WDOG_OUTPUT_ENABLE, val);
ret = sch56xx_write_virtual_reg(data->addr, if (ret)
SCH56XX_REG_WDOG_OUTPUT_ENABLE, goto leave;
val);
if (ret)
goto leave;
data->watchdog_output_enable = val; data->watchdog_output_enable = val;
}
/* 3. Clear the watchdog event bit if set */ /* 3. Clear the watchdog event bit if set */
val = inb(data->addr + 9); val = inb(data->addr + 9);
...@@ -377,21 +373,16 @@ static int watchdog_stop(struct watchdog_device *wddev) ...@@ -377,21 +373,16 @@ static int watchdog_stop(struct watchdog_device *wddev)
int ret = 0; int ret = 0;
u8 val; u8 val;
if (data->watchdog_output_enable & SCH56XX_WDOG_OUTPUT_ENABLE) { val = data->watchdog_output_enable & ~SCH56XX_WDOG_OUTPUT_ENABLE;
val = data->watchdog_output_enable & mutex_lock(data->io_lock);
~SCH56XX_WDOG_OUTPUT_ENABLE; ret = sch56xx_write_virtual_reg(data->addr,
mutex_lock(data->io_lock); SCH56XX_REG_WDOG_OUTPUT_ENABLE, val);
ret = sch56xx_write_virtual_reg(data->addr, mutex_unlock(data->io_lock);
SCH56XX_REG_WDOG_OUTPUT_ENABLE, if (ret)
val); return ret;
mutex_unlock(data->io_lock);
if (ret)
return ret;
data->watchdog_output_enable = val;
}
return ret; data->watchdog_output_enable = val;
return 0;
} }
static const struct watchdog_ops watchdog_ops = { static const struct watchdog_ops watchdog_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment