aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 = {