diff options
author | Alan Cox <alan@redhat.com> | 2008-05-19 09:09:12 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2008-06-21 12:15:57 -0400 |
commit | 8dc244f7deac4c0e95ce0ffd26f494bb6e1534c0 (patch) | |
tree | 428e27d6a5e2f3c94369cf50e6c84bd671c80baa /drivers/watchdog | |
parent | f92d3749d70265468e28643652c0e32c5a56cd2b (diff) |
[WATCHDOG 48/57] txx9: Fix locking, switch to unlocked_ioctl
Review and switch to unlocked_ioctl
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/txx9wdt.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/watchdog/txx9wdt.c b/drivers/watchdog/txx9wdt.c index 57cefef27ce3..b729cc447df3 100644 --- a/drivers/watchdog/txx9wdt.c +++ b/drivers/watchdog/txx9wdt.c | |||
@@ -45,27 +45,34 @@ static unsigned long txx9wdt_alive; | |||
45 | static int expect_close; | 45 | static int expect_close; |
46 | static struct txx9_tmr_reg __iomem *txx9wdt_reg; | 46 | static struct txx9_tmr_reg __iomem *txx9wdt_reg; |
47 | static struct clk *txx9_imclk; | 47 | static struct clk *txx9_imclk; |
48 | static DECLARE_LOCK(txx9_lock); | ||
48 | 49 | ||
49 | static void txx9wdt_ping(void) | 50 | static void txx9wdt_ping(void) |
50 | { | 51 | { |
52 | spin_lock(&txx9_lock); | ||
51 | __raw_writel(TXx9_TMWTMR_TWIE | TXx9_TMWTMR_TWC, &txx9wdt_reg->wtmr); | 53 | __raw_writel(TXx9_TMWTMR_TWIE | TXx9_TMWTMR_TWC, &txx9wdt_reg->wtmr); |
54 | spin_unlock(&txx9_lock); | ||
52 | } | 55 | } |
53 | 56 | ||
54 | static void txx9wdt_start(void) | 57 | static void txx9wdt_start(void) |
55 | { | 58 | { |
59 | spin_lock(&txx9_lock); | ||
56 | __raw_writel(WD_TIMER_CLK * timeout, &txx9wdt_reg->cpra); | 60 | __raw_writel(WD_TIMER_CLK * timeout, &txx9wdt_reg->cpra); |
57 | __raw_writel(WD_TIMER_CCD, &txx9wdt_reg->ccdr); | 61 | __raw_writel(WD_TIMER_CCD, &txx9wdt_reg->ccdr); |
58 | __raw_writel(0, &txx9wdt_reg->tisr); /* clear pending interrupt */ | 62 | __raw_writel(0, &txx9wdt_reg->tisr); /* clear pending interrupt */ |
59 | __raw_writel(TXx9_TMTCR_TCE | TXx9_TMTCR_CCDE | TXx9_TMTCR_TMODE_WDOG, | 63 | __raw_writel(TXx9_TMTCR_TCE | TXx9_TMTCR_CCDE | TXx9_TMTCR_TMODE_WDOG, |
60 | &txx9wdt_reg->tcr); | 64 | &txx9wdt_reg->tcr); |
61 | __raw_writel(TXx9_TMWTMR_TWIE | TXx9_TMWTMR_TWC, &txx9wdt_reg->wtmr); | 65 | __raw_writel(TXx9_TMWTMR_TWIE | TXx9_TMWTMR_TWC, &txx9wdt_reg->wtmr); |
66 | spin_unlock(&txx9_lock); | ||
62 | } | 67 | } |
63 | 68 | ||
64 | static void txx9wdt_stop(void) | 69 | static void txx9wdt_stop(void) |
65 | { | 70 | { |
71 | spin_lock(&txx9_lock); | ||
66 | __raw_writel(TXx9_TMWTMR_WDIS, &txx9wdt_reg->wtmr); | 72 | __raw_writel(TXx9_TMWTMR_WDIS, &txx9wdt_reg->wtmr); |
67 | __raw_writel(__raw_readl(&txx9wdt_reg->tcr) & ~TXx9_TMTCR_TCE, | 73 | __raw_writel(__raw_readl(&txx9wdt_reg->tcr) & ~TXx9_TMTCR_TCE, |
68 | &txx9wdt_reg->tcr); | 74 | &txx9wdt_reg->tcr); |
75 | spin_unlock(&txx9_lock); | ||
69 | } | 76 | } |
70 | 77 | ||
71 | static int txx9wdt_open(struct inode *inode, struct file *file) | 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 | return len; | 127 | return len; |
121 | } | 128 | } |
122 | 129 | ||
123 | static int txx9wdt_ioctl(struct inode *inode, struct file *file, | 130 | static long txx9wdt_ioctl(struct file *file, unsigned int cmd, |
124 | unsigned int cmd, unsigned long arg) | 131 | unsigned long arg) |
125 | { | 132 | { |
126 | void __user *argp = (void __user *)arg; | 133 | void __user *argp = (void __user *)arg; |
127 | int __user *p = argp; | 134 | int __user *p = argp; |
128 | int new_timeout; | 135 | int new_timeout; |
129 | static struct watchdog_info ident = { | 136 | static const struct watchdog_info ident = { |
130 | .options = WDIOF_SETTIMEOUT | | 137 | .options = WDIOF_SETTIMEOUT | |
131 | WDIOF_KEEPALIVEPING | | 138 | WDIOF_KEEPALIVEPING | |
132 | WDIOF_MAGICCLOSE, | 139 | WDIOF_MAGICCLOSE, |
@@ -168,18 +175,18 @@ static int txx9wdt_notify_sys(struct notifier_block *this, unsigned long code, | |||
168 | } | 175 | } |
169 | 176 | ||
170 | static const struct file_operations txx9wdt_fops = { | 177 | static const struct file_operations txx9wdt_fops = { |
171 | .owner = THIS_MODULE, | 178 | .owner = THIS_MODULE, |
172 | .llseek = no_llseek, | 179 | .llseek = no_llseek, |
173 | .write = txx9wdt_write, | 180 | .write = txx9wdt_write, |
174 | .ioctl = txx9wdt_ioctl, | 181 | .unlocked_ioctl = txx9wdt_ioctl, |
175 | .open = txx9wdt_open, | 182 | .open = txx9wdt_open, |
176 | .release = txx9wdt_release, | 183 | .release = txx9wdt_release, |
177 | }; | 184 | }; |
178 | 185 | ||
179 | static struct miscdevice txx9wdt_miscdev = { | 186 | static struct miscdevice txx9wdt_miscdev = { |
180 | .minor = WATCHDOG_MINOR, | 187 | .minor = WATCHDOG_MINOR, |
181 | .name = "watchdog", | 188 | .name = "watchdog", |
182 | .fops = &txx9wdt_fops, | 189 | .fops = &txx9wdt_fops, |
183 | }; | 190 | }; |
184 | 191 | ||
185 | static struct notifier_block txx9wdt_notifier = { | 192 | static struct notifier_block txx9wdt_notifier = { |