Skip to content

Commit 27a46a0

Browse files
groeckWim Van Sebroeck
authored andcommitted
watchdog: iTCO: Drop driver-internal locking
The locking code in the iTCO watchdog driver has been carried along from before the watchdog core existed. The watchdog core protects calls into drivers since commit f4e9c82 ("watchdog: Add Locking support"), making driver-internal locking unnecessary. Drop it. Signed-off-by: Guenter Roeck <[email protected]> Reviewed-by: Wim Van Sebroeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent 45f1884 commit 27a46a0

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

drivers/watchdog/iTCO_wdt.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
#include <linux/platform_device.h> /* For platform_driver framework */
5959
#include <linux/pci.h> /* For pci functions */
6060
#include <linux/ioport.h> /* For io-port access */
61-
#include <linux/spinlock.h> /* For spin_lock/spin_unlock/... */
6261
#include <linux/uaccess.h> /* For copy_to_user/put_user/... */
6362
#include <linux/io.h> /* For inb/outb/... */
6463
#include <linux/platform_data/itco_wdt.h>
@@ -102,8 +101,6 @@ struct iTCO_wdt_private {
102101
* or memory-mapped PMC register bit 4 (TCO version 3).
103102
*/
104103
unsigned long __iomem *gcs_pmc;
105-
/* the lock for io operations */
106-
spinlock_t io_lock;
107104
/* the PCI-device */
108105
struct pci_dev *pci_dev;
109106
/* whether or not the watchdog has been suspended */
@@ -286,13 +283,10 @@ static int iTCO_wdt_start(struct watchdog_device *wd_dev)
286283
struct iTCO_wdt_private *p = watchdog_get_drvdata(wd_dev);
287284
unsigned int val;
288285

289-
spin_lock(&p->io_lock);
290-
291286
iTCO_vendor_pre_start(p->smi_res, wd_dev->timeout);
292287

293288
/* disable chipset's NO_REBOOT bit */
294289
if (p->update_no_reboot_bit(p->no_reboot_priv, false)) {
295-
spin_unlock(&p->io_lock);
296290
dev_err(wd_dev->parent, "failed to reset NO_REBOOT flag, reboot disabled by hardware/BIOS\n");
297291
return -EIO;
298292
}
@@ -309,7 +303,6 @@ static int iTCO_wdt_start(struct watchdog_device *wd_dev)
309303
val &= 0xf7ff;
310304
outw(val, TCO1_CNT(p));
311305
val = inw(TCO1_CNT(p));
312-
spin_unlock(&p->io_lock);
313306

314307
if (val & 0x0800)
315308
return -1;
@@ -321,8 +314,6 @@ static int iTCO_wdt_stop(struct watchdog_device *wd_dev)
321314
struct iTCO_wdt_private *p = watchdog_get_drvdata(wd_dev);
322315
unsigned int val;
323316

324-
spin_lock(&p->io_lock);
325-
326317
iTCO_vendor_pre_stop(p->smi_res);
327318

328319
/* Bit 11: TCO Timer Halt -> 1 = The TCO timer is disabled */
@@ -334,8 +325,6 @@ static int iTCO_wdt_stop(struct watchdog_device *wd_dev)
334325
/* Set the NO_REBOOT bit to prevent later reboots, just for sure */
335326
p->update_no_reboot_bit(p->no_reboot_priv, true);
336327

337-
spin_unlock(&p->io_lock);
338-
339328
if ((val & 0x0800) == 0)
340329
return -1;
341330
return 0;
@@ -345,8 +334,6 @@ static int iTCO_wdt_ping(struct watchdog_device *wd_dev)
345334
{
346335
struct iTCO_wdt_private *p = watchdog_get_drvdata(wd_dev);
347336

348-
spin_lock(&p->io_lock);
349-
350337
/* Reload the timer by writing to the TCO Timer Counter register */
351338
if (p->iTCO_version >= 2) {
352339
outw(0x01, TCO_RLD(p));
@@ -358,7 +345,6 @@ static int iTCO_wdt_ping(struct watchdog_device *wd_dev)
358345
outb(0x01, TCO_RLD(p));
359346
}
360347

361-
spin_unlock(&p->io_lock);
362348
return 0;
363349
}
364350

@@ -385,24 +371,20 @@ static int iTCO_wdt_set_timeout(struct watchdog_device *wd_dev, unsigned int t)
385371

386372
/* Write new heartbeat to watchdog */
387373
if (p->iTCO_version >= 2) {
388-
spin_lock(&p->io_lock);
389374
val16 = inw(TCOv2_TMR(p));
390375
val16 &= 0xfc00;
391376
val16 |= tmrval;
392377
outw(val16, TCOv2_TMR(p));
393378
val16 = inw(TCOv2_TMR(p));
394-
spin_unlock(&p->io_lock);
395379

396380
if ((val16 & 0x3ff) != tmrval)
397381
return -EINVAL;
398382
} else if (p->iTCO_version == 1) {
399-
spin_lock(&p->io_lock);
400383
val8 = inb(TCOv1_TMR(p));
401384
val8 &= 0xc0;
402385
val8 |= (tmrval & 0xff);
403386
outb(val8, TCOv1_TMR(p));
404387
val8 = inb(TCOv1_TMR(p));
405-
spin_unlock(&p->io_lock);
406388

407389
if ((val8 & 0x3f) != tmrval)
408390
return -EINVAL;
@@ -421,19 +403,15 @@ static unsigned int iTCO_wdt_get_timeleft(struct watchdog_device *wd_dev)
421403

422404
/* read the TCO Timer */
423405
if (p->iTCO_version >= 2) {
424-
spin_lock(&p->io_lock);
425406
val16 = inw(TCO_RLD(p));
426407
val16 &= 0x3ff;
427-
spin_unlock(&p->io_lock);
428408

429409
time_left = ticks_to_seconds(p, val16);
430410
} else if (p->iTCO_version == 1) {
431-
spin_lock(&p->io_lock);
432411
val8 = inb(TCO_RLD(p));
433412
val8 &= 0x3f;
434413
if (!(inw(TCO1_STS(p)) & 0x0008))
435414
val8 += (inb(TCOv1_TMR(p)) & 0x3f);
436-
spin_unlock(&p->io_lock);
437415

438416
time_left = ticks_to_seconds(p, val8);
439417
}
@@ -493,8 +471,6 @@ static int iTCO_wdt_probe(struct platform_device *pdev)
493471
if (!p)
494472
return -ENOMEM;
495473

496-
spin_lock_init(&p->io_lock);
497-
498474
p->tco_res = platform_get_resource(pdev, IORESOURCE_IO, ICH_RES_IO_TCO);
499475
if (!p->tco_res)
500476
return -ENODEV;

0 commit comments

Comments
 (0)