The patch titled cs5535-mfgpt: reuse timers that have never been set up has been added to the -mm tree. Its filename is cs5535-mfgpt-reuse-timers-that-have-never-been-set-up.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: cs5535-mfgpt: reuse timers that have never been set up From: Jens Rottmann <JRottmann@xxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxx> Acked-by: Andres Salomon <dilinger@xxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Jordan Crouse <jordan@xxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/misc/cs5535-mfgpt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff -puN drivers/misc/cs5535-mfgpt.c~cs5535-mfgpt-reuse-timers-that-have-never-been-set-up drivers/misc/cs5535-mfgpt.c --- a/drivers/misc/cs5535-mfgpt.c~cs5535-mfgpt-reuse-timers-that-have-never-been-set-up +++ a/drivers/misc/cs5535-mfgpt.c @@ -211,6 +211,17 @@ EXPORT_SYMBOL_GPL(cs5535_mfgpt_alloc_tim */ void cs5535_mfgpt_free_timer(struct cs5535_mfgpt_timer *timer) { + unsigned long flags; + uint16_t val; + + /* timer can be made available again only if never set up */ + val = cs5535_mfgpt_read(timer, MFGPT_REG_SETUP); + if (!(val & MFGPT_SETUP_SETUP)) { + spin_lock_irqsave(&timer->chip->lock, flags); + __set_bit(timer->nr, timer->chip->avail); + spin_unlock_irqrestore(&timer->chip->lock, flags); + } + kfree(timer); } EXPORT_SYMBOL_GPL(cs5535_mfgpt_free_timer); _ Patches currently in -mm which might be from JRottmann@xxxxxxxxxxxxxxxxxx are cs5535-mfgpt-reuse-timers-that-have-never-been-set-up.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html