aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Rottmann <JRottmann@LiPPERTEmbedded.de>2010-08-10 21:03:12 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-11 11:59:20 -0400
commitecd6269174c04da5efbd17d6bff793e428eb45ef (patch)
tree9dbf1a8b0843ffc52f9f2fb9202acd096db3c755
parente73790a57abc1320b3c3a94da43ae24359687d7c (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>
-rw-r--r--drivers/misc/cs5535-mfgpt.c11
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 */
212void cs5535_mfgpt_free_timer(struct cs5535_mfgpt_timer *timer) 212void 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}
216EXPORT_SYMBOL_GPL(cs5535_mfgpt_free_timer); 227EXPORT_SYMBOL_GPL(cs5535_mfgpt_free_timer);