diff options
author | Jens Rottmann <JRottmann@LiPPERTEmbedded.de> | 2010-08-10 21:03:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-11 11:59:20 -0400 |
commit | ecd6269174c04da5efbd17d6bff793e428eb45ef (patch) | |
tree | 9dbf1a8b0843ffc52f9f2fb9202acd096db3c755 /drivers/misc | |
parent | e73790a57abc1320b3c3a94da43ae24359687d7c (diff) |
cs5535-mfgpt: reuse timers that have never been set up
The MFGPT hardware may be set up only once, therefore
cs5535_mfgpt_free_timer() didn't re-set the timer's "avail" bit. However
if a timer is freed before it has actually been in use then it may be made
available again.
Signed-off-by: Jens Rottmann <JRottmann@LiPPERTEmbedded.de>
Acked-by: Andres Salomon <dilinger@queued.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jordan Crouse <jordan@cosmicpenguin.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/cs5535-mfgpt.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/misc/cs5535-mfgpt.c b/drivers/misc/cs5535-mfgpt.c index 2d44b3300104..6f6218061b0d 100644 --- a/drivers/misc/cs5535-mfgpt.c +++ b/drivers/misc/cs5535-mfgpt.c | |||
@@ -211,6 +211,17 @@ EXPORT_SYMBOL_GPL(cs5535_mfgpt_alloc_timer); | |||
211 | */ | 211 | */ |
212 | void cs5535_mfgpt_free_timer(struct cs5535_mfgpt_timer *timer) | 212 | void cs5535_mfgpt_free_timer(struct cs5535_mfgpt_timer *timer) |
213 | { | 213 | { |
214 | unsigned long flags; | ||
215 | uint16_t val; | ||
216 | |||
217 | /* timer can be made available again only if never set up */ | ||
218 | val = cs5535_mfgpt_read(timer, MFGPT_REG_SETUP); | ||
219 | if (!(val & MFGPT_SETUP_SETUP)) { | ||
220 | spin_lock_irqsave(&timer->chip->lock, flags); | ||
221 | __set_bit(timer->nr, timer->chip->avail); | ||
222 | spin_unlock_irqrestore(&timer->chip->lock, flags); | ||
223 | } | ||
224 | |||
214 | kfree(timer); | 225 | kfree(timer); |
215 | } | 226 | } |
216 | EXPORT_SYMBOL_GPL(cs5535_mfgpt_free_timer); | 227 | EXPORT_SYMBOL_GPL(cs5535_mfgpt_free_timer); |