aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-05-22 05:40:25 -0400
committerWim Van Sebroeck <wim@iguana.be>2012-05-30 01:55:41 -0400
commit85a2e40cb5053574cd3b1f33c00194309ce3704c (patch)
tree760e63cb090ac1a8eff5a0daca2bfe47176f9fb6 /drivers/hwmon
parentfb551405c0f8e15d6fc7ae6e16a5e15382f8b8ac (diff)
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: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/sch56xx-common.c41
1 files changed, 16 insertions, 25 deletions
diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c
index 419a8e8f5191..35846cbf1c9c 100644
--- a/drivers/hwmon/sch56xx-common.c
+++ b/drivers/hwmon/sch56xx-common.c
@@ -334,18 +334,14 @@ static int watchdog_start(struct watchdog_device *wddev)
334 if (ret) 334 if (ret)
335 goto leave; 335 goto leave;
336 336
337 /* 2. Enable output (if not already enabled) */ 337 /* 2. Enable output */
338 if (!(data->watchdog_output_enable & SCH56XX_WDOG_OUTPUT_ENABLE)) { 338 val = data->watchdog_output_enable | SCH56XX_WDOG_OUTPUT_ENABLE;
339 val = data->watchdog_output_enable | 339 ret = sch56xx_write_virtual_reg(data->addr,
340 SCH56XX_WDOG_OUTPUT_ENABLE; 340 SCH56XX_REG_WDOG_OUTPUT_ENABLE, val);
341 ret = sch56xx_write_virtual_reg(data->addr, 341 if (ret)
342 SCH56XX_REG_WDOG_OUTPUT_ENABLE, 342 goto leave;
343 val);
344 if (ret)
345 goto leave;
346 343
347 data->watchdog_output_enable = val; 344 data->watchdog_output_enable = val;
348 }
349 345
350 /* 3. Clear the watchdog event bit if set */ 346 /* 3. Clear the watchdog event bit if set */
351 val = inb(data->addr + 9); 347 val = inb(data->addr + 9);
@@ -377,21 +373,16 @@ static int watchdog_stop(struct watchdog_device *wddev)
377 int ret = 0; 373 int ret = 0;
378 u8 val; 374 u8 val;
379 375
380 if (data->watchdog_output_enable & SCH56XX_WDOG_OUTPUT_ENABLE) { 376 val = data->watchdog_output_enable & ~SCH56XX_WDOG_OUTPUT_ENABLE;
381 val = data->watchdog_output_enable & 377 mutex_lock(data->io_lock);
382 ~SCH56XX_WDOG_OUTPUT_ENABLE; 378 ret = sch56xx_write_virtual_reg(data->addr,
383 mutex_lock(data->io_lock); 379 SCH56XX_REG_WDOG_OUTPUT_ENABLE, val);
384 ret = sch56xx_write_virtual_reg(data->addr, 380 mutex_unlock(data->io_lock);
385 SCH56XX_REG_WDOG_OUTPUT_ENABLE, 381 if (ret)
386 val); 382 return ret;
387 mutex_unlock(data->io_lock);
388 if (ret)
389 return ret;
390
391 data->watchdog_output_enable = val;
392 }
393 383
394 return ret; 384 data->watchdog_output_enable = val;
385 return 0;
395} 386}
396 387
397static const struct watchdog_ops watchdog_ops = { 388static const struct watchdog_ops watchdog_ops = {