Change IT87 drivers to use it87_io_lock.
PATCH v2 2/3 Change IT87 drivers to use it87_io_lock.
02 - Adds changes to watchdog drivers to use the new lock.
This patch changes it8712f_wdt.c and it87_wdt.c to use the newit87_io_lock to serialize access to the hardware.
The routines accessing the hardware are being called from module init,
open, ioctl and module exit routines and hence it is sufficient to use calls to spin_lock and spin_unlock to acquire and release the locks. For the same reasons it87_wdt.c has extensive changes to remove calls to spin_lock_irqsave and spin_unlock_irqrestore. The lock is now acquired in superio_enter and released in superio_exit. This is now identical to the code in drivers/hwmon/it87.c and drivers/watchdog/it8712f_wdt.c. Added __acquire and __release annotations wherever needed.
---
drivers/watchdog/it8712f_wdt.c +5 -5
@@ -32,6 +32,7 @@#include <linux/spinlock.h> #include <linux/uaccess.h> #include <linux/io.h> +#include <linux/it87_lock.h> #define NAME "it8712f_wdt"
@@ -51,7 +52,6 @@ MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close");static unsigned long wdt_open;static unsigned expect_close; -static spinlock_t io_lock;static unsigned char revision;/* Dog Food address - We use the game port address */
@@ -122,8 +122,9 @@ static inline void superio_select(int ldn) }static inline void superio_enter (void ) +__acquires(&it87_io_lock) { -spin_lock (&io_lock); +spin_lock (&it87_io_lock);outb (0x87 ,REG );outb (0x01 ,REG );outb (0x55 ,REG );
@@ -131,10 +132,11 @@ static inline void superio_enter(void) }static inline void superio_exit (void ) +__releases(&it87_io_lock) {outb (0x02 ,REG );outb (0x02 ,VAL ); -spin_unlock (&io_lock); +spin_unlock (&it87_io_lock); }static inline void it8712f_wdt_ping (void )
@@ -382,8 +384,6 @@ static int __init it8712f_wdt_init(void) {int err =0 ; -spin_lock_init (&io_lock); -if (it8712f_wdt_find (&address))return -ENODEV ;
drivers/watchdog/it87_wdt.c +7 -35
208 lines not on this page · raw message
Signature · 4 lines
_______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors