@@ -45,27 +45,34 @@ static unsigned long txx9wdt_alive;
45
45
static int expect_close ;
46
46
static struct txx9_tmr_reg __iomem * txx9wdt_reg ;
47
47
static struct clk * txx9_imclk ;
48
+ static DECLARE_LOCK (txx9_lock );
48
49
49
50
static void txx9wdt_ping (void )
50
51
{
52
+ spin_lock (& txx9_lock );
51
53
__raw_writel (TXx9_TMWTMR_TWIE | TXx9_TMWTMR_TWC , & txx9wdt_reg -> wtmr );
54
+ spin_unlock (& txx9_lock );
52
55
}
53
56
54
57
static void txx9wdt_start (void )
55
58
{
59
+ spin_lock (& txx9_lock );
56
60
__raw_writel (WD_TIMER_CLK * timeout , & txx9wdt_reg -> cpra );
57
61
__raw_writel (WD_TIMER_CCD , & txx9wdt_reg -> ccdr );
58
62
__raw_writel (0 , & txx9wdt_reg -> tisr ); /* clear pending interrupt */
59
63
__raw_writel (TXx9_TMTCR_TCE | TXx9_TMTCR_CCDE | TXx9_TMTCR_TMODE_WDOG ,
60
64
& txx9wdt_reg -> tcr );
61
65
__raw_writel (TXx9_TMWTMR_TWIE | TXx9_TMWTMR_TWC , & txx9wdt_reg -> wtmr );
66
+ spin_unlock (& txx9_lock );
62
67
}
63
68
64
69
static void txx9wdt_stop (void )
65
70
{
71
+ spin_lock (& txx9_lock );
66
72
__raw_writel (TXx9_TMWTMR_WDIS , & txx9wdt_reg -> wtmr );
67
73
__raw_writel (__raw_readl (& txx9wdt_reg -> tcr ) & ~TXx9_TMTCR_TCE ,
68
74
& txx9wdt_reg -> tcr );
75
+ spin_unlock (& txx9_lock );
69
76
}
70
77
71
78
static int txx9wdt_open (struct inode * inode , struct file * file )
@@ -120,13 +127,13 @@ static ssize_t txx9wdt_write(struct file *file, const char __user *data,
120
127
return len ;
121
128
}
122
129
123
- static int txx9wdt_ioctl (struct inode * inode , struct file * file ,
124
- unsigned int cmd , unsigned long arg )
130
+ static long txx9wdt_ioctl (struct file * file , unsigned int cmd ,
131
+ unsigned long arg )
125
132
{
126
133
void __user * argp = (void __user * )arg ;
127
134
int __user * p = argp ;
128
135
int new_timeout ;
129
- static struct watchdog_info ident = {
136
+ static const struct watchdog_info ident = {
130
137
.options = WDIOF_SETTIMEOUT |
131
138
WDIOF_KEEPALIVEPING |
132
139
WDIOF_MAGICCLOSE ,
@@ -168,18 +175,18 @@ static int txx9wdt_notify_sys(struct notifier_block *this, unsigned long code,
168
175
}
169
176
170
177
static const struct file_operations txx9wdt_fops = {
171
- .owner = THIS_MODULE ,
172
- .llseek = no_llseek ,
173
- .write = txx9wdt_write ,
174
- .ioctl = txx9wdt_ioctl ,
175
- .open = txx9wdt_open ,
176
- .release = txx9wdt_release ,
178
+ .owner = THIS_MODULE ,
179
+ .llseek = no_llseek ,
180
+ .write = txx9wdt_write ,
181
+ .unlocked_ioctl = txx9wdt_ioctl ,
182
+ .open = txx9wdt_open ,
183
+ .release = txx9wdt_release ,
177
184
};
178
185
179
186
static struct miscdevice txx9wdt_miscdev = {
180
- .minor = WATCHDOG_MINOR ,
181
- .name = "watchdog" ,
182
- .fops = & txx9wdt_fops ,
187
+ .minor = WATCHDOG_MINOR ,
188
+ .name = "watchdog" ,
189
+ .fops = & txx9wdt_fops ,
183
190
};
184
191
185
192
static struct notifier_block txx9wdt_notifier = {
0 commit comments